Spilt Milk on: faking AI in SpatialOS

Spilt Milk Studios are currently working with Improbable to create Lazarus, a top-down multiplayer shooter set in a universe that can be developed, built up and then resets every week. In this episode of their developer diaries, Andrew Smith, founder of Spilt Milk, takes us through how the game’s AI is coming together, possibly of its own accord…

For the kind of games we like to make, AI is all about taking existing mechanics and creating a whole new dimension of gameplay by adding computer players to the mix. AI in games, despite the initialism, is not about having the most intelligent and optimal behaviour to play against, unless of course you’re making chess, where the goal is to beat the player every time.

Instead, we should make AI that appears to be intelligent, rather than actually being so.

It’s pretty easy to implement an AI that makes completely optimal decisions, has perfect aim, flawless tactical awareness and is effectively impossible to beat. It is, however, very difficult to create a realistic-feeling AI that is entertainingly flawed and makes mistakes in the same way a typical human player would.

In Lazarus, the AI exists to make the game more fun, provide new challenges, improve immersion and guide human players towards interesting and emergent gameplay.


Building AI into games on SpatialOS

In most games, the limiting factor when creating sophisticated and varied AI behaviours is the associated CPU cost. Things like environmental awareness, pathfinding, agent inter-communication and even the total number of agents are limited by the fact that all of these elements are very expensive to implement in a typical single-player game. After all, we need to spare some frames for graphics, audio and other equally important game engine things.

However, with a distributed and partitioned client/server architecture like the one we have with SpatialOS, we can have thousands of independent, intelligent and autonomous entities in a huge persistent universe without incurring the usual costs.


What does this actually mean for Lazarus though? When you boil it down, it means we don’t have to fake as many things as we used to. No longer do we employ smoke-and-mirror tricks (like only spawning enemies when players are around, and removing them when they are gone) to make the world feel populated and ‘real’. All enemies play by the same rules as the players, and they all have their own goals and needs. They can move around and behave independently of each other.

Games now have the ability to become a “simulation” of sorts, where whole factions and civilizations can rise and fall. Lucky entities can grow and rival players in power and influence, becoming notable characters and antagonists themselves. This all emerges from a living set of rules rather than being scripted that way. It is possible to end up with emergent behaviour akin to real life population dynamics, and many interesting gameplay opportunities can result from this, often ones that are surprising even to the original developers!

This also opens up huge opportunities to create co-operative gameplay on a truly epic scale.

In Lazarus we are building systems that will see hundreds and even thousands of human players, all banding together against a common AI enemy (or even multiple enemy factions) to create a force with equal size and power, vying for control of territory and resources, pushing and pulling in ways that can and will affect every single player’s experience in the game…and all of it in real time! This is something that has never been previously possible, or at least not at this scale and fidelity.


Build your own nemesis

There are a myriad of cool things that a persistent simulated world lets us do, but I’d like to focus on two so that we can better illustrate the excitement we feel about Lazarus, as well as the challenges and opportunities we’re facing.

The first is a galaxy-wide territorial conflict between players and enemy factions. Normally, the game wouldn’t run if there were no players active, or the complexity of the simulation would have to be neutered to make sure things didn’t get ‘out of hand’ with fewer players active. With Lazarus, we’re able to have AI “Generals” who direct the attacks and defences of their own faction against not only the player, but also each other.

We’ve built a living persistent world that is fascinating and hypnotic to watch, even without players jumping into battle and turning the tide one way or another.


This is something we’ve recently implemented into the game (you should be able to see it in the live build very soon) and are tremendously excited to see the reception it gets. It’s genuinely amazing, in a “oh lord, I hope we haven’t built SkyNet…” kind of way.

Lazarus is available to play now in its current form of continuous open development. To play, head to, sign up and receive your free Steam code.