One of the most visually striking games of 2022 is Source of Madness by Swedish developer Carry Castle. It’s a side-scrolling roguelite set in a nightmarish world inspired by the twisted works of HP Lovecraft. In it, the player is an Acolyte that roams the bizarre Loam Lands in search of the Tower of Madness. A terrifying journey because of the grotesque beasts that inhabit the land and do everything in their power to stop you.
The beauty of the horror lies in the fact that these hellish creatures are created anew every time the player dies. And in true Roguelite fashion, that happens a lot. Powering the procedural generation and -behaviour of the creatures is an intricate combination of systems. “It’s a bit complex”, says Per Fornander, CEO of Carry Castle. “But nobody else has made procedural enemies in Roguelites to my knowledge.” And so that was exactly what the team did.
The different worlds in Source of Madness are bleak places, although there is beauty in their ugliness. “I’ve been captivated by the stories of HP Lovecraft for some time and I’m enjoying quite a few rogue-lites, so it felt only natural to combine both of them”, says Fornander. Fear of the unknown, not knowing what is out there fits Lovecraft’s ethos very well and so the team set out to build a system that would spawn new monsters every time.
But what exactly is driving the tech behind this game? “We wanted the world to be physics-based which made us look at machine learning”, says Fornander. Unity had just released a beta version of their Machine Learning Agents that allowed the team to start prototype AI driven muscle movement. That ended up being the main movement system for the procedural monsters.
“The other part is where we have been leaning on Deep Style Transfer work that has been done before and I have baked into our texture pipeline. This allowed us to dress the world and the monsters in different skins or styles, that all have different properties, while keeping it very consistent at the same time.”
The permutations of the monsters (in theory ‘bilions’) are created with a combination of systems. The main one being the Monster Stitcher that combines vast libraries of body parts and configuration setups to allow for variations while still avoiding everything becoming generic meat blobs. Fornander: “These limbs and bodies can be scaled and rotated and stitched together in billions of ways and can affect how it moves and attacks. It ultimately allowed us to create wacky monsters that are later controlled by a lot of systems and our own Neural Network AI.”
Fornander laughs: “As you can see it is a bit of a complex system that mashes together different libraries of parts based on authored rule structures. The best part of this is that it surprised us as developers at certain combinations while keeping it sane enough to balance them.”
With so many systems in place Carry Castle had to tweak endlessly to make everything work in harmony. The team build a lot of extra support systems to make sure the experience was consistent. “The game did end up very different from the original plan, mostly since we scaled up the concept after we secured a deal with Thunderful Publishing, says Fornander. “But it was also originally intended for a more indie and interesting ink sketchbook look that I also think would have worked with the Lovecraftian theme. Especially because most of the images are so rough that it allows for your imagination to run wild.”