Below Decks at Ghost Ship: Cave generation in Deep Rock Galactic

Deep Rock Galactic

Deep Rock Galactic is a 1-4 player co-op FPS featuring badass space Dwarves, 100% destructible environments, procedurally-generated caves, and endless hordes of alien monsters.

[img]{STEAM_CLAN_IMAGE}/27142043/9c0e67c07aad7d0c12dad950016d5de13d2e89a7.jpg[/img] [h2]Hello Miners,[/h2] [i]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! [/i] [hr][/hr] [h3]Planting a cave seed[/h3] 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. [img]{STEAM_CLAN_IMAGE}/27142043/5e625f40867a564f6f6f659389da4680314c1a62.jpg[/img] [h3]Cave generation in a nutshell[/h3] 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. [img]{STEAM_CLAN_IMAGE}/27142043/87d5a64e8e6d6c3eedea87de45410fe8aa0db722.jpg[/img][i]A cave room template? A Windows 98 screensaver? There's no way to be sure.[/i] [h3]In focus: how a cave room template works[/h3] 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: [list] [*][b]Green and yellow lines -[/b] 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. [*][b]Small orange orbs -[/b] 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. [*][b]Medium orange half-spheres -[/b] 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. [*][b]Orange wireframe globe -[/b] 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. [/list]For comparison, directly below is this same cavern template once it’s been fed through the procedural generator and rendered in the game. This one template has dozens of possible major iterations, and would never look quite the same if we loaded it again. [img]{STEAM_CLAN_IMAGE}/27142043/d83183cdfe6f16f0d817a58863b278f053f916d3.jpg[/img][i]A single cavern, viewed from the outside using the power of Developer Magic™.[/i] [img]{STEAM_CLAN_IMAGE}/27142043/52f123aa7a25441e5d739bfc4fb0a07f6e854e5d.jpg[/img][i]Early version of cavern and tunnel generation. Simplified wireframe structure elements are clearly visible.[/i] [h3]What makes a cave fun?[/h3] 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.” [img]{STEAM_CLAN_IMAGE}/27142043/fdb024904414b47f204fc9a6a23423f6005ec277.jpg[/img][i]Early experiments with room generation, and shaping cave surface textures.[/i] [img]{STEAM_CLAN_IMAGE}/27142043/13aa9e0ab18479f44a2068bb8c0b3f1b9288523e.jpg[/img][i]Concept sketches for different cave rooms and rock formations.[/i] [h3]Biomes: furnishing the caves[/h3] 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 [url=https://steamcommunity.com/games/DeepRockGalactic/announcements/detail/4240783699902507168]the voice of Mission Control[/url]) 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 [url=https://en.wikipedia.org/wiki/Naica_Mine]Naica Mine[/url]) 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. [img]{STEAM_CLAN_IMAGE}/27142043/cf73c4cfc9afe9e952e2e92e092282e0406fd9a9.jpg[/img][i]Very early versions of the game experimented with a blockier, Minecraft-esque terrain system.[/i] [img]{STEAM_CLAN_IMAGE}/27142043/68987fe32728ac9e91882db57f3428654d735018.jpg[/img][i]A prototype 'debris' test from early in development, experimenting with cave surface meshes.[/i] [h3]New caves, tomorrow and forever[/h3] 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. [hr][/hr] [i]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! [/i]