Virtual Darkness

From The DarkMod Wiki
Jump to navigationJump to search

written by Fidcal

Note: The Location Settings article shows you an easy-to-use and general system to get different ambient light levels and colors for each location/zone the player is in. Since this system also covers different ambient sounds and script calls at zone boundaries, you should really use it.

This article here is just a general introduction into "ambient light settings".


Being a stealth game system and as its name implies, most Dark Mod missions will take place at night and require darkness as cover. Generally, absolute blackness is unpopular in this type of game and is not recommended. It can make navigation difficult, uncomfortable, and gives an impoverished visual display. Instead, very low ambient light is used to represent blackness. We call this virtual darkness. This main ambient light should not be so dark that the player cannot make out some detail of nearby surfaces textures. Yet because it represents complete darkness it should not be so light that it seems strange that in-game characters cannot see you (see later.)

Ambient light can be coloured to provide atmosphere and realism depending on the environment.

Brightness Standard

From Release 1, The Dark Mod includes a test map (may be included in a trainer mission.) for both players and mappers to standardise their gamma and brightness settings. I emphasise that this does not force all missions to be the exact same brightness. What it does is provide a standard setting so everyone can know what a particular mission is intended to look like. If a player then prefers to generally have their settings darker or brighter then at least they know. Likewise, if a mapper wants to produce a darker or brighter mission then they are free to do so but at least they will not do it without knowing. The advantages of all this is that in most cases players will not have to keep fiddling with the brightness setting for every individual mission.

Ambient Light

Unlike normal lights, ambient light does not by default fade to the edge of its radius but is the same constant brightness throughout. Rich variation of fading or patterning can be introduced with a light texture. For general use, ambientLightnfo is recommended as it has no patterning and so its brightness is consistent throughout its volume. Regard it as the one to use by default.

The main ambient light ambient_world illuminates the player like a regular light. If you're using the recommended low level of 6, there should only be a negligible effect. The AI characters will not see the player too easily, the lightgem will provide a bonus for crouching, and thus complete darkness is simulated without blinding the player.

Mappers are not bound to an ambient_world of 6 though, higher settings are possible. Settings of 7 or 8 are not all that visually different from a setting of 6 to the player though, so a player might find that the AI are reacting too quickly, and spotting the player far too easily...even though it feels like they are lit the same as they were in the previous mission with a 6 ambient_world. In these cases, the arg lightgem_adjust can be applied to any piece of worldspawn to offset the lightgem and bring balance back to the gameplay. For an ambient_world setting of 7, a lightgem_adjust setting of -1 should be sufficient. For ambient_world of 8, a lightgem_adjust of -1.5. If a mapper wanted to go as high as an ambient_world of 9, a lightgem_adjust of -2 would be required. Ambient_world of 10 and above should not be offset as this is entering a realm where the brightness is not believable for hiding.

Other local ambient lights can be used to produce highlights, mood, or any purpose the mapper can imagine so can be any brightness.

Virtual Ambient Light

All lights in Dark Mod are dynamic, real-time, having the potential to vary in-game and cast shadows. Naturally this affects performance and having too many lights close together is likely to reduce frame rates so care must be taken. This applies to the main ambient light too which naturally covers all surfaces.

To improve performance on some low-end systems, Dark Mod textures can simulate the main ambient light. This feature pre-calculates how much textures should be illuminated once only instead of continuously during gameplay. Players can select either method so those with faster machines can use the true ambient light which gives better quality.

Enabling Virtual Ambient Light

All that mappers need to do to allow players to select virtual ambient light is to name their main ambient light "ambient_world". That's it. If the player selects this feature then Dark Mod takes the color/brightness values of that light and passes it to all the textures then switches off that ambient light. It is therefore important for mappers to do this to provide the best performance for players with slower machines.

Note: Some special materials have a background texture plus detail that is only visible with a real ambient light, for example, darkmod/stone/sculpted/corpse. The mapper can place normal lights or local ambient light for those surfaces where possible or leave them with their background texture.

See also