MAX_SPAWN_VARS error


(Gremlin) #1

Yes, I saw that many got this problem, but I did not see
the solution for it, anyone has a good way to get it work?

thanx


(chavo_one) #2

There are multiple MAX_SPAWN_VARS errors. You need to clarify which one you are getting.

G_ParseSpawnVars: MAX_SPAWN_VARS
G_AddSpawnVarToken: MAX_SPAWN_VARS
CG_AddSpawnVarToken: MAX_SPAWN_VARS
CG_ParseSpawnVars: MAX_SPAWN_VARS


(Gremlin) #3

Oh, I did not know that :slight_smile:

I get:

G_AddSpawnVarToken: MAX_SPAWN_VARS

what does it mean?


(chavo_one) #4

OK, I’ve read the code from RtCW where this error is generated, and it is a weird one, so bear with me. Long explanation to follow.

This error is related to the runtime loading of entities.

In the section of code where this happens, the game is parsing the key/value pairs for each entity. Because the code doesn’t do any memory address checking before it writes, it has to keep a very strict counter of what memory has been written. Therefore, it keeps track of this very strange value “level.numSpawnVarChars”. This is the running sum of all the characters in the key/value pairs per entity.

For example, this excerpt from a bsp:

{ 
"classname" "info_player_start" 
"origin" "-544 -96 560" 
}

would cause the value of “level.numSpawnVarChars” for this info_player_start entity to be 44 (all of the chars between quotes).

This brings us to the MAX_SPAWN_VARS_CHARS value. In wolf, it is set to 2048. So if you look at the code, the running number of characters in the key/value pairs per entity can never exceed 2048. If it does, you get this error.

Redfella was getting this error, so he let me take a look at his bsp, and he indeed had one entity that had a total number of characters greater than 2048. Basically he had about 20 vertexremapshader keys in his worldspawn that caused him to exceed this limit.


(Daedalus) #5

Gah, stupid vertexremap shaders.
Thanks chavo, and sorry for necroing everyone :slight_smile:


(redfella) #6

chavo_one owns all.

:clap:


(rgoer) #7

Let me guess… easygen terrain? Any .map file that is created by easygen has a bunch of garbled vertexremapshader keys in the worldspawn entity… it’s much better to copy the terrain entity func_group from that .map and paste it into a new .map with a clean worldspawn.