I write code.
Posted by Herr_Alien on Nov 10th, 2008
When you release a mod/game, you lose some of the control you once had on it. You can't even make bug fixes without properly advertising the bug fix, especialy if the fix will break the compatibility with the older versions of your game.This is a tough lesson. And a bad way to start an article. But I hope the next (true) story will shed some light.It all started with AvP2's new master server. Sierra closed the official master server for AvP2, so we decided to make a server of our own, and thus to give the game longer legs. We ended up interfacing the game client and the game server to a nifty DLL. The game information structure passed between the DLL and the game client has the game has the game mode encoded as a number: 0 - Single Player, 1 - DM, 2 - Team DM and so on. Plain AvP2 has a total of 7 game modes, mapped from 0 to 6. All things good so far.The player however doesn't see these numbers. When searching for an internet games, it sees "DM", or "Team DM", or "Evac". You get the picture:
The way we did that is by using an array of strings. At position 1 we had "DM", at position 2 we had "Team DM" and so on. So when the data structure from the DLL we made would come in, having m_nGameType set to 1, we would display m_pGameDesc[m_nGameType], which would be "DM". Again, all good and well.But we don't make any checks to see if m_nGameType is between 0 and 6. That is bad. So far, the master server had in it's data base only plain AvP2 servers, with game types from the normal 7 game types. So the input will always be between 0 and 6, I told myself. No need to make a check here. Again, this is bad, and here's why:AvP2 Fortress has new game modes. CTF, One Flag CTF, Assault and War were translated to numbers from 7 to 10. Here's what happened Saturday: (1) I fire up the Fortress server, for beta testing purpses. (2) A guy opens AvP2 and searches for internet games. When receiving the game information, the game type would be higher than 6. This means addressing memory outside the array. In plain gamer language "ZOMG, the game crashed!".This is an expensive mistake to fix. It will require a new client shell. The download will be fairly small (under 1MB), but it will not be compatible with the previous versions of the mod. So, the proper way to do it is by advertising the patch in advance. Set up a delivery date ahead enough, so that most members of the community would be aware of it. Basically do everything you can to make the transition easier.Meanwhile, I have to restrict myself from starting Fortress servers. As I said before, now that the server is up, I can't start to make experiments like that. This is not a toy anymore, this is the tool people use to play online. And I have no right to hinder them in doing that.