WGC Utility (Test maps at high game speed)

This bundle is marked as pending. It has not been reviewed by a staff member yet.

Warcraft 3 .wgc launcher​

This utility allows you to generate a .wgc (Warcraft 3 Game Configuration) file according to your settings and launch the game to test a map.
WorldEditor used this only to test AI scripts (in the AI editor) and had a limitation of only allowing melee maps. Annoyingly, this entire functionality seems broken in Reforged (as of 1.32.10).

Features:​

  • set any gamespeed (beyond 25x)
  • test map in a single click (don't need to launch WE or game manually)
  • it works (Reforged doesn't)
  • launch any map, customs too (WE required melee maps only)
  • test map can be in any directory (WC3 required maps to be in a local path)
  • Classic and Reforged support
  • highly configurable, you can set:
    • player slot, team, race, color, handicap, AI difficulty and AI script path
    • custom WC3 path
    • custom game arguments (e.g. -windowed, you can't do this in WE)
    • enable/disable FoW and win/lose conditions
    • gamespeed

Usage:​

Note: Windows can use backslahes and forward slashes in paths: C:\folder\ is same as C:/folder/. I recommend to always use C:/folder/ to avoid unexpected backslash interpretations and errors.

--gameroot <full path to wc3 root folder>​

C:/folder/Warcraft III Reforged/_retail_/ or C:/folder/Warcraft III Classic/

--gameexe <full path to game .exe>​

C:/folder/Warcraft III Reforged/_retail_/x86_64/Warcraft III.exe or C:/folder/Warcraft III Classic/War3.exe

--map <path to test map>​


--gameargs <custom launch paramters>​

Reforged requires -launch to start the game.

--gamespeed <0-n>​

Default speed is 1 for 100% speed.

--disable-victory / --enable-victory​

Victory conditions enabled by default.

--disable-fow / --enable-fow​

Fog of War is enabled by defualt.

--slot <slot config> (repeated x times for players)​

This can be repeated any number of times to setup all testing slots. --slot has the following structure:
Code:
--slot slotNUM,teamNUM,raceNAME,colorNUM,healthNUM,SLOT_TYPE[,CUSTOMAI_SCRIPT_PATH]
NUM is a zero-based number.
  • SlotNUM: 0-11 / 0-23 (Classic/Reforged), 0="red" player
  • TeamNUM: 0-n
  • Race NAME:
    • human
    • orc
    • nightelf
    • undead
    • random
  • ColorNUM: 0-11 / 0-23 (Classic/Reforged), 0=red
  • HealthNUM: 50-100 (handicap, 50 means player's units have 50% hp)
  • SLOT_TYPE:
    • human (you as a player)
    • observer (you as an observer)
    • aiNUM (default AI player with NUM difficulty)
    • customaiNUM,scriptpath (custom AI player with NUM difficulty and full OS path to script)
AI difficulty: 0 = easy, 1 = medium, 2 = hard
Note: This script does not strictly check configuration here. You can practically enter any values for testing WC3 or whatever. Totally invalid values will cause the map to not run.

Development only:​

  • --print
    Requires a table.serialize(strTableName, tabl) implementation. It is loaded via table.serialize = require("serialize")
  • --wgc <path to wgc>
    Together with --print it'll be used to print .wgc contents to console STDOUT. Otherwise this will be used as path to generate a new .wgc file.

Examples:​

OSX / Linux / *nix​

For Shell (Bash) create a text file start-map.sh with the following contents:
Bash:
lua ./wgc-launch.lua \
--gameroot 'D:/War3-v127' \
--gameexe 'D:/War3-v127/war3.exe' \
--map 'D:/War3-v127/Maps/(2)HillsOfGlory.w3m' \
--slot slot0,team0,raceRandom,color0,health100,ai1 \
--slot slot1,team1,raceHuman,color1,health70,ai0 \
--slot slot2,team0,raceRandom,color2,health100,observer \
--gameargs "-windowed -launch" \
--gamespeed 64
To start it by double-clicking, you must give it execution permissions, for example with chmod +x start-map.sh.

Windows​

You could use Cygwin for a terminal with Bash, but CMD.exe works too.
For CMD create a text file start-map.bat with the following contents:
Code:
lua.exe .\wgc-launch.lua ^
--gameroot "D:\\War3-v127\\" ^
--gameexe "D:/War3-v127/war3.exe" ^
--map "D:\\War3-v127\\Maps\\(2)HillsOfGlory.w3m" ^
--slot slot0,team0,raceRandom,color0,health100,ai1 ^
--slot slot1,team1,raceHuman,color1,health70,ai0 ^
--slot slot2,team0,raceRandom,color2,health100,observer ^
--gameargs "-windowed -launch" ^
--gamespeed 64
Then you can play-test your map by double-clicking the .bat file.

Example output:​

Code:
Creating directory:
mkdir: cannot create directory ‘D:/War3-v127/map-wgc-test’: File exists
Writing .wgc file: 'D:\War3-v127/map-wgc-test/(2)HillsOfGlory-playtest.wgc'
Copying map from -> to:
D:/War3-v127/Maps/(2)HillsOfGlory.w3m
D:/War3-v127/map-wgc-test/(2)HillsOfGlory.w3m
testing map path: 'D:/War3-v127/Maps/(2)HillsOfGlory.w3m'
temp map copy: 'map-wgc-test/(2)HillsOfGlory.w3m'
wgc path: 'map-wgc-test/(2)HillsOfGlory-playtest.wgc'
game speed: 64x
game flags: 0 (decimal)
launching: 'cd "D:/War3-v127" &&  "D:/War3-v127/war3.exe"  -loadfile "map-wgc-test/(2)HillsOfGlory-playtest.wgc" -windowed'

Installation:​

  • Lua 5.3 or higher must be installed. It is included for Windows users.
  • This tool must be able to write to folder <game root folder>/map-wgc-test/ and create new files in there.
    You can run as administrator or create this folder yourself with appropriate permissions. Alternatively you can symlink this folder to somewhere else. This is a WC3 limitation.
Contents

WGC Utility (Test maps at high game speed) (Binary)

Level 2
Joined
Feb 22, 2024
Messages
2
Thank you very much for the tool! I am trying to create an AI of a custom race and this will be very useful, unfortunately I have not been able to run custom scripts (I tried a simple human script).

Do you have any idea what it could be? I made prints in Lua and I see that the path is working correctly :/

When I run the .ia script directly on the map it works fine, but as it is it works fine, I can test my scripts much faster, thank you very much!
 
Level 20
Joined
Jan 3, 2022
Messages
347
@Cassers do I understand correctly the Lua AI is loaded because the print works?
I don't remember testing the AI much. I don't know if the errors in code will appear in the game's log file too (it's somewhere in Documents/Warcraft 3 folder) because you must make sure it's not erroring. Assert or pcall then print when it catches an error.

Whether or not the game loads the AI code at all: I had used Process Monitor to see if the game was loading the correct path from disk. That's because even with Reforged it only accepted local paths (current working dir of the war3 process) because they didn't update this part of the code.
 
Level 2
Joined
Feb 22, 2024
Messages
2
@Cassers do I understand correctly the Lua AI is loaded because the print works?
I don't remember testing the AI much. I don't know if the errors in code will appear in the game's log file too (it's somewhere in Documents/Warcraft 3 folder) because you must make sure it's not erroring. Assert or pcall then print when it catches an error.

Whether or not the game loads the AI code at all: I had used Process Monitor to see if the game was loading the correct path from disk. That's because even with Reforged it only accepted local paths (current working dir of the war3 process) because they didn't update this part of the code.

:O Thank you very much for your quick response, I had not tried putting the tool inside the game folder, but when I tried it it didn't work either.

I leave a link with the files that I am using to test the bat and the AI, I also leave a map that I used to verify that the script was working well.

As such, the game opens and can be observed correctly, and if I open a custom map I can test the custom AIs that I have initialized with triggers, but I cannot run a script that I pass as a parameter (this would save a lot of time when testing changes in the .ia scripts).

The files are for version 1.27.1.7085, in reforged it doesn't work, right?


PD: I am not familiar with the Warcraft III error logs, I checked the C:\Users\S9Ser\OneDrive\Documents\Warcraft III\Errors folder and it is empty.

1708642714201.png
 
Last edited:
Level 2
Joined
Jul 12, 2015
Messages
5
Hello, thank you for developing this useful mod. Unfortunately it's not working on 1.31 for me even on blizzard maps . It just shows the main menu background with no menu and it gets stuck there . On some maps it shows "Game Over" immediately as soon as you enter the game for some reason . If you could check this out I would appreciate it , it's very useful to speed up the environment since I'm training AI bots using Warcraft 3 .
 
Level 2
Joined
Jul 12, 2015
Messages
5
@Luashine

Bash:
lua.exe .\wgc-launch.lua ^
--gameroot "C://Warcraft 3\Warcraft III 1.31.1//x86_64" ^
--gameexe "C://Warcraft 3//Warcraft III 1.31.1//x86_64/Warcraft III.exe" ^
--map "C:\\Users\\Jamil\\Documents\\Warcraft III\\Maps\\Test Map\\tast.w3m" ^
--gameargs "-windowed -launch" ^
--gamespeed 10

I also tried using the slots thingy . No idea why this version in particular doesn't work .
 
Level 2
Joined
Jul 12, 2015
Messages
5
@Luashine Not really working even with the slots I have tried missing around with the slots. Actually on older versions it worked without using the slots arguments for some reason. Not sure what's with version 1.31.1 . The problem is the I/O library that's written by someone else works only on this version along with an another script that I wrote . Any ideas?

Bash:
lua.exe .\wgc-launch.lua ^
--gameroot "C://Warcraft 3//Warcraft III 1.31.1//x86_64" ^
--gameexe "C://Warcraft 3//Warcraft III 1.31.1//x86_64/Warcraft III.exe" ^
--map "C://Users//Jamil//Downloads//(2)BootyBay.w3m" ^
--slot slot0,team0,raceRandom,color0,health100,human1 ^
--slot slot1,team1,raceHuman,color1,health100,observer  ^
--gameargs "-windowed -launch" ^
--gamespeed 10
 
Level 20
Joined
Jan 3, 2022
Messages
347
human and observer don't take a number argument. Both human and observer ARE YOU. Only use them once. Human if you want to play, Observer if you want to watch.

replace human1 -> human
replace observer -> ai1
and try again.

This is a very low level utility, WGC wasn't updated for Reforged. It doesn't surprise me the game might have behaved differently.

PS: I had made a mistake. I should've made this tool as a JSON<->WGC converter then you'd just need to update a lobby definition in a text editor.
 
Level 2
Joined
Jul 12, 2015
Messages
5
I don't think the issue is with your script . I tried doing AI tests using the GUI and it shows the same result! I even upgraded to the reforge client but no luck. Do you happen to have a link for a working client? I think this is client related .
 
Level 20
Joined
Jan 3, 2022
Messages
347
@jameeldark2012 found it. The tool will need an udpate after someone (me? not me?) finds the patch that changed the behavior. It has to launch the game version with the path it understands. The workaround works for the 1.31.1 version from Hive.

I recreated the problem and found a fix.

Full .bat file used to create the WGC using my tool. BUT! It will launch 1.31.1 (and some other versions incorrectly) because it gives a RELATIVE PATH to -loadfile:

  • Pre-Reforged & Reforged: EXPECT FULL PATH IN -LOADFILE
  • Classic: EXPECT RELATIVE PATH IN -LOADFILE

Workaround:
1. Use my tool once to create the WGC and copy the map file
2. Close the game using ALT+F4 (only shows main menu background)
3. Copy the output of the tool where it shows you the full command line
4. Change the path in -loadfile "..." to be an absolute path.

How I found it: By inspecting the game log and trying a couple times under ProcessMonitor to see which paths the game looks for. Confusingly in this case it did find the .wgc file and read it fully without complaining about anything else. By trial-and-error I noticed the relative path inside -loadfile and changed it to the full path.

Code:
echo Starting the WGC with bootybay in C: drive...
 
lua.exe .\wgc-launch.lua ^
--gameroot "D:\wc3-1.31.1-hive\Warcraft III" ^
--gameexe "D:\wc3-1.31.1-hive\Warcraft III\x86_64\Warcraft III.exe" ^
--map "C:\(2)bootybay.w3m" ^
--slot slot0,team0,raceRandom,color0,health100,ai1 ^
--slot slot1,team1,raceHuman,color1,health70,ai0 ^
--slot slot2,team0,raceRandom,color2,health100,observer ^
--gameargs "-windowed -launch" ^
--gamespeed 4
 
echo Game exited.
PAUSE



FAIL:
Code:
cd /d "D:\wc3-1.31.1-hive\Warcraft III" &&  "D:\wc3-1.31.1-hive\Warcraft III\x86_64\Warcraft III.exe"  -loadfile "map-wgc-test/(2)bootybay-playtest.w3m" -windowed -launch

Code:
C:\Users\MYUSER\Documents\Warcraft III\Logs\War3Log.txt
9/8 22:49:28.089  GameMain Started
9/8 22:49:28.089  Command Line: "D:\wc3-1.31.1-hive\Warcraft III\x86_64\Warcraft III.exe"   -loadfile "map-wgc-test/(2)bootybay-playtest.wgc" -windowed -launch
9/8 22:49:28.089  Current Directory: "D:\wc3-1.31.1-hive\Warcraft III\x86_64"

SUCCESS:
Code:
D:\wc3-1.31.1-hive\Warcraft III>cd /d "D:\wc3-1.31.1-hive\Warcraft III" &&  "D:\wc3-1.31.1-hive\Warcraft III\x86_64\Warcraft III.exe"  -loadfile "D:\wc3-1.31.1-hive\Warcraft III\map-wgc-test\(2)bootybay-playtest.wgc" -windowed -launch

Code:
C:\Users\MYUSER\Documents\Warcraft III\Logs\War3Log.txt
9/8 22:53:35.622  GameMain Started
9/8 22:53:35.622  Command Line: "D:\wc3-1.31.1-hive\Warcraft III\x86_64\Warcraft III.exe"   -loadfile "D:\wc3-1.31.1-hive\Warcraft III\map-wgc-test\(2)bootybay-playtest.wgc" -windowed -launch
9/8 22:53:35.622  Current Directory: "D:\wc3-1.31.1-hive\Warcraft III\x86_64"

tree /f:
Code:
Warcraft III/
+---map-wgc-test
|       (2)bootybay-playtest.wgc
|       (2)bootybay.w3m
 
Last edited:
Top