How A Plague Tale: Innocence's rat hordes were madeI'll have you know they make very good pets
Oh, the rats. The rats and the rats. If you don’t like rats, it’s best you don’t read on, because in A Plague Tale: Innocence there are thousands of them. They’re the stars of its grim medieval show, swarming around you, chittering and lunging and responding to your every movement.
And they presented their creators at developer Asobo Studio all kinds of problems to make. Their every little detail is the result of lots of experimentation and many wrong turns as their programmers and designers laboured to both make them feel horribly alive, while also building a game around them. After all, no one had tried before to make a game about surviving throngs of vicious rodents during the Black Death. Merry Christmas, Mechanic readers!
Not that A Plague Tale started with the rats. It started with the plague. Asobo had the (correct) notion that the Black Death would make for a distinctive and original setting, but with that came the first problem: how to represent bubonic plague and make it, well, fun. “Fighting bacteria isn’t really doable,” game director Kevin Choteau tells me.
He and his team wondered about creating some kind of miasma or fog that players could face, but it felt like it’d be too supernatural in a game they wanted to feel gritty and real. And so, with fleas as difficult to fight in a third-person action game as bacteria, they turned to bubonic plague’s erstwhile scapegoat: rats.
And they’d pose the second problem, the one that accompanied the team through the entire production of the game. “If we wanted to have this unstoppable force that spreads around the country, destroying everything, it meant we need tonnes of rats, this huge sea of rats,” remembers Choteau. “Yeah, suddenly the numbers were crazy high.”
So did the programmers say no a lot?
”Sometimes!” says lead gameplay programmer Cyril Doillon.
“I’m not sure you said no, but you said it would be super-complicated,” says Choteau.
A Plague Tale can have up to 5000 rats scurrying around at once, a figure that was set early in development, but which demanded a great deal of optimisation and careful design to make them run on your PC.
The crucial thing, however, was that the rat horde would behave naturalistically. It couldn’t be faked with graphical tricks, such as with a big ball of particles or animated textures. Each rat had to be an individual, governed by AI which let it react to the world around it, whether rushing forth to overwhelm and devour player characters and enemy guards, or to avoid light.
”If we wanted to play with the rats, we needed to add a weak point to them, and for us it was light,” explains Choteau.
And so at the core of A Plague Tale’s design is a triangle formed by the relationships of three elements: humans, rats and light. Both you and human guards stay in the light to be safe from rats. But you stay in the dark to be safe from guards.
That triangle provides the game with the key tension that informs most of its set piece level design, but it came with yet another big demand on Asobo’s programmers. Usually, light in games is just visual, baked into the world when it’s developed to make scenes look good. But outside of games like Thief, light rarely has much bearing on game systems.
But A Plague Tale’s light, whether a lantern held by a guard, a burning stick held by the player, or a swinging brazier, had to be dynamic and play a central role.
(In the above video, the rats’ states are indicated by letters above their heads. For example, W indicates a wandering rat, I is idle, E for eating, D for detecting, R for repulsed by light.)
“It was scary, even for publishers,” says Choteau. “They asked us how we were going to build levels and create the mood we wanted if every light had to be able to be turned on and off. Would it mean every level, every chapter, would have to be set at night? We had to tackle all those things and have an answer for them at the same time.”
So, right after creating a prototype which managed to get a horde of rats in a level, the team made another in which they could move around a light and watch as the horde reacted to it. “It was a good way to see if the passive behaviours could work, and not break everything,” says Doillon.
In the next prototype, they added player and guard characters to figure out how to get the rats to attack them without, again, breaking everything. Here, the challenge was to get 5000 rats to pathfind their way around a level, a task that would be impossible through the normal methods of computing the route from the AI thing to its target. Computing individual rats’ paths would “explode our CPU”, in Choteau’s words.
Doillon’s solution was to reverse the method. It would start with the rats’ targets, whether a human guard or the player, and work backwards. For every point in the level, the game works out a route to the nearest target. Then, as if on a conveyor belt, a rat is simply guided along the path for where it is. “It’s a maze,” says Doillon.
As the targets move position, the game computes new maps of routes for its rats, ever shifting the directions in which they swarm, making them look very much alive and responsive to the world.
(The above video shows the grid the game computes. Rats take the direction of the nearest arrow to reach their target - a ham. The red arrows guide them around permanent level obstructions like pillars.)
With this difficult problem solved, the triangle was complete. The next task was to create a series of rooms in which pairs of programmers and designers could figure out how to make a game out of it, experimenting with different setups. “There might be a light that you could turn on or off and see how the rats reacted, or a moving light. Or a guard patrolling with a light, and to see how they react if you destroy the light,” says Choteau.
These rooms formed A Plague Tale’s dictionary of Things To Do With Rats, Humans and Light, a set of golden rules for its level designers to follow: you need this number of rats to successfully attack a guard; they can travel this distance in that amount of time.
While the rats took a lot of tweaking during this phase, so too did the guards. When they were first given the ability to run away from the rats, they were far too fast. “You couldn’t throw rats at a guard any more,” says Choteau. The triangle had broken.
But the answer wasn’t to slow the guards’ running speed, since Asobo wanted players to see clearly that they’re terrified of the rats. Instead they made the guards take a long time to turn. ”It’s the best solution we found: they try to get away, but they’re unable.”
The rats had to behave in credible and apparently complex ways, too. But Asobo couldn’t possibly make all 5000 of them do so. Only the closest 400 of them scurry with full individual animation and have a tail that follows their movements and gleaming red eyes which give you a immediate sense of where they’re looking. “They’re super-unnatural, not normal rats,” says Choteau. “In the dark, it’s almost the only thing you see moving around.” They also have a slight reflective sheen on their backs so you can see them in the dark when they’re turned away from you.
The next group of rats share a single animation, so they can be seen moving but don’t need to be individually controlled. Then, Doillon describes the last group as “only potatoes” - a static mesh. The game blends the populations of each group so they look like a uniform mass of slavering rodents.
But it took Asobo a while to train those frontmost 400 rats into the ravening horrors that are in the final game. Early feedback from testers consistently said something was wrong with them, but there was no consistency as to what, exactly. Eventually, the team realised they were just too passive, and not reacting enough to players’ presence.
“We wanted them to be aggressive, scaring and threatening the player, and saying that if you cross the light, you will be dead,” says Choteau. One of the last behaviours they were given was one of their most impactful: individual rats at the edge of a lighted area will charge into the light before scuttling back. It made the border between rat-friendly dark and human-friendly rougher and more ambiguous, making players feel less safe.
The rats were also given a behaviour whereby they’d rise up on their hind legs and turn to face a nearby human for a moment. With their eyes gleaming in the darkness, it emphasises their awareness of the player, but it gains even greater power through the way the horde’s AI works: you’ll see the rats become conscious of you in a wave that spreads across the mass.
“I love it when you see the information spreading,” says Choteau. “When a rat sees the player, it spreads that information to a nearby rat, and they spread it further.”
It’s incredibly effective, and it emerged not from designers and artists but from Doillon’s technical solution for modelling 5000 rats as efficiently as possible. “We discovered lots of things, just by seeing what Cyril was doing,” Choteau continues.
“The idea was to remove everything we could from independent behaviour and put them into a horde brain,” explains Doillon. “Even if individuals have small behaviours, they share a lot of information.”
“This is why he’s the lead,” says Choteau. “He’s more the designer of the rats than anyone, because he was confronting these behaviours. It was about discussing his discoveries and how we could transform them into something for the game.”
In fact, the game spread the information far too fast to be noticeable outside of debug modes, so Doillon had to slow it down so it was visible. But it’s a perfect example of how A Plague Tale’s rats are the result of programmers and designers riffing off each other to solve a really hard problem.
“We had to be attentive to discoveries and technical breakthroughs and turn them into something good for the game,” says Choteau. ”It was scary, because we didn’t know what we’d have at the end, but it was also super-cool because it was an opportunity to do some real R&D.”