This is pretty obscure, but I put a lot of work into it and want for the concept and my effort to be known/recalled for others to use or expand on.
For years I was irritated, as was the whole CoD2 community, with iwd mismatch errors and script errors that caused a player to need to remove an iwd file from their main folder in order to play the game. I thought about it for a long time, and finally came up with a solution.
The solution also preserved the intent of the operation of the original map.
The reason why an iwd sum mismatch occurs is that as it loads a map, it looks for each file in an iwd and tests to be sure that it is the same as the file in the main folder on the server. If there is another file with the same name in the same expected location, that does not match the checksum, then it throws that error.
Everything a computer works with is a number, whether program, image, or audio file, that file is filled with numbers. To verify that the file contains the proper sequence of numbers (that is, nobody has hacked it/cheated), a "checksum" is calculated by adding up all the numbers in a file and then making sure that the file on the client computer matches the one on the server. If the checksums don't match, then you have a mismatch.
Programming code in cod2 is located in ".gsc" files. These files may or may not have unique names. If a file is created by one mapmaker that uses the same name as another mapmaker, but does something differently, that can lead to a mismatch. These .gsc files can make cannons fire, barrels explode, autoclimb ladders, make it rain, play music, light lanterns, etc.
For example, barrels.gsc is a script that creates exploding barrels. Below is a list of those gsc files on our server (we have 1400+ maps, so the more maps, the more possibility of crashes due to mismatches).
The first column shows the md5sum (checksum) of the file, located on the right. I have the files uncompressed in a folder that holds the map code, so when these are loaded on the server, the map name part of the path on the right is not there, so everything is using
"maps/mp/barrels.gsc" for the file in their map.
But if you look at the left column, you can see that some have the same checksum, others don't (note that this is sorted by the first column, the checksum, so I could tell which are identical):
11d0f4cd6eeff51eb3ab4ba92e83da6b ./mp_bastogne_nite/maps/mp/barrels.gsc
11d0f4cd6eeff51eb3ab4ba92e83da6b ./mp_deltaforcedocks/maps/mp/barrels.gsc
11d0f4cd6eeff51eb3ab4ba92e83da6b ./mp_greatescape/maps/mp/barrels.gsc
11d0f4cd6eeff51eb3ab4ba92e83da6b ./mp_snowypark/maps/mp/barrels.gsc
2191150f28e9ff62288fea551f8e601b ./mp_bretagne/maps/mp/barrels.gsc
2191150f28e9ff62288fea551f8e601b ./mp_hanover/maps/mp/barrels.gsc
23f12123ff85d4925147829c75deab18 ./mp_codcastle2/maps/mp/barrels.gsc
32ef9225038ab9b37cd4d1049022a59c ./fr_desert_village_fb/maps/mp/barrels.gsc
32ef9225038ab9b37cd4d1049022a59c ./mp_tfl_winterplace/maps/mp/barrels.gsc
4687f37a709d7d584669e2447635ed44 ./mp_eph_matmata_v2/maps/mp/barrels.gsc
4687f37a709d7d584669e2447635ed44 ./mp_zinnowitz_v2/maps/mp/barrels.gsc
481936b23010fde018eea0508749122a ./mp_jojo/maps/mp/barrels.gsc
5378fc4fc1fd0fefbeaf3655174556a9 ./mp_shak_winter/maps/mp/barrels.gsc
708887aae1d022d9ff3ee6dd859d6599 ./rnr_neuville/maps/mp/barrels.gsc
7b16ce38408af8772d6172d08a54d4b3 ./mp_atlantic/maps/mp/barrels.gsc
7ed33bc9dd5fa5d1bada3724f339fc81 ./mp_bartatown/maps/mp/barrels.gsc
7ed33bc9dd5fa5d1bada3724f339fc81 ./mp_izmir/maps/mp/barrels.gsc
7ed33bc9dd5fa5d1bada3724f339fc81 ./mp_osman/maps/mp/barrels.gsc
83c96eb88bbc6f94a381f43333a28a44 ./mp_db_crash/maps/mp/barrels.gsc
83c96eb88bbc6f94a381f43333a28a44 ./mp_valence_v2/maps/mp/barrels.gsc
845b10bcabb2efe9c425863af83e7f11 ./mp_craville/maps/mp/barrels.gsc
845b10bcabb2efe9c425863af83e7f11 ./mp_war_final/maps/mp/barrels.gsc
845b10bcabb2efe9c425863af83e7f11 ./mp_wspawn/maps/mp/barrels.gsc
85b370cbca087971d5c9cc5644412e2f ./mp_gob_arena/maps/mp/barrels.gsc
87ecfed0cc8718b9d093bd0e812aa8e1 ./esr_abtf_v2/maps/mp/barrels.gsc
93374857171c64e0afe663b1b9d8df68 ./mp_prague/maps/mp/barrels.gsc
9acc5bba87d612325f29c8f86528ce8a ./devils_maze/maps/mp/barrels.gsc
a1acc9a8bf8065618f7ffc6a19fc75ba ./mp_afrika_korps/maps/mp/barrels.gsc
a1acc9a8bf8065618f7ffc6a19fc75ba ./mp_berlin_alleyways/maps/mp/barrels.gsc
a1acc9a8bf8065618f7ffc6a19fc75ba ./mp_tower_town/maps/mp/barrels.gsc
a6be83ecc8895b5b800cc3ff45b20ff0 ./mp_hatzfeld/maps/mp/barrels.gsc
b935320bdc88546aa8c86cea957cfaa3 ./mp_dust2/maps/mp/barrels.gsc
b992b879738ced9c8aef50a5ffbd030a ./mp_canal_final/maps/mp/barrels.gsc
c3f254beaac007a19cb21456b03de23f ./mp_vik1/maps/mp/barrels.gsc
e9b7e6d8dc34fab45594ace597829646 ./bfe_deux_villes/maps/mp/barrels.gsc
e9b7e6d8dc34fab45594ace597829646 ./mp_helsinki11/maps/mp/barrels.gsc
e9b7e6d8dc34fab45594ace597829646 ./mp_lessay/maps/mp/barrels.gsc
e9b7e6d8dc34fab45594ace597829646 ./mp_tournieres/maps/mp/barrels.gsc
e9b7e6d8dc34fab45594ace597829646 ./point_du_hoc/maps/mp/barrels.gsc
Early on in my investigations, I figured out the barrels.gsc problem, so I wrote a script to comment out the barrels scripts, disabling the exploding barrels, which eliminated a lot of errors, but it nagged me.
This past spring it came to me, how to solve this.
There is a load order, where files are loaded before others. One such location is the maps/mp folder within the fs_game mod folder. Gsc files can be created in that folder and will be accessed before the original files in the iwd files, which are also located in the maps/mp folder, essentially replacing the file in the map.
There are gsc files for most maps—but not all—named like this:
"mp_bandit.gsc"
"mp_german_base.gsc"
So creating a new mp_bandit.gsc in the fs_game mod folder (our mod folder directory for gsc files is o3a/map/mp on the server) .
So I thought about it and figured out that if I found the conflicting gsc files, renamed them and put them into the maps/mp file and also renamed the references to them in the programs that called them, I would avoid the errors that we had seen.
So working in linux, I unzipped all our custom maps and searched for all those named with a ".gsc" suffix, using (obscure linux stuff, but helpful for those who know)
find . -iname "*.gsc" -exec md5sum {} \; >~/gsc.txt
which put the list of gsc files into the root of my account in the gsc.txt file.
This gsc.txt file contains 3281 lines that look like those above. The first block of gibberish is the checksum, which is represented in a hexadecimal number (base 16).
I then wrote a python program "gsc_recursive.py" to figure out which of these files had the same name but a different checksum, output to ~/calls_sorted.txt.
Then I wrote a program that read the output of the above program and created new files, renaming those that were different and also modified the mapname.gsc files so that the calls in the script were changed to the new named files.
The mapname gsc for mp_jojo.gsc now looks like this:
*********************************************************
main()
{
maps\mp\_load::main();
maps\mp\barrelsx481936::barrelInit();
maps\mp\jojo_drown::main();
ambientPlay("ambient_mp_jojo");
game["allies"] = "british";
game["axis"] = "german";
game["attackers"] = "allies";
game["defenders"] = "axis";
game["british_soldiertype"] = "africa";
game["german_soldiertype"] = "africa";
setcvar("r_glowbloomintensity0",".25");
setcvar("r_glowbloomintensity1",".25");
setcvar("r_glowskybleedintensity0",".5");
}
*********************************************************************
The key line here is "maps\mp\barrelsx481936::barrelInit();" the 481936 is an excerpt of the md5 checksum so that the barrels file, used by jojo was renamed without a chance of using the same name as another barrels file.
Note that there are other reasons for the mapname.gsc files to exist in the override folder maps/mp/. Spawnpoints can be deleted, killzones can be installed, etc. So the program I wrote does not fold the changes into those files that may already exist in the maps/mp folder, they need to be merged by hand, or if someone wanted to, it could be done by programming, but I didn't go down that path.
If you want to look at the code, I have placed these files here:
https://ohmyctf.com/downloads/mismatchprograms.zip
iwd mismatch solution and script errors, mostly
Moderators: Borch, 4-Star Admin - |OHMY|, Executive Admin - !OHMY!
iwd mismatch solution and script errors, mostly
It is better to be silent and be thought a fool, than to speak and remove all doubt.
Is life worth living? That depends on the liver.
Is life worth living? That depends on the liver.
