Wednesday, March 19, 2008

Don't hold your breath

There haven't been any updates in a week (since the release of mine fields), and there probably won't be for close to another week. This is because I have decided to rip out a lot of the guts of the game engine.

When I started writing Fleet Combat Online, I didn't know if I would actually release it or not. It was just something to play with and see where it went. Since it was just an experiment, I didn't bother using a proper database for storage of game objects and the games themselves. All I did was put in a quick mechanism to serialize the game data to XML and save that XML to a file. It was super quick to code (a couple of minutes) and it worked.

But now that the game is up and working, that isn't a solution that is going to fly for very long. So I am porting the storage of the game data over to an SQL database instead of using XML. The "ships vanishing" bug and the "stuck game" bug are both due to the XML file storage issue. Storing things as XML files is slow and unreliable compared to a database and it is this that has caused some of these bugs. The "stuck game" bug mostly happens when two or more game clients call the server and ask it to process the turn at the same time. Since there is latency in reading/writing to the file system sometimes those different requests step on each others toes. With a database, the game record can be properly locked while the turn is being processed. Then when the turn is done, all the clients will be informed and get the latest game data.

Anyway, it is quite a bit of work (which is why I didn't write it like this in the first place) so it will be a while before it is ready. I haven't decided if I am going to go to the effort of making it compatible with the current game data. If I don't do that extra effort, then all current game data (games, ships, etc.) will be incompatible. So there will be a game wipe in that case. Player information is fine as that is already stored in the database. But game related data might go bye bye.

No comments: