Simon Tasker

Games, apps, and the occasional detour.

Game Dev · · 5 min read

Edge of Space, Part Six: The Universe Gets a Calendar

Daily bounties, rush hour and weekend wars arrive in Edge of Space with almost no server code, along with an alien incursion that is really just one very big account.

Day thirty#

A persistent game has a rhythm problem and it shows up about a month in. Day one is magic, everything is new and every single building you finish matters. Day thirty is a routine. You log in, you empty the queues, you set the next thing going and you log out, and you do that for a week before you notice you have stopped enjoying it.

OGame solved this with other people, because there is no routine quite like discovering that somebody probed all four of your planets while you were asleep. I had bots doing a decent impression of that by this point, but I wanted the Universe itself to have moods as well. Days that feel different to other days, and a reason to log in that isn't the build queue.

So Edge of Space got a calendar. And then it got aliens.

Events without a server.#

This is my favourite technical trick in the whole project and it is barely any code at all. Almost every event in the game is worked out from the clock rather than scheduled anywhere. Nothing is stored in a database, nothing is announced by the server, it is all just calculated. Ask the game whether it is rush hour and the answer falls out of the current time. Ask where today's comet is and a hash of the date tells you which system it is sitting in.

It is the same trick as the deterministic weather from two posts ago, and it means the server and every client independently agree on the entire calendar with no network traffic and no stored state at all. There is nothing to sync, nothing to migrate and nothing to go stale. What that gets you is this lot:

  • Daily bounties, a rotating objective like sending a probe or winning a battle or hauling some freight, with a resource prize, and a relic on top of it every fortnight.
  • Rush hour, two hours every evening when construction, assembly and research all run half again as fast. Log in at the right time and the queue absolutely flies.
  • War games at the weekend, when battles leave bigger debris fields and alliance war scores count double. Saturdays got noticeably louder.
  • The comet, one system per galaxy per day where expeditions can't be lost and come back with rich caches. The galaxy header flags where it is and the brave go chasing it.
  • King of the Beacon, a weekly arena system where whoever destroys the most fleet value takes a relic. It is a scheduled bar fight and it works exactly as well as that sounds.

None of that changes a single rule of the game. All it changes is which day it is, and that turned out to be enough. The news ticker along the bottom leads with whatever is happening today, and the Universe finally has weather in the other sense of the word too.

The Bloom.#

Then there is the big one, the alien incursion. I wanted the kind of event where the entire Universe turns round and fights something together, the seasonal invasion that every game I love does at some point. My first instinct was that it would take months. New AI, new combat rules, special server logic for how aliens behave, a whole second game living inside the first one.

Then I realised I already had all of it. I had spent weeks building bots that obey exactly the same rules and prices as humans, so the aliens didn't need to be a new system. They needed to be an account.

The Bloom is one commander who owns every hive world. It gets seeded across the galaxies with monstrous prebuilt defences and a research tree far past anything a player could have yet, and it runs on the same brain as every other bot, just hungrier. It raids and colonises on every turn, spreading from system to system as fast as its birthing chambers can turn out colony ships.

Because it is only an account, everything else already worked. Newbie protection shields small players from its raids automatically, since it is an enormous empire and that is simply the existing rule doing its job. Anyone can attack it, spy on it or watch its worlds spread across the galaxy map. Kill one of its colonies and it collapses into an enormous debris field, because that is what colonies do when they die. Even the purge standings are just battle reports filtered by who was defending. The event needed almost no new rules, it needed a new inhabitant.

The art was where the actual work went. Every structure has an organic counterpart, so the shipyard becomes a birthing chamber and the research lab becomes a neural cluster, and an infested world is covered in creep that spreads out from them. Send a probe with good enough sensors and your spy report comes back with a full surface scan, which is your first proper look at a living hive world drawn building by building. Players don't read about the invasion happening somewhere off screen, they go and look at it.

An infested world in Edge of Space after dark, purple alien growths and creep spreading across the surface where the buildings used to be.
An infested world at night. The tutorial box in the middle is my own fault and I will take a cleaner shot.
The current Edge of Space systems map, with Events and AI now feeding into Combat and Trade alongside everything else.
The map as it stands now, six posts on from a notebook full of scribbles.

The lesson#

Two of them really. The first is to work things out rather than schedule them. Anything that can be calculated from the clock costs nothing to run and nothing to keep in sync, forever, and it will still be working long after I have forgotten how it does it.

The second one is bigger and it took me until now to see it properly. Build general systems and then feed them interesting things. The Bloom cost a fraction of what it should have done because bots that obey the rules already existed, and every good piece of content I have added to Edge of Space since has been the same shape. It was never a new mechanic, it was a new participant for the mechanics I already had.

The Universe has people in it, a pulse, and now a monster in it as well. Next time, something a bit different, the story of a bug that only ever happened in release builds, froze the game for exactly one player, and took a headless browser, a cloned account and one very long evening to catch.

You can play Edge of Space for yourself at eos.simontasker.co.uk.