Agar.io and Orbs.it
A couple of years ago, agar.io was released as a browser game, and caused quite a sensation. It has subsequently spawned an entire genre of games — lightweight, massively multiplayer browser games with simple graphics and gameplay. This type of no-nonsense, easy-access multiplayer game appeals to many people, and naturally suits lone developers (especially when their art skills are not great).
So late last year, and early this year, I developed orbs.it
Orbs is a simple to play game, yet is very skillful. It’s about fast and accurate control of your “guns”. Eight players start the game, and each initially control a single orb which is part of a set of 24 orbs encircling a central “sun”. You shoot from your orbs, and when you hit another orb you take control of it. The winner is whoever is left last in the game. It’s a very satisfying mechanic, especially when you get in the flow and claim orb after orb in rapid succession.
Lots of users
In May I released orbs.it on iogames.space which is the main portal for “agario-style” games. I was pleasantly surprised with the amount of players that clearly seek out this type of game — within a couple of days, my server was starting up 5-10 game sessions per minute, each with typically 4 or 5 humans in (the rest being bots). As of right now, there are nearly 90,000 player accounts in the game’s database.
Orbs proved to be a nice test-bed for the nodejs-based gameserver cluster I had developed. The central masterserver looks after player logins and communicates with gameservers which run the actual game sessions. It monitors the number of games running on each server, and dynamically starts/stops server instances as required, to deal with varying loads. There’s also some interesting requirements around things like gameserver hot-patching, so again this has involved developing useful techniques which I’m sure I will use again. I have done this sort of thing before in Darkwind of course, but the system in Orbs is generally much slicker and didn’t suffer from the horrible nightmares of blocked sockets which afflicted Darkwind on its opening weekend on Steam.
High-speed networked gaming is always a challenge to develop, and a particular challenge for “agario-style” games is that they are generally limited to using websockets for their communications. Websockets provide really handy bidirectional communication between browser and webserver, so are far better than plain-old Ajax.. however, they are still based on TCP, and that means guaranteed, ordered delivery of packets. This is the main cause of sudden spikes in latency which most Websocket games suffer from. The latency is basically unavoidable – it happens when a packet fails to deliver and has to be re-delivered, and all subsequent packets are cached on the receiver until such time as the missing packet arrives, so that they can be delivered to the receiving application in the correct order. This makes TCP fundamentally unsuitable for fast-moving data, especially when the nature of the data is that late packets are irrelevant. If your application knows where a player’s orb is at time 20 in a game, it really doesn’t care to know where it was at time 19, yet TCP doesn’t allow your application to see the data from time 20 until the data from time 19 is received.
Deterministic positioning of orbs
I wanted orbs.it to be, as far as possible, immune to the latency problems caused by TCP. I didn’t want the field of orbs to jump around and glitch on the screen, like the player-controlled entities in most agario-style game do. The solution was to remove player-control of the orbs altogether – this also fitted the design requirement of simplicity. The orbs move around in orbits, based on elliptical paths with continually changing parameters (and ultimately controlled by Sin and Cos, of course). The real trick is that these paths, although interesting and varied (leading to a continually-shifting playfield) are entirely deterministic. At any specific time after the game has started, the game server and game clients can all calculate and precisely agree on where each orb is. This vastly simplifies things and gets rid of many of the difficulties associated with everything a game client knowing about everyone else being out of date by the time they know it.
If you’re interested to read more about fast-paced multiplayer networking, this is an excellent overview.
You can play orbs straight from your browser here: orbs.it and it’s also available on the Android and iOS app-stores, although has not seen much traction there.