Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(w3ddevice): -volsmoke tank sparks streak, soot billows, wreck glows

Olcay Seygan29f008d4c3a3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 627a362ad..75ac05642 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -112,7 +112,7 @@ found and fixed, EA's own, not port damage.**
## Smoke simulation
- Options > Effects has a Smoke Simulation box. On Low or High a tank's cook-off, a shell's dirt fountain and a nuclear mushroom are a moving body of air rather than flat sprites: the smoke rolls, rises with the heat, settles as dust and parts round the buildings in its way. Off is the default, and Off draws exactly the picture the game drew before. The box works mid-match, the next frame after you press Accept, on the default renderer; the Direct3D 9 renderer and the Classic graphics setting hide it.
-- A tank goes up the way the footage of a real one does. Orange flame and black smoke burst out low along its own hull, long under an Overlord and short under a Crusader, and roll along the ground off both ends over a skirt of pale dust. A ragged fan of blown-out white fire with orange edges rises straight off the hull and opens wider as it climbs, tallest in the middle, on High about twice as tall as the fire is wide and on Low a shorter fan of the same shape, and in about a second it has cooled through orange to grey-brown smoke. Near-black soot banks up low along the hull, licked red by the fire under it, and swells for nearly two seconds after the flash, while a scatter of hot sparks flies up out of the fire and falls back. The wreck's black column is gone about eight seconds after the death, as quickly as the game's own smoke with the setting Off; it used to stand for half a minute, which in a fast game left a field of black pillars. A Crusader's fan no longer stands on a thin stem or grows horns at its edges. The glowing ball and the rays round it are gone, and so is the ring on the ground. Shells that hit a tank's armour no longer throw a fountain of dirt off it. The scrap flying off a dead tank keeps its own sparks but no longer drags thick grey arcs across the fire, and a gun's muzzle smoke is the soft grey puff it always was, where it had turned into a flat tan disc on the ground.
+- A tank goes up the way the footage of a real one does. Orange flame and black smoke burst out low along its own hull, long under an Overlord and short under a Crusader, and roll along the ground off both ends over a skirt of pale dust. A ragged fan of blown-out white fire with orange edges rises straight off the hull and opens wider as it climbs, tallest in the middle, on High about twice as tall as the fire is wide and on Low a shorter fan of the same shape, and in about a second it has cooled through orange to grey-brown smoke. Near-black soot banks up low along the hull, licked red by the fire under it, and swells for nearly two seconds after the flash, while hot sparks streak up out of the fire and fall back. The wreck's black column is gone about eight seconds after the death, as quickly as the game's own smoke with the setting Off, and a thin wisp over a glowing ember goes on to about twelve; it used to stand for half a minute, which in a fast game left a field of black pillars. A Crusader's fan no longer stands on a thin stem or grows horns at its edges. The glowing ball and the rays round it are gone, and so is the ring on the ground. Shells that hit a tank's armour no longer throw a fountain of dirt off it. The scrap flying off a dead tank keeps its own sparks but no longer drags thick grey arcs across the fire, and a gun's muzzle smoke is the soft grey puff it always was, where it had turned into a flat tan disc on the ground.
- A nuke builds a mushroom you can read. The flash is light: the ground, the buildings and the missile's own smoke trail go white for a third of a second, where a flat white disc used to cover half the screen for most of a second. From the first frame a lumpy ball of fire sits on the ground, yellow-white inside an orange-red rim, with a thin white dome running out round it, and the orange disc that lay on the ground under it is gone. The ball rises and slows, and by five seconds is an orange cap on a thin grey-brown stem. A white collar rings the stem for a few seconds. The cap cools to cream and lumpy cauliflower, three to four times as wide as the stem, and it stays up for over a minute; the old one was a dark brown disc that had thinned away inside twelve seconds. The dark dust that used to bury the whole base under the cloud is gone, and a low wall of dust runs out along the ground between the buildings instead. The missile's own trail is smoke in the same air now, a thick pale column behind it on the way up from the silo and on the way down, drifting with the wind and spreading as it thins, where it used to stay a column of flat sprites.
- Every other smoke goes the same way while it is on: missile and rocket trails, the dust behind a tank, a burning building's column, muzzle smoke. They are fed into one body of air round the camera instead of being drawn as sprites, and a unit moving through it pushes it. A tank's hull shoves the smoke aside and leaves a turning wake, a jet drags a sheet of it down between two wingtip vortices, and a helicopter hovering low flattens a burning column into a dark ring on the ground and lifts a band of dust round itself. A blast's front pushes the smoke already hanging round it outwards. Units you cannot see push nothing, so the smoke never gives away a stealthed tank or an unscouted base.
- Missile and rocket trails are thin ribbons of real smoke. A Tomahawk's, a Rocket Buggy's and a Scud Launcher's lay a pale line that breaks into puffs, widens towards its old end, stirs and drifts off with the wind, and is gone about as soon as the game's own trail would be, so a Rocket Buggy salvo no longer leaves a tan haze over the field: a Tomahawk's arc over Heartland Shield is gone about 3.5 s after the launch, where it hung on for 5 to 6 and the game's own lasts about 3. A trail that climbs high, a Scud's arc or the nine columns a Scud Storm puts up, goes into a second, taller body of air over the battlefield, a thousand units high, where it thins just as fast. The trails are lit by the sun like any smoke: the Scud Storm's columns had stood as straight glowing pillars of one width, and at night on Dark Night the trails stood out pale blue as if lit from inside. Before, a fast missile's trail broke into a dotted line of brown blobs, and once a missile climbed past about 200 units over the ground the top of its trail simply vanished.
diff --git a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
index 8d829d7aa..ccf87003f 100644
--- a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
+++ b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
@@ -6488,21 +6488,25 @@ End
; blast is laid on its hull); FX lists never name it, so with the setting Off EA's death is untouched.
; About 25, short-lived, spread over the hull rather than from one point, so the burst never reads
; as a starburst, and fast enough to leave the fan: slower and smaller they stayed inside the white
-; fire and could not be seen. Its name holds "Spark", which keeps the smoke volume from taking it.
+; fire and could not be seen, and at 2.6 to 4 across they were flecks easy to miss on a phone. Each
+; drags a short fading tail (ReforgedTankDeathSparkTail below), its own few points left behind it, so
+; it reads drawn out along its flight; no particle is linked to another, which is what a STREAK does.
+; Their names hold "Spark", which keeps the smoke volume from taking them.
ParticleSystem ReforgedTankDeathSparks
Priority = UNIT_DAMAGE_FX
IsOneShot = No
Shader = ADDITIVE
Type = PARTICLE
ParticleName = EXSpark02.tga
+ PerParticleAttachedSystem = ReforgedTankDeathSparkTail
AngleZ = 0.00 6.28
AngularRateZ = 0.00 0.00
AngularDamping = 0.00 0.00
VelocityDamping = 0.96 0.98
Gravity = -0.30
- Lifetime = 18.00 30.00
+ Lifetime = 20.00 32.00
SystemLifetime = 4
- Size = 2.60 4.00
+ Size = 4.50 6.50
StartSizeRate = 0.00 0.00
SizeRate = -0.04 -0.02
SizeRateDamping = 1.00 1.00
@@ -6528,9 +6532,9 @@ ParticleSystem ReforgedTankDeathSparks
InitialDelay = 0.00 0.00
DriftVelocity = X:0.00 Y:0.00 Z:0.00
VelocityType = ORTHO
- VelOrthoX = -4.00 4.00
- VelOrthoY = -4.00 4.00
- VelOrthoZ = 5.00 9.00
+ VelOrthoX = -5.50 5.50
+ VelOrthoY = -5.50 5.50
+ VelOrthoZ = 6.00 11.00
VolumeType = BOX
VolBoxHalfSize = X:11.00 Y:7.00 Z:3.00
IsHollow = No
@@ -6546,6 +6550,67 @@ ParticleSystem ReforgedTankDeathSparks
WindPingPongEndAngleMax = 6.283185
End
+; The tail one spark drags: a point every frame where the spark is, left standing and fading in a
+; sixth of a second, shrinking, so a spark reads as a short streak behind its head: the points start
+; about as wide as a spark moves in a frame (at 2.6 to 3.6 they read as a line of beads). It dies with
+; its spark (a per-particle system ends with the particle that carries it), and its own life of 33
+; frames, past the spark's 32, ends one a saved game restored without its spark.
+ParticleSystem ReforgedTankDeathSparkTail
+ Priority = UNIT_DAMAGE_FX
+ IsOneShot = No
+ Shader = ADDITIVE
+ Type = PARTICLE
+ ParticleName = EXSpark02.tga
+ AngleZ = 0.00 6.28
+ AngularRateZ = 0.00 0.00
+ AngularDamping = 0.00 0.00
+ VelocityDamping = 1.00 1.00
+ Gravity = 0.00
+ Lifetime = 4.00 5.00
+ SystemLifetime = 33
+ Size = 6.00 8.00
+ StartSizeRate = 0.00 0.00
+ SizeRate = -1.40 -1.10
+ SizeRateDamping = 1.00 1.00
+ Alpha1 = 0.00 0.00 0
+ Alpha2 = 0.00 0.00 0
+ Alpha3 = 0.00 0.00 0
+ Alpha4 = 0.00 0.00 0
+ Alpha5 = 0.00 0.00 0
+ Alpha6 = 0.00 0.00 0
+ Alpha7 = 0.00 0.00 0
+ Alpha8 = 0.00 0.00 0
+ Color1 = R:255 G:200 B:110 0
+ Color2 = R:200 G:90 B:25 3
+ Color3 = R:0 G:0 B:0 5
+ Color4 = R:0 G:0 B:0 0
+ Color5 = R:0 G:0 B:0 0
+ Color6 = R:0 G:0 B:0 0
+ Color7 = R:0 G:0 B:0 0
+ Color8 = R:0 G:0 B:0 0
+ ColorScale = 0.00 0.00
+ BurstDelay = 0.00 0.00
+ BurstCount = 1.00 1.00
+ InitialDelay = 0.00 0.00
+ DriftVelocity = X:0.00 Y:0.00 Z:0.00
+ VelocityType = ORTHO
+ VelOrthoX = 0.00 0.00
+ VelOrthoY = 0.00 0.00
+ VelOrthoZ = 0.00 0.00
+ VolumeType = POINT
+ IsHollow = No
+ IsGroundAligned = No
+ IsEmitAboveGroundOnly = No
+ IsParticleUpTowardsEmitter = No
+ WindMotion = Unused
+ WindAngleChangeMin = 0.149924
+ WindAngleChangeMax = 0.449946
+ WindPingPongStartAngleMin = 0.000000
+ WindPingPongStartAngleMax = 0.785398
+ WindPingPongEndAngleMin = 5.497787
+ WindPingPongEndAngleMax = 6.283185
+End
+
ParticleSystem ReforgedTankSmoke
Priority = DEATH_EXPLOSION
IsOneShot = No
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp
index 789b30d5f..81cf0a22f 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp
@@ -128,10 +128,10 @@ const float HeatHalfLife = 1.8f;
const float DustHalfLife = 6.0f;
const float CapSpillHalfLife = 1.0f; // a nuclear cap's soot once the flow has carried it out of the cap
const float StructureSootHalfLife = 3.0f; // a building's blast's soot: at 7 a fall's smoke was on screen for 14 s, stock's for 7 to 10
-// A tank's soot from 5 s on, once its column is falling: with its 10 s life it is gone from the play
+// A tank's soot from 5 s on, once its column is falling: its black column is gone from the play
// camera about 8 s after the death, as the game's billboard column (ReforgedTankSmoke, 1.5 s of
-// puffs living 5 to 6 s) is. It used to hang for half a minute; thinned from 3 s at 1.2 it was
-// gone in 4, sooner than the game's own.
+// puffs living 5 to 6 s) is, and only a thin smoulder is left to 13 s (the volume lives 15). It used
+// to hang for half a minute; thinned from 3 s at 1.2 it was gone in 4, sooner than the game's own.
const float TankSootThinFrom = 5.0f, TankSootHalfLife = 1.5f;
const float ShadeLight = 0.26f; // the light smoke keeps where the sun does not reach it
const float SunShare = 0.75f; // and what the sun adds where it does
@@ -1749,16 +1749,23 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)
// as well (pass 12) the lobes closed into a dark ring round the fire from the play camera;
// small and gone in half a second (pass 13) they hid behind the fire from the side.
// 22 a second at most and half as wide again by 1.2 s: at 45 and nearly twice as wide they
- // rolled into one black ball over the wreck from the play camera.
+ // rolled into one black ball over the wreck from the play camera. Each lobe wanders round
+ // its place and pushes the air it lays into a slow roll, at half that rate over a third more
+ // width: laid still and thick it saturated into a black cut-out with a hard edge, where thinner
+ // smoke keeps the march's billows inside it and a soft rim.
if (t < 1.8f) {
- const float fade = 1 - t / 1.8f, swell = 1 + 0.5f * (std::min)(t / 1.2f, 1.0f);
+ const float fade = 1 - t / 1.8f, swell = 1 + 0.7f * (std::min)(t / 1.2f, 1.0f);
for (unsigned k = 0; k < 4; ++k) {
// the inner pair waits for the jets to stop: laid in their roots it burned at their heat
if (!(k & 1) && t < 0.35f) continue;
- const float s = (k < 2 ? -1.0f : 1.0f) * ((k & 1) ? 1.05f : 0.7f) * (0.95f + 0.1f * unit(980 + k));
- const float across = ((k & 1) ? 0.3f : -0.3f) * W;
- onHull(s * L, across, H * (0.4f + 0.2f * unit(984 + k)), (std::max)(W * 0.9f, 2.6f) * swell,
- s * 2.5f * fade, across * 0.3f * fade, 0.8f, 22.0f * fade * fade, 0.3f, 2.0f * fade, 0.15f);
+ const float wander = 6.2831853f * unit(988 + k) + t * (2.0f + 1.5f * unit(992 + k));
+ const float s = (k < 2 ? -1.0f : 1.0f) * ((k & 1) ? 1.05f : 0.7f) * (0.95f + 0.1f * unit(980 + k))
+ + 0.12f * std::sin(wander);
+ const float across = ((k & 1) ? 0.3f : -0.3f) * W + 0.25f * W * std::cos(wander * 1.3f);
+ onHull(s * L, across, H * (0.4f + 0.2f * unit(984 + k)) + 0.6f * std::sin(wander * 0.7f),
+ (std::max)(W * 0.9f, 2.6f) * 1.3f * swell * (0.85f + 0.3f * unit(996 + k)),
+ s * 2.5f * fade + 3.0f * std::cos(wander), across * 0.3f * fade + 3.0f * std::sin(wander), 1.5f,
+ 11.0f * fade * fade, 0.3f, 2.0f * fade, 0.35f);
}
}
// Pale dust lifted along the ground on both sides of the hull, pushed out low, no ring.
@@ -1781,13 +1788,25 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)
12.0f, 1.7f, 2.0f, 0.3f);
}
// The hull burning: a black column off its whole length for about seven seconds, which with
- // the soot thinning (TankSootHalfLife) and the volume's 10 s life is gone about as soon as
+ // the soot thinning (TankSootHalfLife) is gone about as soon as
// the game's own billboard column (ReforgedTankSmoke). At half a minute it outlived the wreck.
if (t > 0.8f && t < 7.0f) {
const float rise = (std::min)((t - 0.8f) / 1.5f, 1.0f), fall = t > 4.0f ? 1 - (t - 4.0f) / 3.0f : 1.0f;
for (int end = -1; end <= 1; end += 2)
onHull(end * L * 0.45f, 0, 0.5f, (std::max)(W * 0.9f, 2.2f), 0, 0, 12.0f, 2.7f * rise * fall, 1.0f, 0.05f, 0.25f);
}
+ // Then the wreck smoulders: a thin grey wisp off one end and a glowing ember in the hull,
+ // flickering, to about 13.5 s, as faint as the game's own smoke with the setting Off is then.
+ // Cut at 7 s the column left a dead wreck straight after a big blast.
+ if (t > 6.0f && t < 13.5f) {
+ const float in = (std::min)((t - 6.0f) / 1.0f, 1.0f), out = t > 11.5f ? 1 - (t - 11.5f) / 2.0f : 1.0f;
+ // (at a tenth and a third of these the soot thinning took the wisp before it showed)
+ onHull(L * 0.35f, 0, 0.6f, (std::max)(W * 0.6f, 2.0f), 0, 0, 6.0f, 3.2f * in * out, 0.9f, 0.15f, 0.2f);
+ const float flicker = 0.5f + 0.5f * std::sin(t * 11.0f + 6.2831853f * unit(970)) * std::sin(t * 4.3f);
+ // the flicker in its size: heat holds the hottest it has seen for a while, so a flicker in
+ // heat read as a slow sag, and at 1.95 the ember burned as hot as a cook-off pop
+ onHull(-L * 0.2f, 0, H * 0.5f, 1.2f + 1.2f * flicker, 0, 0, 0.5f, 1.0f * in * out, 1.3f * in * out, 0, 0.05f);
+ }
} else if (volume.kind == Structure) {
// A building coming down, or blowing out a damaged stage, laid out on its own footprint the
// way a tank's cook-off is laid on its hull: `along` its long side, `across` it, `up` from
@@ -2876,14 +2895,21 @@ bool screenRect(const float boxLow[3], const float boxHigh[3], const float viewP
// How long each kind lives, in seconds, how big its cell is, how far and how long after its blast
// another system of the same FX joins it, and which of those it takes.
-float lifeOf(Kind kind) { return kind == TankDeath ? 10.0f : kind == Structure ? 12.0f : kind == Nuclear ? 90.0f : 12.0f; }
+float lifeOf(Kind kind) { return kind == TankDeath ? 15.0f : kind == Structure ? 12.0f : kind == Nuclear ? 90.0f : 12.0f; }
float cellOf(Kind kind, float scale) { return kind == TankDeath ? 3.0f : kind == Nuclear ? 10.0f : 2.0f * scale; }
float joinRadius(const Volume &volume)
{
if (volume.kind == Structure) return (std::max)(volume.hull[2], volume.hull[3]) * volume.cell + 40.0f;
return volume.kind == Nuclear ? 500.0f : volume.kind == TankDeath ? 60.0f : 30.0f * volume.scale;
}
-int rankOf(const Volume &volume) { return volume.kind == TankDeath || volume.kind == Structure ? 2 : volume.scale >= 2.0f ? 1 : 0; }
+// A tank's volume past 7 s holds only its smoulder, so it gives its slab up before any new blast does.
+int rankOf(const Volume &volume)
+{
+ if (volume.kind == TankDeath && volume.live && TheGameLogic
+ && (int)TheGameLogic->getFrame() - volume.born > 7 * LOGICFRAMES_PER_SECOND)
+ return -1;
+ return volume.kind == TankDeath || volume.kind == Structure ? 2 : volume.scale >= 2.0f ? 1 : 0;
+}
// The structure Gather saw, this read or the one before: the one named, or with none named the one
// whose middle `where` is (a death FX goes off at the building's own position; a footprint test