Wednesday, March 29, 2006

About stealth gameplay

Light and Darkness

The Chronicles of Doryen engine uses point lights :
Light intensity decreases as the inverse square of the distance from the light source. Cells near the source are in full light. At a certain distance, they are in penumbra. Once there is no more light, cells are in darkness.

For all cells in your line of sight :
  • cells in full light : you can see any item/creature on this cell
  • cells in darkness : you cannot see it (neither the items/creatures on it, nor objects like walls or doors)
  • cells in penumbra : you can see objects (walls, doors) and items. A creature may not be visible if it does a successful 'hide' skill roll against your 'spot' skill. Same for the player trying to hide from creatures. The creature size is taken into account in the hide/spot roll (it's easier to hide when you're small)

The hide/spot roll

In fact, the roll doesn't give directly the creature stealth value, but its derivative :
The stealth value starts at 0 when the creature is in darkness. Once it enters penumbra, the hide/spot rolls are used to increase it or decrease it. The creature properties (size, armor, ...) and behaviour (moving or hiding) act as modifiers for this roll.

Now we avoid the blinking by defining a stealth property on the creature which follows an hysteresis : instead of having a threshold S so that :

  • if stealth is less than S, creature hidden
  • if stealth is greater than S, creature visible

which would produce blinking when the stealth value oscillate around S, we can use two threshold Smin and Smax so that :


  • if stealth is less than Smin, creature hidden
  • if stealth is greater than Smax, creature visible
  • between Smin and Smax, same state as before.

Thus, oscillating around Smin or Smax does not produce blinking. The values Smin and Smax can be constant or calculated from the hide and spot skills of the creature and the player.

Thus, the thief gameplay would rely on cells in darkness or penumbra :

  • you have to avoid lightened cells to avoid fight
  • you can create more cells in penumbra/darkness by turning off lights with water arrows


Some details about light :

  • pillars and creatures will project a shadow.
  • the shadow of a creature depends on the light vertical position and the creature height. If you have a torch in your hand (let's say 2 meters/6 feet above the ground), a 1 meter kobold will have a really small shadow while a 3 meters troll will project its shadow to the map border
  • creatures may block line of sight. You cannot see a kobold behind an troll, but you can see an troll behind a kobold.
Sounds

Visibility in penumbra is not only a matter of hide/spot skill. We have to take into account some modifiers. One of the most important is the noise you make when you try to hide. The noise level is calculated from several parameters :

  • your weight (the lighter, the more silent)
  • your armor type (heavy chain mail armor will be very noisy)
  • your speed (calculated from the number of moves you made the last seconds)