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 building and trail smoke as short as stock

Olcay Seyganebe2518c18c9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fc110ae1e..edf64bdde 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -115,8 +115,8 @@ found and fixed, EA's own, not port damage.**
- 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 at both ends of the hull while the fan burns. 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 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 a couple of seconds after the missile, so a Rocket Buggy salvo no longer leaves a tan haze over the field. 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 hangs on longer as rocket smoke does. 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.
-- Buildings come down in their own shape. The smoke reads the building's model: the moment one dies, smoke and dust fill each of its parts where it stood, a War Factory's hall and its two stacks, a Speaker Tower's mast, and slump down, while fire bursts out of the tops of the biggest parts and a ragged plume climbs out of them and cools to smoke. Pale dust pours out from under every wall along the ground and runs round the buildings beside it, between their real walls and stacks rather than over one box, and the ruin burns under a grey-brown column for fifteen seconds. The size follows the building: an American Power Plant's is about half the width of a War Factory's or a Particle Cannon's. Each damaged stage on the way down blows fire out of the top of the standing building with a little smoke, where it used to leave a big black cloud over the roof, and the shells landing on it in that moment no longer leave their fireballs floating over the cloud. The fall's smoke is lit on its sunny side: on Winter Wolf's snow it had stood as one block of pure black across the middle of the screen. The game's own fireball sprites, flare and flat shock ring for that moment are gone while the smoke is on; flying debris keeps its sparks.
+- 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.
+- Buildings come down in their own shape. The smoke reads the building's model: the moment one dies, smoke and dust fill each of its parts where it stood, a War Factory's hall and its two stacks, a Speaker Tower's mast, and slump down, while fire bursts out of the tops of the biggest parts and a ragged plume climbs out of them and cools to smoke. Pale dust pours out from under every wall along the ground and runs round the buildings beside it, between their real walls and stacks rather than over one box, and the ruin burns under a grey-brown column for seven seconds, so a fall's smoke is off the screen about when the game's own is (it stayed for fourteen, and in a fast game that hid the next fight); a damaged building's own smoke also thins as quickly as its puffs do. The size follows the building: an American Power Plant's is about half the width of a War Factory's or a Particle Cannon's. Each damaged stage on the way down blows fire out of the top of the standing building with a little smoke, where it used to leave a big black cloud over the roof, and the shells landing on it in that moment no longer leave their fireballs floating over the cloud. The fall's smoke is lit on its sunny side: on Winter Wolf's snow it had stood as one block of pure black across the middle of the screen. The game's own fireball sprites, flare and flat shock ring for that moment are gone while the smoke is on; flying debris keeps its sparks.
- It costs the graphics card. Three armies and three superweapons on Twilight Flame at 1920x1080, on an RTX 2060: 5.2 ms of GPU time a frame with it Off, 8.6 on Low and 10.0 to 10.2 on High; the frame itself took 5.3, 5.6 and 6.9 to 7.2 ms. Low runs half as many blasts at once in a coarser body of air, so a weak card should leave it Off or take Low. A nuke on an American base on the same map costs 2.4 ms of GPU time a frame Off, 4.1 to 4.7 on Low and 6.9 to 7.1 on High. A rocket fight with Scud Launchers, then a Scud Storm and a nuke, seen from over the rockets: 2.2 ms Off, 3.1 on Low, 4.1 to 4.2 on High. Five buildings brought down one after another on that base: 1.3 ms Off, 1.9 to 2.0 on Low, 2.2 on High.
## A rank ladder for every army
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp
index 44b9dd092..fd59c8356 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp
@@ -24,7 +24,7 @@
// Gather, and sized by them: each mesh fills with smoke and dust in its own place and slumps, fire
// bursts out of the tops of the biggest, a ragged plume climbs out of them and cools to grey-brown
// smoke, the collapse pours pale dust out from under every wall along the ground and round the
-// buildings beside it, and the ruin burns under a column for fifteen seconds. A damaged stage
+// buildings beside it, and the ruin burns under a column for seven seconds. A damaged stage
// blows fire out of the top of a building that stays standing.
//
// A nuclear-class blast (the missile, the GLA's, the MOAB) has a volume of its own, much bigger:
@@ -127,7 +127,7 @@ const float VelocityHalfLife = 3.0f;
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 = 7.0f; // a building's blast's soot, as the air's
+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
// 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
@@ -1005,7 +1005,9 @@ const AirShape AirShapes[3] = { { 8, 8, 8, 1.0f, 0, 0, 1.0f }, { 96, 96, 24, 12.
{ 160, 160, 40, 7.2f, 12288, 8, 1.25f } };
const unsigned AirTileEntries = 27; // brick list room a particle: a sphere of at most 8 cells reaches 27
const float AirExtinction = 0.04f; // per world unit at density 1: the air's smoke is thinner than a blast's
-const float AirSootHalfLife = 7.0f; // seconds, once no particle holds it up
+// seconds, once no particle holds it up: a damaged building's SmokeFaction* puffs live 2 to 5.3 s
+// and StructureDamagedSmoke's 1.5 s, and at 7 the air kept them on screen for twice as long again
+const float AirSootHalfLife = 3.0f;
const float AirTakeUp = 8.0f; // a second: how fast the cells under a particle reach its smoke
const float AirCoverage = 0.7f; // a billboard's opacity at its centre, against its alpha
// A sphere's falloff, the trilinear blur of a few cells and the noise take most of the opacity a
@@ -1023,7 +1025,11 @@ const float StreakGain[2] = { 0.45f, 0.75f };
const float TrailBright = 1.7f;
// A trail's smoke half-life in the air and the tall air (the brightness tells its cells): a Rocket
// Buggy salvo's goes in a couple of seconds, a Scud Storm's columns hang on as rocket smoke does.
-const float TrailHalfLife[2] = { 2.5f, 3.0f }; // (at 6 a Tomahawk's arc over Heartland Shield hung on for ten seconds)
+// (a Tomahawk's and a Scud's jet smoke lives 2 s, a Rocket Buggy's 1.2 s, so at 3 a Tomahawk's arc
+// over Heartland Shield was on screen for 5 to 6 s where stock's is gone in 3; a cell holds what its
+// particle laid while it lives, so the half-life is what follows the particle's 2 s: at 1.5 the arc
+// still showed 4.5 s after the launch)
+const float TrailHalfLife[2] = { 0.8f, 0.8f };
// A trail's particle stands for more smoke the older it is, spread wider: the end of a column
// farthest from the missile is up to this much wider than its head, so it opens out as it ages.
const float TrailSpread = 1.5f;
@@ -1902,16 +1908,16 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)
14.0f * fade * pour, 0.35f);
}
}
- // The ruin burning: a column for fifteen seconds off the ground its two biggest meshes stood
- // on, leaning with the wind. A blast's smoke does not thin by itself, so at the old rate a
- // War Factory's column had grown into a black wall across the middle of the frame by the
- // next building's death.
- if (!standing && t > 0.8f && t < 16.0f) {
- const float rise = (std::min)((t - 0.8f) / 1.5f, 1.0f), fall = t > 6.0f ? 1 - (t - 6.0f) / 10.0f : 1.0f;
+ // The ruin burning: a column off the ground its two biggest meshes stood on, leaning with the
+ // wind, done by 7.5 s, as the stock building smoke is (StructureTransition*Smoke lives 6.7 s,
+ // ReforgedStructureSmoke 7.3 to 8.7 s): the game is fast, and a column that hung on for
+ // fifteen seconds hid the next fight. Its fire goes out with it.
+ if (!standing && t > 0.8f && t < 7.5f) {
+ const float rise = (std::min)((t - 0.8f) / 1.5f, 1.0f), fall = t > 3.0f ? 1 - (t - 3.0f) / 4.5f : 1.0f;
for (unsigned i = 0; i < (std::min)(partCount, 2u); ++i) {
const Part &p = parts[big[i]];
onFootprint(p.along, p.across, 0.6f, (std::max)((std::min)(p.halfAlong, p.halfAcross) * 0.6f, 2.0f), 0, 0, 12.0f,
- 0.8f * rise * fall * (i ? 0.6f : 1.0f), 1.0f, 0.1f, 0.25f);
+ 0.8f * rise * fall * (i ? 0.6f : 1.0f), fall, 0.1f, 0.25f);
}
}
soot[3] = 1.6f + 2.4f * std::exp(-t / 0.3f);
@@ -2858,7 +2864,7 @@ 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 ? 24.0f : kind == Nuclear ? 90.0f : 12.0f; }
+float lifeOf(Kind kind) { return kind == TankDeath ? 10.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)
{
@@ -3153,7 +3159,7 @@ bool Takes(ParticleSystem *system)
volume.partCount ? volume.parts[0].bottom * cell : 0.0f, volume.partCount ? volume.parts[0].top * cell : 0.0f));
}
volume.born = now;
- volume.life = int((type == Structure && volume.standing ? 14.0f : lifeOf(type)) * LOGICFRAMES_PER_SECOND);
+ volume.life = int((type == Structure && volume.standing ? 8.0f : lifeOf(type)) * LOGICFRAMES_PER_SECOND);
// its front through the air round it, in world units a second. A tank's has none: a sphere
// pushing out from the hull's middle blew its own fire into a dome and the dust round it into
// rings, where a real one bursts out along the hull and up (schedule).