Skip to main content

How RimWorld Generates Great Stories

Explaining the magic behind the scifi colony sim

This is The Mechanic, where Alex Wiltshire invites developers to discuss the inner workings of their games. This time, RimWorld [official site].

Every player will have stories of their RimWorld colonists. Dramas set amid cabin fever, raider attacks, depressing decor, infected limbs, cannibalism and bloodthirsty local fauna. Personal dramas, tales of threat and victory, of small things and large things, tragedy and comedy. This colony-building game is designed very specifically to generate such stories. But while it feels as if they arise from deep simulation, all watched over by an AI, they’re actually the result of something both more powerful and simple. RimWorld tells great stories because it uses:


Apophenia is a term that refers to the human tendency to detect patterns in randomness. It was first coined by Klaus Conrad in the late ‘50s, and has come to explain many psychological effects, such as how we see faces in things (pareidolia) and why we construct (hopeless) systems for gambling. And in RimWorld, as developer Tynan Sylvester tells me, “It’s essentially the notion that players extract more story meaning from a game event than is really represented in the mechanics.”

Many games do this, like Galactic Civilisations II, which inspired Friend of RPS Tom Francis’ classic diary, and The Sims. Sylvester first got interested in games’ ability to tell stories with little while reading StarCraft battle reports, in which (this was pre-YouTube, of course) matches would be recounted as stories alongside screenshots. “It elevated this mechanical interaction of a chessboard competition into this whole emotional story of marines desperately holding off a Protoss attack, like something from a Hollywood movie,” he says. Then came the classic, Dwarf Fortress, which generated hundreds of player stories, including Boatmurdered and Gemclod. Sylvester noted how the fantasy setting excused some mechanics that might not make sense if it had a more realistic setting.

Meet Henry. A total waste of space who refuses to do dumb labour. His inexplicable girlfriend, Nelly, has been attacked by a raider, but he's been literally just wandering around outside with his rifle instead of caring for her.

At the time, he was working as a designer at Irrational on BioShock Infinite, and began to see that many stories being generated by games were happening by accident rather than design. “It seemed nobody was pushing for it. Tonnes of people were talking about storytelling in games, but always from this ‘We want to do movies because we love Hollywood and want to do that with a videogame’. But there’s a whole other aspect of storytelling that’s unique to games, and it seemed no one was really pursuing it. So I was thinking it seemed a big design opportunity, a diamond sitting in the street that no one was picking up.” So, when Sylvester left Irrational in early 2012, he made several different story-generating game prototypes, settling on a 2D base-building game which steadily grew into RimWorld.

The game uses many simple techniques of getting the apophenia response. All its characters are named, and it restricts the numbers of colonists that you play with to around 12. RimWorld is similar to Dwarf Fortress in many ways, but because your band of dwarves is far larger, reaching about 200 members, this is a point where they significantly differ. “That’s by design, so the player knows each of these people and has a remembered history of each of them,” Sylvester says. It means that after you’ve been playing with a couple of colonists for 10 hours and seen them get married and how one saved the other in a firefight, their history together builds up in your mind, and induces meaning to their actions. “That’s where the story comes from. Instead of just one stranger insulting another, it becomes, ‘He was stressed out because he kicked his alcohol habit and he was bitter because his wife divorced him six months earlier, and he flew into a rage’. We repeat actions between people you know and sustain interactions, and sustain the states, remind people of what happened before through mechanisms like the characters having memories that affect their mood.”

Nelly has died of a serious infection in her torso as a result of her wounds. Henry, emotionally devastated, leaves it to the third member of the colony, Lord, to bury her body in a grave he dug to the north.

It’s not like apophenia lies everywhere, of course. For RimWorld it particularly lodges in a couple of fundamental human preoccupations: health and relationships. Sylvester has been careful to build on them, adding a detailed health system early after its initial alpha release which tracks, like Dwarf Fortress, individual body parts and malaises. “It’s tragic if they have cataracts and they can’t do what they used to. It’s painful if someone loses a toe, it’s ugly if they have a scar on their face. It’s primal, it’s so close to what you care about in your life,” he says.

And relationships - well, pretty much any book, film or other story-based medium is predicated on relationships. So RimWorld presents a few different types of relationship, such as spouses, siblings and so on, and have opinions of others, based on events and traits plus a smattering of randomness. “We supply these labels, like say this is a person’s sister, and suddenly everything has this new meaning,” Sylvester says. The game augments the labels a little, so if a character’s sister dies, they get sadder than if a random character died, or if someone they really dislike dies they get slightly happier. “It’s pretty darn simple, just a matrix of numbers and labels, but they’re so close to what we spend all our time thinking and telling stories about. A tonne of neuro-circuitry is just about finding connections in human relationships, and if you can spark that in the game, then people’s brains just take over. There’s this giant computer sitting there, trying to find connections and causal relationships and emotional inferences. You just have to get that motor running and all you need are a few simple labels, no more complicated than a children’s book.”

