This is The Mechanic, where Alex Wiltshire invites developers to discuss the difficult journeys they underwent to make the best bits of their games. This time, Deep Rock Galactic [official site].

The moment Deep Rock Galactic took my imagination was when I saw its dwarf miners throwing flares into the inky blackness of a cave in its E3 trailer. Few games do darkness, and here was a game trading in it. As the flares fell they lit up the faceted low-poly walls of the cavern, revealing what lay ahead: ore to mine, pitfalls to fall into, twisting passageways to get lost in, and swarms of alien enemies. It got right to the core of exploration, capturing the mystery and adventure of blundering into spaces where no one has been before. In short, darkness leans right into everyone’s favourite fantasy of being a dwarven miner in space.

Ghost Ship Games’ Deep Rock Galactic is a mix of Minecraft and Left 4 Dead in which four players band together to mine precious rocks from a procedurally generated cave system. Armed with pickaxes, class-specific guns and traversal gear, they must survive waves of attacks from insectoid aliens called Glyphids while gathering a set quota of ores (and anything else they can grab), and then call their retrieval pod and race back to it before it leaves. Supplies are always short, enemies are countless, and, yeah, being able to see is important.

For game director Mikkel Martin Pedersen, the concept of setting a game in darkness came directly from the theme, and he looked to the film The Descent for the feel he wanted. “It has the most claustrophobic scene ever created,“ he says. “I think you’ll know which one I’m thinking of. The tension and the feeling of being trapped is just really well done.”

It was Rebellion’s classic Aliens vs Predator that introduced the idea of throwing flares. “The aliens in that were really fast, so lighting up the area around you was a matter of life and death,” he tells me. “If you couldn’t see the aliens approaching from far away, then you didn’t have time to shoot them. It was a really strong mechanic; I always had this feeling that there’s something magical about throwing a flare.”

There really is. Lighting up a cave doesn’t directly win the game, but it’s crucial to your chances of doing so, and besides that, when you throw a flare into a new chamber, it feels as if no one has been there before. And they haven’t, since the cave systems are generated, built from pre-designed caverns of many shapes and sizes and joined together by winding tunnels.

But the decision to shroud the game in darkness introduced a lot of challenges. Most games use light as a navigation tool, illuminating exits and points of interest to get players’ attention. “It’s something we couldn’t use because there’s no light in the cave,” designer Fran Avilés says. Players would easily get lost. Flares provided a solution. Avilés realised that by watching one lighting up a cave as it falls, players gain a strong understanding of its 3D space.

“The connection with the shape is so much more intense, they’re revealing that space,” Avilés says. “It’s something you’re not used to; you’re used to levels that are polished so every item has been placed so you’re not distracted. We have the opposite: players discover the world around them and create the connections.” By focusing on the part of a space that you’ve lit up, you’re filtering it out of what would otherwise be very visually noisy space, preventing you from being overwhelmed.

The design of the caves went hand-in-hand with the design of the flares. Caverns started out much smaller than they are today, but Avilés noticed they became more and more fun as they increased in size. Today they can be huge spaces where you’ll spend a good deal of time mining and facing Glyphid attacks before moving on. But the flares were originally designed to throw out only a small radius of light which didn’t have a chance of illuminating much of them. “It was very much like The Descent in that we tried to keep the framing of what you see covered in darkness, which was very scary but also very difficult,” says Pedersen. As the caverns grew the team steadily raised the flares’ light output to match. Only in the biggest caves do you still get the sense of encroaching dark that Ghost Ship was originally aiming for, but as with all good ideas, they had to be weighed up against what’s practical and fun.

It was a similar case for how flares are delivered. Looking back to Aliens vs Predator, which gave Marines a stock which would run out, each dwarf was initially given just 15. “That was kind of brutal, because you couldn’t see anything or play the game when you used them up. You’re really lost in the dark,” Pedersen admits. “We thought it would be cool but it turned out to be very brutal.”

