Testing, Testing, Is this thing on?

We had a dry run of the code war today. It dropped about 2′ of snow last night so we were truly running like the final – everyone in a different location. It went smoother than I expected. Mostly it was issues where we needed to provide additional clarifications. And we had one link that went to the wrong page – but in doing so it looked right and got people going in the wrong direction. It’s really hard to write good documentation when you know a program well.

We also upped the time allowed for each A.I. turn to 6 seconds. Two of the developers were on home connections that were a little flakey and it sometimes took 3 – 4 seconds for the round trip of a turn (using the simplistic A.I. which is very very fast). We should have much better connections in the final as Universities are on very fast connections. But that incredible bandwidth gets heavily used weekend nights downloading movies.

The communication layer is rock solid (aside from one item – listed next). Not only did the messages cross fine, but when a connection was dropped the A.I. code re-connected immediately. In most cases it still got that turn in. In the remaining cases it was there for the next turn. (If an A.I. drops and all other A.I.s have replied, then the server process that turn.)

We did hit one bug. The communication layer is designed that it must hold all of the incoming bytes of a message until the entire message has been received. As the messages are UTF-8 XML strings this works a lot better – building the string as the message comes in requires handling a break in a multi-byte character and a lot of memory allocation as the StringBuilder is grown. One of the developers used an avatar that was several meg in size (and over the 32×32 pixel size). This was larger than the buffer size. So we grow the buffer if necessary (and it should never happen if players use correctly sized avatars).

This by the way took about 10 minutes to track down, because I first assumed there was a logic error somewhere passing the wrong length for the message, overwriting the buffer, etc. It took me back to when I was creating Enemy Nations and working through log files of the messages sent/received to see what was going on. Never a fun part of game programming.

And that was it. Everything went pretty smoothly and I’m now very confident that we’ll have a very smoothly running code war. (And we will do at least one more test run.)

Oh, and the developer who won the Broadside code war at Windward? All the developers spent 1½ hours writing an A.I. for the game as part of the dry run. His did terrible. Needless to say, we all had fun at his expense. (He figured out the mistake he made, but listing it would be giving a hint about the game…)