Solving problems with software. It’s what most programmers do all day long. But what happens when you come up against problems that never have been solved before? What if those problems were just leftovers from the last project? Or, what if those problems were already solved elsewhere, but in an entirely unrelated field?
For developers, reinventing the wheel is a risky venture: It takes time and effort to build any piece of software, but writing from scratch can provide some unique optimization and feature opportunities. It can also provide you with a chance to bring powerful tools to bear on an old problem. The residents of Caprica (on the hit TV show “Battlestar Galactica,” for example), had to find numerous ways to make their spaceships function under incredible stress and with very little resources.
Such was also the case of the massively multiplayer game of the same name. MMOs like World of Warcraft and Eve Online are enormous undertakings, requiring years of planning and development before launch, and even more human-years of patience and care once running. They’re similar to business services in that MMO servers must remain online all day, every day. Players tend to have day jobs too, so that means squeezing in game sessions during the wee hours and on weekends.
With that demanding a play schedule, and the need for multiple servers to be running simultaneously (each with around a thousand users signed on at all times), MMOs are big-business, highly available, almost real-time software. And that’s why the server-side of Battlestar Galactica Online is written in Erlang.
The logistics of Battlestar
Bigpoint Games is the publisher and developer of Battlestar Galactica Online, a free-to-play game where players pilot their star fighters through dogfights as either humans or their deadly cybernetic enemies, the Cylons.
Scott Guest is the studio technical director at Bigpoint, and he said the Battlestar MMO is “an Erlang product on the back end, in the server infrastructure. On the front end, it’s based on the Unity rendering client. It’s a thick back-end/thin-client design. Almost all of the work is done on the back end. It’s more of an input relay system on the back end and a visual presentation engine on the front end. The front end has less of the business logic of the game.”
So, why use Erlang, a language that’s almost entirely unused in the entertainment software development industry? “We had to make a product that has maximum uptime and scales really well,” said Guest. “We have a large flow of players into this game, and it never seems to stop. We chose Erlang because of what it was built for in the telecom space. The language was designed to solve the problem of uptime. There are paradigms in the language to recover from failure, and you have this observer pattern where you have processes that observe other processes, and if one goes down, it can be restarted. The word they like to use is ‘concurrent.’ ”
With thousands of Cylon raiders waiting to pounce on invading Caprica fighters, it would ruin the excitement of the game if one of those bad guys just sat there, motionless, his process hung in an endless loop on the back end. And that’s exactly what using Erlang and the observer model helps to prevent, said Guest. “Each entity in the game is its own group of processes, acting individually, but they communicate with each other through messaging. That’s one of the smart things about Erlang and this design. This is what Erlang allows us to do.”