Two new colonists have joined our miserable pair. Feeb is a hunter, and Agerra T’rel, well, she's escaped from a band of raiders who've been raiding us, too. She's also Lord's long-lost wife. And a game developer. And she has Alzheimer's. Oh, and she's a nudist. Anyway, her arrival brought a raider to attack us. Feeb valiantly killed him but was injured in the melee. As she hobbled to bed, Lord and Agerra had a chance to catch up with each other (as much as a couple can when one has no memory). Henry slept through the whole thing.

One relatively recent tweak that illustrates the way that tiny details can provide powerful apophenia is the addition of a reason for when a character has a mental break. In the game’s logic, characters have moods which are simply the sum of all the offsets of their memories at a particular time. So they might be unhappy about their pet dying and having to kill a prisoner and not having a table to eat at, and if their mood crosses a certain threshold, they’ll break down. The reason is semi-random, weighted by the intensity of their moods. “I’m considering adjusting it because sometimes it says someone went insane because they ate without a table, but maybe not, right?” says Sylvester. “But just two lines of code choosing a random thought creates a reason, a connection.”

When you play, the systems underlying the characters’ behaviour seem impossibly complex. But they’re individually very simple, because Sylvester actively avoided making systems that were hard to implement. The game, after all, was originally about building 2D spaceships, but he found developing AI that could negotiate airlocks tricky, so he moved the game to a planet. “I guess it’s a game design principle I stick to, which is if something’s really hard to do, just don’t do it. Just do something else. There are so many other things you can do, so just avoid the hard things and take the low-hanging fruit.” Apophenia, therefore, is the lowest-hanging fruit, because it isn’t even in the game.

You've got to have some sympathy for Henry. He's been mourning for Nelly since her death, his mood in a constant slough of despond. After four nights of disturbed sleep, seeing the corpse of a raider and being insulted by Lord, he finally loses it. He attacks any creature that comes by, killing a boar. Terrified Lord cowered in the corner of the colonists' shared room, only to witness Henry turning from the boar to attack Feeb.

But making a game that generates it isn’t without challenge. One big one is giving players the information they need for their minds to spin out stories. One aspect is the interface itself, which has to serve it all out. It’s grown as the game has, but though some players complain that they find it hard to initially learn, it cleanly divides details into various categories: health, needs and character traits. Nothing is hidden, because if players don’t know a detail, it doesn’t have story value. But the game does remove information when it’s no longer relevant. Thoughts fade after a while and health issues are cured, though things like scars will remain because they provide hooks for stories, like that time a character grappled with a maddened squirrel and won. Traits are restricted to three, backstory phrases to two, and they have different values for 10 skills. And that’s it.

There’s consequently a lot of space around characters for stories to form. RimWorld contrasts with a game like the excellent Ultima Ratio Regum, which generates large quantities of backstory and world detail. “I think minimalism works because you get the things with big impact and then you leave space for the player to fill in the other things, as opposed to filling in every detail, which doesn’t leave room for apophenia,” says Sylvester. “You have to leave something undefined for the player to create the story, and also it’s a tonne of work for people to do, that cognitive effort of absorbing all this information. People hate cognitive effort.”

So starts a grim cycle in which Henry is badly wounded during a psychotic break and is nursed back to health, only to lose control again, maddened by pain, discomfort and the ever present memory of his girlfriend's death. He wanders the wastes of the south, where the colony dumps rotting corpses, attacking a tortoise which chews his foot off. The colony can't take the pressure of caring for Henry; the next raider attack is its last.

And yet his choice to make RimWorld graphically detailed, mostly so it’d be more widely marketable, removes some opportunities for apophenia to develop, something that makes him envy the abstractness of Dwarf Fortress. If in Dwarf Fortress a husband should die next to his wife, a player can imagine various scenarios: a tender moment of her holding him in her arms or her impassively watching, because all you’re seeing is two ASCII characters next to each other. There’s no information about which way they’re looking or if they’re sitting or standing. In RimWorld, however, characters are shown looking in directions, lying, sitting and standing. If the wife is looking the other way, space to imagine her reaction to her husband’s death is narrowed. Further out from RimWorld is The Sims, where far more is shown and the player is limited to imagining motivations. “I think it’d be interesting for someone to make a version of The Sims in ASCII,” Sylvester says.

The final part of RimWorld’s puzzle are its ‘storytellers’, different algorithms you can choose which manage the events that players face, from raids and insect infestations to the appearance of traders. The one called Cassandra Classic tries to create a balanced, paced storyline, sending a cycle of exciting threats and rest periods which gradually get more challenging, depending on the colony’s general wealth and combat power. But it’s the Randy Random storyteller which shows how powerful apophenia can be. Other than impossible ones, such as heatwaves in winter, it sends entirely random events the player’s way, and yet it’s easy to ascribe meaning to them. That’s because in RimWorld everything overlaps: a colonist’s illness makes a raid harder to fight off, but the food the colonists find on the raiders’ bodies allows them to get over an eclipse that makes their crops fail. Each event is random, but in concert, well, that becomes another story.

Read this next