ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Damage calculation over area

From ModEnc
Jump to navigation Jump to search

Splash damage, or damage over area, is a common feature in video games. In classic C&C games, there are two main systems that enable damage to spread over an area: the Spread mechanic in pre-Red Alert 2 titles and CellSpread introduced in Red Alert 2.

In Tiberian Dawn and Red Alert

When a warhead detonates, damage will fade in ring-shaped steps from the epicenter of the explosion. On each step the damage is decreased by 50%, resulting in an exponential curve where damage drops quickly at first, then slowly fades away the further you get from the epicenter. The radius of these steps is controlled by the Spread flag in the warhead settings.

In Tiberian Sun and Firestorm

The Spread system is carried over from RA, with a few minor changes. Damage spread in total is limited to a 3x3 area, minus the corner cell spots, creating a roughly circular area.

This illustration shows all damage falloff patterns in Tiberian Sun. On each step from the epicenter, damage is decreased by 50% from the previous step. Note the maximum area of effect and the four corner Cell Spots which are excluded from it.


Examples

Below is a demonstration of damage falloff. In the left example, a warhead with Spread=52 was detonated at the center of the circle (red spot). The warhead was configured to kill the target Technicians only if damage was dealt in full and no falloff occurred. In the left example, all settings are the same, except the warhead was changed to have Spread=56. Note that the Technicians standing in the left, bottom and right corners are just outside the maximum area of effect hardcoded to the engine, hence they are left unscratched.

In Red Alert 2 and Yuri's Revenge

Damage fades in linear regression from the center to the edge of the impact area, in cell-sized steps. PercentAtMax determines the percentage of damage left at the very edge of the affected area.

Example:

Imagine three identical targets, the first one (A) placed at the impact point, the second one (B) at the edge of the impact zone, and the third (C) in the middle of them.

Upon detonation of a warhead with stats:

PercentAtMax=1.0
CellSpread=10

Target A receives 100% original damage, Target B receives 100%, and Target C receives 100% as well.

If a different warhead is detonated, with stats:

PercentAtMax=0.02
CellSpread=10

Target A receives 100% of the original damage, Target B receives 2%, and Target C receives 51% (linear average = (100 + 2) / 2).

Workarounds

A common workaround to overcome the rather small area restriction in Tiberian Sun is to use invisible, debris-like animations. Such animations can use any warhead and carry damage over to any distance, but they're susceptible to terrain obstacles, buildings and water, and cannot be used by units to gain rank. This workaround also works in Red Alert 2 and Yuri's Revenge, should CellSpread be insufficient.

Another method is to use cluster or splits projectiles, but they are hardcoded to a slow speed (approximately Speed=20).

A third method is to use particle systems. For example, a smoke particle system can spawn gas particles in a radius, which in turn can deal damage. The downside of using gas particles is that they are hardcoded to turn killed objects into Visceroids. Other particle types that can deal damage, like fire, have their own limitations.