CL_parseGamestate: bad command byte

So this is a long-running problem with Q3A. Very large maps, like Team Arena’s MPTerra2, will sometimes cause the client to error with this message under the following conditions:

  1. sv_pure is “1”.
  2. There are a lot of pk3’s in the baseq3 and/or mod folder.
  3. There are a lot of clients on the server.

I’ve found that setting sv_pure “0” often gets around it on a local game. Apparently sv_referencedPakNames gets appended to the message parsed by cl.gameState.stringData and overflows the buffer if there are too many other info keys.

To reduce the possibility of this problem, I had two ideas. One is to split the sv_pure-related info keys into a separate string from the gamestate string data. The other was to nest pk3’s inside a larger pk3 so that a map pack can avoid having a gazillion different .pk3’s sitting in root but without having to manually extract and re-zip all the maps and accompanying files into a single .pk3.

I realize both of these methods have drawbacks, so I was wondering if anyone might have any thoughts about the best way to handle this.