Real-time lights and shadows have been a part of Dark Matter since its earliest designs. In fact, they were already part of the game before it had a name, before it had a format and shape, back when it was little more than a “scary corridors with aliens, Metroid-style” inspiration waiting to be born.
Dynamic lights and shadows are about the only thing that’s remained untouched since the first prototype. The way we handle level geometry, actions, maps, character movement, AI and weapons have all gone through several iterations and optimizations, but not real time lights with those gorgeous shifting shadows. They remained stubbornly consistent throughout, as a core element of the game.
Sticking to such a costly system wasn’t just a visual obsession either: it was a core decision that shaped the entire game. We all wanted to see lights truly made relevant in gameplay.
In Dark Matter, light conditions radically alter enemy behaviour, as well as looking swell. Enemies in well-lit areas are more aware of their surroundings, act more aggressively towards the player, and know where their closest healing point is, so they can leg it if the fight becomes difficult.
Keeping your lights down is a good survival strategy, but keeping them off constantly just means you’ll be walking right into enemy traps.
It took a number of elements to fully realize our vision. Star of the show is, of course, deferred lighting. This relatively modern rendering technique allows a large number of real time lights to be present at once in the scene, with a lower cost per light than traditional forward rendering.
As soon as we had our test scenes running, we realized that we would need more than just a deferred lighting setup. In order to convincingly recreate things like foreground and background lights, as well as a shroud of darkness, we turned to a series of custom post-processing solution that eventually became the darkness overlay.
The basic technique uses a series interlocking effects that first draw a blanket of darkness over the screen, and then access the various light elements in the scene (static lights, moving lights, flashlight, player and creature overlays) to calculate where, how and how much to punch holes in the darkness overlay.
Things are of course a little bit more convoluted than that, and a lot of coder sanity was lost along the way to the current solution, but we finally managed to end up with a system that’s flexible and powerful enough to accurately render both brightly light rooms and dark corridors, and anything else that our level designers and artists care to conjure.
Coupled with the way enemies and hazards react to light conditions, darkness in Dark Matter is far more than a simple cosmetic touch – it’s a living thing at the heart of the gameplay experience we created, and when bullets start flying, enemies catch fire and ominous glows start emanating from Big Cousins, it’s a thing of beauty.