I am pleased to say that the networked multiplayer version of the game is going quite smoothly. I’ve been testing using System Link between my Xbox and my PC. One of the things that you must do to get a more accurate picture of how the game will play over the Internet is to use simulated packet loss and latency. I’ve done some testing up to 100ms latency and up to 10% packet loss. So far, it looks good.
I did run into some issues with the scrolling of the game board. My original plan was to send the scroll rate of the board with every network update (which happens 10 times a second). That didn’t work out so well for the scrolling of the board. The reason is because if a player lets off the trigger during this time were no packets are sent, the two simulations of the game get a little out of sync (the remote simulation has not received the “stop” command and keeps scrolling the board until the next network update). To fix this, I placed a another piece of data in the network update: the position of the height of the board. This too had problems though. The main problem here is that the board would then jerk back into position when it received the network update. This would look pretty stupid and was not what I wanted.
So I came up with a different solution. In my solution, I send the scroll rate with the network update. When the user starts scrolling, it receives this and pushes the board upwards. But if the player stops scrolling, a reliable packet is sent as a “stop” command. It also synchronizes the heights of the boards across the two machines to ensure accuracy. I’ve found that it works well at 100ms latencies and 10% packet loss scenarios.
I also was able to start testing the game over Xbox LIVE with a friend. We are a few cities apart but got good (probably typical) average response times of about 30ms. The game works beautifully over this kind of speed. The only thing that did not work was game invites because I forgot to hook up the InviteAccepted event handler! So, we will be testing invites shortly. One of the coolest things about Xbox LIVE is the ability to go and invite a friend who is not playing your game. They can see the invite and then join the game which will then reboot the console and start the game to join right in (by going to the lobby screen). If the other player doesn’t have the game, they will be prompted to download and buy it (which is a cool marketing feature).
I still have several tasks to get the networking part of the game a little more polished:
- Spells don’t work yet over multiplayer; going to have to add that.
- Random letter generation needs to be fixed to be truly random over multiplayer.
- The game crashes if a player exits – there is no pause menu to do a true exit.
- The lobby screen has a bug that if you “ready-up” while the only player it starts the game. This shouldn’t happen.
- Gamer profile download didn’t work in my testing so something must be wrong.
This is still a lot of work, but it should be fun getting it ready for primetime. I would really like to restart my work on the single player experience considering that it is the majority of the game. That part really has to be rock-solid.