• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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 19
Joined
Jan 3, 2022
Messages
320
@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:
Top