The problem was that before they’re upgraded, flares only burn for 25 seconds before they go out, and without light, players would be in situations where they weren’t dead but they were completely powerless. So the team decided to go for a solution where flares would constantly recharge, with a maximum stock of three (which can be raised to four by upgrading). You never feel you need to stockpile, and unless you’ve been spamming them out, you always have one or two to hand.

“Maybe it’s a little too forgiving right now, charging a little too fast,” says Pedersen. “I don’t know. I could see us doing some tweaks.” With the game now public, he’s seen that players throw their flares in rhythms that ensure a regular supply. “You don’t have a feeling of running out of light and that feeling is essential to being scared,” he says, anxious to claim back some of the Descent-y tone.

At the same time, Ghost Ship hasn’t been afraid to add light to the game in the interests of keeping it fun. In some caves bioluminescent plants grow, mostly for visual interest but which also give a sense of depth to the murk. They noticed that players were struggling to see nearby details, such as what they were trying to mine and cliff edges, an issue that became more serious when cave designs began to be more and more vertical. “People were walking off ledges and falling down because they couldn’t see the ground,” Pedersen says.

So they added headlights, which are switched on by default. To maintain the flare’s leading role in lighting, headlights are very short range, only eight metres, so they only illuminate what’s immediately in front of the player. And they come with the added benefit of getting to see your teammates’ light cones running around in the inky distance. “It creates a lot of mood, the feeling of cave exploration,” says Pedersen.

Camaraderie, too. Seeing your dwarf pals bobbing about in the dark on the other side of a cavern gives you an awareness of the team. And the restricted nature of the light in general does a great deal to pull players together so they work in close proximity, even when they’re strangers. It doesn’t feel good to go out into the dark alone with a limited stock of flares. “We thought about having artificial ways of keeping players together, like killing them if they’re too far apart,” says Avilés. “But we realised that the game should be rewarding you for staying together, so they’ll stick together because it’s the optimal way of playing.”

And so, when you’re warned of a swarm, you’ll almost always bunch together, carefully lighting up the area around you, taking care to pay special attention to the entryways from which they’ll emerge. Lighting provides more to Deep Rock Galactic’s combat mechanics besides. There are enemies which behave like Half-Life 2’s barnacles, clinging to ceilings and catching unwary dwarves with their long tongues. Since flares always fall to the ground, they often fail to light ceilings so you can’t see the barnacles, but the scout class has a gun which shoots a more powerful type of flare that sticks to surfaces. By firing it at the ceiling, scouts can reveal them for the team.

What’s more, Glyphids which attack at range with acid and sticky webs emit light so you can see them from a distance. Without it, the team realised they couldn’t be targeted. “That’s another example of starting completely dark and then discovering it wasn’t fun,” says Pedersen.

“On the other hand, the warriors are almost completely black because we really like it when they appear from the dark,” says Avilés, who reveals that Ghost Ship is also considering adding enemies which react to light, perhaps eating flares or being attracted to light, giving the dwarves the chance of using their flares to set traps, or cause them to have to switch off their headlights to remain safe.

And the list of design opportunities goes on. There’s an idea for a tree which, when shot at, acts like a floodlight, claiming an entire cavern for the team. And I haven’t even talked about the way light is used as a way of pathfinding in the twisting passageways of the mine. The Mule, a robotic chest which you dump your ores into, scuttles back to the evacuation pod when you call it down at the end of a run, and it leaves a trail of lights behind it so you can find your way back. And since your flares remain on the ground after they’ve gone out, whenever you find them you know you’ve been there before.

Light is the foundation of so many of Deep Rock Galactic’s genius little features, and provides so much of its fantastic sense of exploration and adventure. “It’s about the feeling of going into virgin territory,” says Pedersen. “When you start a mission you’re going into this procedurally generated cave. No one has been here before and it’s up to you to explore it. That’s magic, I think, and it’s magical to us as designers whenever we play it. We don’t know what the game is going to throw at us.”