Jun 09 2010

Impossible Bugs

So, I’m still hard at work on Puzzle Runners. Remember when I said that I had written the single player version in a way that lent itself easily to being converted over to multiplayer?

Yeah, I’m not as smart as I thought. :( It took 17.5 hours spread over many days to get the setup and sync working.* Or at least working well enough that I could move onto the ingame message handling, I still need to go back to the setup code and handle some loose ends.

So… the whole game is setup using a “bounce” server which just bounces all the messages it receives to all the connected clients. The first client to connect becomes the ‘Master’ which is responsible for setting up the game and owns the AIs. And now I’ve got an error state where if only the Master is connected, the AIs behave correctly, but if there are two or more clients the AIs just stand in place.

This is my code which dispatches messages to the server:

Here’s the crazy part… that “trace” statement marked with the red arrow? All it does is print the message being sent to the server to the debugging console (or copies it to a log file). I added it because I wanted to make sure the AI messages were being sent (they were). If the trace statement is present, the AIs move correctly. If the trace statement is commented out**, the AIs don’t move. Human players however, move correctly regardless of the presence of the trace, so I know the dispatch function is working.

Ultimately of course, the lack of a trace can not be the reason why the AIs are turning themselves off… I’m guessing the trace is affecting the timing in which the messages are being received and that’s causing something I didn’t intend (I designed the message handler to work regardless of the order in which messages are received, and independently of the refresh timer… but I’ve made bigger mistakes before! :)).

Anybody reading this got a good story of a bug where the symptom and the root cause didn’t appear connected?

-TF

* – That’s not a complaint… I haven’t worked with multiplayer games before, so I’m turning up issues I’ve never considered before. (ie: How should the game react when a client disconnects before setup is complete? What should happen if a player attempts to join a table that’s already full? etc) So to the extent that I am a programmer, this is interesting stuff… it just taking longer than I had budgeted.

**- For the non-programmers, commenting out a statement makes the computer ignore it when it’s executing the program. The words following // are comments.

May 30 2010

PlayerIO launches database solution

Last Thursday, PlayerIO added a persistent data solution to the PlayerIO white-label multiplayer services.

With BigDB you’re getting a complete database that is especially built for the usage scenarios of games, and that will handle any load you can throw at it. You don’t have to buy, host, or manage your own database server, since BigDB is part of the Player.IO cloud services.

This is a really big thing.*

Puzzle Runners, my in-progress project, is built using PIO as it’s back-end but didn’t need persistent data. (At some point I need to write a ‘How to use PlayerIO services in a game developed with FlashDevelop and the FlexSDK’ tutorial because all the examples assume working under the FlashIDE… expect that sometime after I release Puzzle Runners) My experience with their API has been almost wholly positive, and the all their services are still free while they’re in Beta. If you’ve been contemplating a multiplayer flash game, but discarded PIO because you would have had to run a separate DB server, you should probably take another look.

*- Within the context of flash game development.