Hello Miners,
We’ve got another behind the scenes peek for you, this time on one of your most requested topics: cave generation. Let’s explore how the caves of Hoxxes get formed, thousands of times over again, every single day. Hope you like it!
Planting a cave seed
The moment you select a mission in Deep Rock Galactic, a cave is born.
Out in some invisible abstract, the game generates a seed. This is a procedurally-generated string of numbers containing the instructions for a brand new cave system. This random number decides what the caverns will look like, where you’ll find mineral deposits, and which fiends await you within. All of this is determined in a fraction of a second, flash generated when you lock in a mission.
This new cave is entirely unique. There are many like it, but this one is yours.
Caves – or more specifically, procedurally-generated caves – are what define Deep Rock Galactic. They set the stage for the action, giving life and lore to the game. They’re what make each dwarf’s traversal tools relevant, enabling each class’ function and identity. And the game owes a great deal of its replayability to the limitless pool of possible caves to explore.
So how’s it all work?
Let's dig into it.
Cave generation in a nutshell
Your cave seed gets generated right when you select a mission, but the actual cave comes together once you hop in the Drop Pod.
As you hurtle toward Hoxxes, the cave generator really gets to work. Cave systems come together like pearls on a string: one room at a time, connected by narrow, winding tunnels.
While the overall cave system is a unique result of random generation, the individual cave rooms are hand-crafted. If you imagine the cave generator as our automated chef, we still want real people to make sure it's cooking with high-quality ingredients. There are over 100 cave room templates to pick from -- but many of these templates also contain multiple internal 'randomizer' variants, so spawning the same template 20 different times would still produce 20 unique rooms.
Depending on the mission type, length and difficulty, these room templates could get warped, mirrored, or overlapped as the cave generator strings them together. On-site Refinery missions, for example, mash multiple rooms into one massive cavern. This is why you're likely to see huge herds of Lootbugs during these missions, because the entire cave's population all gets spawned at the same point.
But to understand how this generation really works, we need to take a closer look at one of these cave room templates.
A cave room template? A Windows 98 screensaver? There's no way to be sure.
In focus: how a cave room template works
Every cave room template is composed of intersecting spheres, half spheres and flat planes. This cluster of shapes tells the cave generation engine what sort of volume to carve out of the solid rock, creating the rooms where each mission takes place.
The image above is the template for a cave room -- it’s the instructions that the procedural generator uses to create a unique cavern.
Here’s what you’re looking at:
- Green and yellow lines - These lines determine the general shape of the room. The yellow lines act as the outer boundary, the base layer upon which the cave generator applies ‘noise’ like textured surfaces and biome-specific rock patterns. The green lines are the inner boundary, limiting how far this ‘noise’ is allowed to fluctuate and push into the space itself.
- Small orange orbs - You can see these clustered in the center, surrounded by an outer yellow wireframe. They act as randomizer elements: they mark space that might either be hollowed out to create extra volume, or filled in with a random protruding rock formation. When this cave room is created, each of these has a random chance to be ‘activated’ or not. This way, each individual cave room can have an even greater degree of unique and unpredictable variety.
- Medium orange half-spheres - These half-domes, seen around the outer perimeter of the cave room, mark potential exit paths for the room. In game, these are the areas filled with compacted dirt. The cave generator engine uses these as nodes to link this room to the rest of the cave system via tunnels.
- Orange wireframe globe - The orange sphere in the background limits the size of the cavern. In the game, various cavern templates are sorted by different sizes. If the template in question pushes beyond this orange globe, we’ve got to either re-categorize its size, or cut it down to fit within the globe.
A single cavern, viewed from the outside using the power of Developer Magic™.
Early version of cavern and tunnel generation. Simplified wireframe structure elements are clearly visible.
What makes a cave fun?
While a computer brain is great at randomly stitching a cave system together, it’s not so good at deciding what sort of cave is actually fun to play. That’s why we have human brains in charge of that part.
Anders Heindorff Frederiksen, Senior Game Designer at Ghost Ship Games, has been the human brain (and complete human person) designing the cave rooms since Season 03. In his words, he makes the building blocks that feed into the cave generator. He’s the one putting together the cave wireframes like we looked at just above.
As he sees it, there are a few key considerations in making a good cave: traversal, natural wayfinding, and dramatic experience.
A cave should require players to carve out terrain and use their traversal tools to get around, but it shouldn’t feel like a maze. While larger cave systems can get a little labyrinthine, individual rooms should still feel intuitive, with their shapes “funneling” players through to the next exit point. It’s about balance: not so simple that it gets boring, not so complex that it feels punishing. On top of all that, a cave room should just seem cool. That one comes down to gut feeling.
However, Anders can’t guarantee all of this by hand-sculpting it. He’s still got to make design decisions that can withstand random variation from the cave generator.
“Once I make a new room, I’ll load in and play it a bunch of times with Scout, then Driller, and so on. Sometimes I play through it and it really sucks. Then I’ve got to figure out what doesn’t work, and why,” he says. “It might be that the visibility’s bad, or the room is basically unplayable as some classes. I can only set the framework for the space before the generator gives its own spin on it, so there’s a lot of trial and error.”
Early experiments with room generation, and shaping cave surface textures.
Concept sketches for different cave rooms and rock formations.
Biomes: furnishing the caves
Once we’ve got a cave all shaped and laid out, it needs noise and debris.
‘Noise’ is the technical term for shaping the cave’s walls, ceilings and floors. Basically, it’s about taking the perfect spherical shapes of the cave framework, and crumpling those surfaces into something more interesting and rock-like. ‘Debris’ refers to the process of sprinkling in assets like smaller rock formations, cobwebs, hazards, and the flora and fauna unique to the selected biome. Every biome has its own distinct patterns of noise and debris.
Robert Friis, Studio Art Director and co-founder of Ghost Ship Games (and also the voice of Mission Control) began working on different biomes just a few months into the game’s development. As he sees it, Hoxxes’ different biomes are an essential dimension of the game’s procedural generation.
"Firstly, they give a lot of character to the planet of Hoxxes. But it's also a big way for us to boost the game's replayability,” he says. “The exact same level will look and play differently depending on which biome is then added on top. It determines the enemies and interactive hazards you'll meet, things like fog and lighting can be completely different, even the shapes of the caves themselves will be different, and it's then up to the player to figure out how to navigate it.”
Your selected biome tells the procedural generator how to sculpt the cave’s surfaces, and how to populate it with flora and fauna. Each biome has a distinct texture palette: Magma Core, for example, applies sharp, ridged ceilings and craggy, jagged edges to most surfaces. Sandblasted Corridors, by contrast, is appropriately smoothed, eroded, and sparse.
Nobody at Ghost Ship Games is a professional geologist, so most aesthetic choices here come down to what looks and feels cool. Hoxxes’ biomes draw from real-world caves as well as fiction. Areas like Salt Pits, Glacial Strata, or even Crystalline Caverns (see the Naica Mine) resemble something you might find here on earth – while a biome like Azure Weald reflects inspiration from the luminous landscapes of Avatar.
In essence, you could view biomes as the “finishing touches” department in cave generation. If the wireframe structure decides the shape of the cave, the noise and debris are the wallpaper and furnishings.
Very early versions of the game experimented with a blockier, Minecraft-esque terrain system.
A prototype 'debris' test from early in development, experimenting with cave surface meshes.
New caves, tomorrow and forever
There’s some statistic out there about how you can connect six standard LEGO bricks in about a billion different ways.
You might think about Deep Rock Galactic’s procedural cave generator as working in a similar way. But instead of six bricks, it’s got a pool of 119 hand-crafted rooms and 10 biomes to pick from. Plus, it can warp and tweak and overlap all these elements before snapping them together.
The infinite cave engine runs around the clock, day in and day out, 365 days a year. On an average day, the cave generator produces about 150,000 new cave systems for players on Steam. Since the game launched to Early Access in 2018, Deep Rock Galactic players have generated and explored well over half a billion unique cave systems.
In some way, you could say this cave machine is the game’s main character. In any case, it’s the playmaker and dungeon master, setting the stage for all the rest. It’s the one to thank for the gigantic, dramatic caverns that stretch out into the darkness, as well as the idiotically narrow corridors that cost you the mission when you’re rushing to extract. It’s with you on every mission, whether it’s your first or your millionth.
It’ll be there as long as Hoxxes has minerals to mine, knitting new caves out in the endless dark.
What was the biggest cave you’ve ever come across in Deep Rock Galactic? Let us know in the comments.
Also, if there’s another subject you’d like to learn about in the next Below Decks, we’d be happy to hear it. Thanks for reading!