dhewm / dhewm3

dhewm 3 main repository
https://dhewm3.org/
GNU General Public License v3.0
1.78k stars 346 forks source link

'Exceeded global memory size' when running certain mods #204

Closed ghost closed 5 years ago

ghost commented 6 years ago

I have downloaded a bunch of mods that come with features I'm interested in, but I'm unable to run them as-is, since dhewm3 halts with the 'exceeded global memory size' error. They do not have their own gamecode library.

In the case of CED Assets Pack (https://www.moddb.com/downloads/ceds-assets-pack), the error is Error: file pak000.pk4/script/map_monorail.script, line 204: Exceeded global memory size (196608 bytes)

or in the case of Pet Mod NG (https://www.nexusmods.com/doom3/mods/1309) it's Error: file pak000.pk4/script/map_recycling1.script, line 851: Exceeded global memory size (196608 bytes)

In the case of the former, I can circumvent the error when I remove the ai_player.script (so the default one is used), but this obviously disables some of the mod's features. I'm trying to pin down what part of the script invokes the error but haven't been successful yet so far.

I tried to discuss this on the idtech4 forum a while ago, but the only advice I got there was that 'I modded too much, and I should try to mod less', and when I replied that I'm running the mod standalone without anything else added, they retorted that 'I had no idea what I was doing'.

It seems this error is dhewm3 specific in the sense that I can't find any information about it.

For the record, I'm running an x64 build on Linux, using Intel integrated Haswell graphics, if that matters.

DanielGibson commented 6 years ago

I can't download the pet mod, nexusmods.com wants me to login before I can download it.. does it use its own game.dll? The memory size limit for scripts is bigger in d3xp than in the base game - I could raise it in the base game as well.

You could try yourself if that helps: In neo/game/script/Script_Program.h line around 47 there is #define MAX_GLOBALS 196608 // in bytes change the value to 296608 (that's what d3xp uses), recompile dhewm3 and see if it helps.

revility commented 6 years ago

They are mainly right in that there is too much going on. This happens with vanilla d3 as far as I know.

There could be a conflict in the pak files.

When I was trying to set up the scripts to load for default doom3 levels in ruiner, I came across this. I kept commenting out the scripts listed in the doom main script. Eventually I was able to pin point which map scripts it was. for me it ended being we changed a bunch of enemy AI and more which those scripts didn't like. I did not look further into the situation as the maps weren't of good use for the mod.

Daniel's suggestion is seriously worth a try.

ghost commented 6 years ago

Sounds good, I'll try that. What's odd is that nobody else seems to have any issues running both mods.

ghost commented 6 years ago

So I pulled the latest source from git, modified the value to 296608, then compiled it. The CED Assets mod now appears to work at first, until I try to load a map, whereby it halts with the following error: dhewm3/neo/game/script/Script_Interpreter.cpp:991: bool idInterpreter::Execute(): Assertionst->c->value.argSize == func->parmTotal' failed.`

The pet mod appears to work, in the sense that it doesn't crash

DanielGibson commented 6 years ago

Hmm I think I got that error too when I increased that value in another mod. Did you make clean before building after the change? I think that fixed it for me..

ghost commented 6 years ago

I created a new 'build' dir next to 'neo', then did 'cmake ../neo', then make Just deleted my build dir and repeated these steps, the issue persists

DanielGibson commented 6 years ago

weird, I no further idea about that at the moment

DanielGibson commented 5 years ago

I increased that limit in git master (and it still builds both on my Linux and my Windows system)

ghost commented 5 years ago

Just wanted to add I found a fix for this in the meantime.

Apparently, when calling threads from scripts (such as in this case, the Main() thread was called in player::init(), you need to make sure the thread function has been declared before. Sounds obvious perhaps, but many mods neglect to do this since it doesn't crash on all configurations.

So, simply moving the Main() function before the init one in ai_player.script fixed the problem.

DanielGibson commented 4 years ago

I think I have a fix for the Assertion, see #303 (incl. Windows binaries) Currently it's only for the base game and the RoE addon, haven't ported it to Lost Mission or other mods yet (unfortunately the fix is in the game DLL, not in dhewm3.exe). But if you play the main game (or RoE) with that flashlight mod, the assertion should be fixed.