• 🏆 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!

Testing custom map crashes the game to desktop + my solution

Status
Not open for further replies.
Level 1
Joined
Jan 2, 2023
Messages
15
As the title says I have had a problem of the custom map I was working to suddenly start crashing to the desktop when I tried to test it in the game itself. I recall something like this in the past when I gave up on developing a custom map I have spent so much time on because of an obscure bug which would load the map to ~70% and then crash to desktop.
Why do I post this here? I have searched the net for the solution of this problem and most of the fixes would imply you have a problem with your custom scripts (which was not true in my case). Instead of spending half a day reading forums, You could (probably) fix a similar issue in your map in less time.

Here are the approximate steps that helped me find the problem and resolve it (in my case it was an improper buff attached to a spell):

BACKUP, BACKUP, BACKUP !!! Enable map auto-save functionality in the world editor. Luckily I have had a bash script that would constantly calculate the map hashsum and save it to an another folder with timestamp attached. I think "git console" could be used for that.
Bash:
FOLDER="BACKUP_FOLDER"
FILENAME="YOURMAPFILE.w3x"

mkdir -p ${FOLDER}
for ((;;)); do
        hash=$(sha1sum ${FILENAME})
        sleep 10
        if [[ $(sha1sum ${FILENAME}) != ${hash} ]]; then
                timestamp=$(date "+%s")
                newname=$(ls ${FILENAME} | cut -d. -f2)
                cp -v ${FILENAME} ${FOLDER}/${timestamp}.${newname}
        fi
done

Since I have had quite a few of files there, and I have not tested the map for several days (my mistake, I know) I started to test them to find which one started to cause the crash. To speed up the process I didn't check load each map in sequential order, but used a binary search:
[LOOP] until 2 maps are found (one is the last working copy, the second is the first that started to crash the game)
[COND] get a map in the middle of the list
[TRUE] if it crashes go to the middle of the first part of the list
[FALSE] if it works go to the middle of the second part of the list

After finding the set of 2 individual versions of the map I have used the "MPQ Editor" program to extract the contents of both maps in different folders, let us call them "version_working" and "version_broken".
After that You have to use some form of "diff" utility to get the differences in the extracted map files. To be honest, it does not say much, but at the very least it would provide you with an overview of which spells were changed in the meantime.

If I recall correctly in my case it was a single custom ability created from the "Might" base that instead of an actual buff would (for some reason) use an effect which caused the game to crash. Changing this in the latest version of the map proved to fix the issue completely!
 
Status
Not open for further replies.
Top