You might have noticed big gaps in development if you looked at the older posts. In fact, this project has been going since 2003. At least that’s the earliest entry I have in my development journal. Work was pretty solid in my spare time until perhaps around 2007, when development took a break.
At this time I was working on online match making and connection. I had written a master server to advertise online games. This was more or less working, but I had trouble getting NAT punch through working. NAT stands for Network Address Translation, and it allows a local network to appear on the internet (the network of networks) with one IP address. This is great for security and reducing address use, but it makes connecting to a game server difficult.
RakNet is the networking library that I use to pass messages between instances of the game. This has a technology that allows the NAT to be circumvented, or ‘punched’. I tried to get this working, even with the help of RakNet’s author, but to no avail. I couldn’t get the game client to connect to the game server over the internet and it was very discouraging. I was turned off development for a long time until a slow period in my new career and I decided the game was worth resurrecting. The game’s concept is great and, as far as I know, still unique. It’s a good thing I’ve stuck with it, because it looks as though the problem has been resolved, at least for the majority of cases.
The solution I’ve just implemented uses Universal Plug and Play, or UPNP. This protocol allows devices behind the router (which runs the NAT software) to request a port to be opened to outside devices. Before this protocol and sans RakNet’s technology there was a lot of messing around with port opening to allow servers to be run at home. Now the game can request one be opened temporarily without intervention by the user.
I’ve updated to the latest version of RakNet, which has now been made open source by Oculus, the developers of the Rift virtual reality system. RakNet provides a free server to run its NAT punchthrough technology, and I have tried to connect to this, but it is so far failing. I continued anyway, and implemented the UPNP port opening and match making. The match making master server is also run by RakNet, but will eventually be supplanted by Steam’s system. With fingers crossed I tested it out. Yesterday Nick and I were able to connect to each others server over the internet! We’ve got online connection working!
A smaller but also very exciting feature has also been added which allows clients to join a game in progress. This was a big feature in the real time strategy game Stormrise that I worked on with The Creative Assembly (which later became Sega Studios Australia). When a client wants to join the game it first loads all of the assets, and then the host sends the current state of the game, using the same system created to store keyframes in the replay. The host immediately starts sending all game messages to the joining client so that it doesn’t diverge in state and cause an immediate desync. I’ve yet to test this in adverse conditions but it’s working perfectly on a local network.
This feature will allow for players to join a game after it has started to assist either team. New players don’t bring any additional resources with them, so it simply means there are more ‘hands on deck’ to control weapons and build and repair structures. Resilience of the game is improved too. If a network connection is interrupted or the program or PC crashes then the player can restart and join the game again. Finally, it means observers can join in to watch the game in progress – something useful for popular tournaments.
Now for something visual! One of the mechanics of the game is about controlling ground. When you build a new foundation it expands your area of control, and therefore the space you can potentially build new ground devices. These currently include the mine which gathers metal ore, the swarming missile and its upgrade. The area you can actually build on has been rather opaque until now, depending on discovery using the colour of the preview device. I’ve now started drawing a pulsing glow on the ground where the player is able to build (screenshot below).