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 fall shards hidden, thin debris dust

Olcay Seyganfb21cb745a97
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2f2070070..690f6bfa1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -117,7 +117,7 @@ found and fixed, EA's own, not port damage.**
- 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 fades out along its length as it goes, the oldest end first, so a Rocket Buggy salvo no longer leaves a tan haze over the field: a Tomahawk's arc over Heartland Shield is gone about 2 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 that read as beams of light, and at night on Dark Night the trails stood out pale blue as if lit from inside. Now a big missile, a Scud's, a Tomahawk's or the nuclear missile's, leaves a white plume that billows out wider as it ages, lumpy and shaded on its far side, while a Rocket Buggy's, a Stinger's or a Comanche's rocket leaves a thin grey trail. Every one burns at the nozzle, a short white-yellow flame that is gone a few frames behind the missile. A launch throws a cloud: a Scud Storm, a Scud Launcher, a Tomahawk launcher and the nuclear silo blow a white cloud out sideways over the pad and the ground round it, under a flash at the nozzle, and it is gone in about four seconds. A rocket's backblast leaves a white puff at the launcher, where before it was gone before it showed. 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, a white-yellow fireball bursts out of each of its parts, a War Factory's hall and its two stacks, a Speaker Tower's mast, bigger than the part it came from and pushed out through its walls, cools to orange under a sooty edge and is gone in well under a second, while a ragged plume climbs out of the tops and cools to smoke. Before, the parts filled with dull dust that slumped and only three small fires came off the roof. The chunks the building throws trail pale dust as they fly, where they used to fly bare; with the smoke Off they stay as they were. The collapse throws a pale dust cloud that rolls out along the ground on every side, heavier than the air and hugging the terrain, two to three times the building's width out before it thins, and runs round the buildings beside it, between their real walls and stacks rather than over one box. Before, the dust had nowhere to go but up, and a fall was only a column. The ruin burns under a thick black-grey column with the fire still glowing in its foot, where it used to be a thin pale wisp, for two seconds, so a fall's own smoke and dust are off the screen 3 to 4 s after it and only the game's own column is left in the air until about 6, sooner than the game's own at 7 to 8 (it stayed for fourteen at first, and in a fast game that hid the next fight); a damaged building's own smoke and the dust round it thin within a couple of seconds of their puffs. 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. A Rocket Buggy's rockets hitting the rubble throw their dirt for a second and it falls back, where their brown fountains stood beside a fallen War Factory as tan fingers for six seconds after everything else had gone. 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.
+- Buildings come down in their own shape. The smoke reads the building's model: the moment one dies, a white-yellow fireball bursts out of each of its parts, a War Factory's hall and its two stacks, a Speaker Tower's mast, bigger than the part it came from and pushed out through its walls, cools to orange under a sooty edge and is gone in well under a second, while a ragged plume climbs out of the tops and cools to smoke. Before, the parts filled with dull dust that slumped and only three small fires came off the roof. The chunks the building throws trail thin pale dust as they fly, gone before the column is, where they used to fly bare, and the white shower of shards that burst over the fall like a firework is gone while the smoke draws it; with the smoke Off both stay as they were. The collapse throws a pale dust cloud that rolls out along the ground on every side, heavier than the air and hugging the terrain, two to three times the building's width out before it thins, and runs round the buildings beside it, between their real walls and stacks rather than over one box. Before, the dust had nowhere to go but up, and a fall was only a column. The ruin burns under a thick black-grey column with the fire still glowing in its foot, where it used to be a thin pale wisp, for two seconds, so a fall's own smoke and dust are off the screen 3 to 4 s after it and only the game's own column is left in the air until about 6, sooner than the game's own at 7 to 8 (it stayed for fourteen at first, and in a fast game that hid the next fight); a damaged building's own smoke and the dust round it thin within a couple of seconds of their puffs. 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. A Rocket Buggy's rockets hitting the rubble throw their dirt for a second and it falls back, where their brown fountains stood beside a fallen War Factory as tan fingers for six seconds after everything else had gone. 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.
- Burning buildings burn. A damaged building's fires are flames in that same air now, where they were flat sprites: each burning spot gives off fuel off the building's own roof and wall tops, read from its model, at the heat the game's own flame there stands for, so the flames stand on the building instead of hanging over it; the fuel comes off in patches and lights, burns hottest on its outside where the air reaches it, rises on its own heat and leans with the wind. The flame glows the colour hot soot glows, yellow-white at its foot where it burns hottest and orange to dull red higher up, where it breaks into licks with clear air between them, and it puffs the way a real fire puffs, a wide one slower than a small one. The fuel a flame carries past its tips is too cool to burn by then and turns into near-black smoke, which climbs off the building and thins away in about three seconds; while it does, the game's own smoke on that building stands aside. The building's own floors and roofs are what the flames stand on, so a GLA barracks, whose outline is one big box over its tents, no longer smothers all but one of its fires. Units push it like any smoke: a helicopter hovering over a burning factory fans its flames down and out. It goes out within two seconds of the game's own fire, so a repaired building stops burning and a fire never outlasts the building's damage. Fires on the move, a burning tank driving off or a running soldier, keep the game's own flames, and so do sparks, embers and a burning car wreck, whose flame the first version had put out altogether. Eight burning buildings on Twilight Flame's plateau cost 0.4 ms of GPU time a frame on Low and 1.0 on High over the smoke alone, on an RTX 2060.
- 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.
diff --git a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
index aaa684635..5f3d69452 100644
--- a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
+++ b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
@@ -6991,36 +6991,38 @@ End
; A fallen building's flying debris (GenericDebris out of OCL_LargeStructureDebris and the rest) trails
; pale dust, as in the building explosion photos, where the game's own chunks fly bare. Hung on each
; chunk by the smoke simulation (DX11VolumeSmoke.cpp, attachDebrisDust) only while that setting is on,
-; so Off keeps the game's own look and no logic file changes. A grey-tan ribbon that widens and is gone
-; in under a second; the system stops after a second and a half, the chunk's flight.
+; so Off keeps the game's own look and no logic file changes. A thin pale ribbon that is gone in under
+; half a second; the system stops after eight tenths, so a War Factory's trails are gone before its
+; column. (In EXJetSmoke, 2.6 wide and widening, 0.8 s, a STREAK tiles its texture once a link and the
+; trails read as fuzzy brown blobs that outlasted the column; EXContrail reads as a line.)
ParticleSystem ReforgedStructureDebrisDust
Priority = WEAPON_EXPLOSION
IsOneShot = No
Shader = ALPHA
Type = STREAK
- ParticleName = EXJetSmoke.tga
+ ParticleName = EXContrail.tga
AngleZ = 0.00 0.00
AngularRateZ = 0.00 0.00
AngularDamping = 1.00 1.00
VelocityDamping = 0.95 0.95
Gravity = 0.00
- Lifetime = 24.00 24.00
- SystemLifetime = 45
- Size = 2.60 2.60
+ Lifetime = 12.00 12.00
+ SystemLifetime = 24
+ Size = 0.90 0.90
StartSizeRate = 0.00 0.00
- SizeRate = 0.25 0.25
+ SizeRate = 0.06 0.06
SizeRateDamping = 0.95 0.95
Alpha1 = 0.00 0.00 0
- Alpha2 = 0.55 0.55 2
- Alpha3 = 0.25 0.25 12
- Alpha4 = 0.00 0.00 24
+ Alpha2 = 0.45 0.45 2
+ Alpha3 = 0.20 0.20 7
+ Alpha4 = 0.00 0.00 12
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:150 G:140 B:125 0
- Color2 = R:175 G:166 B:152 12
+ Color1 = R:205 G:198 B:186 0
+ Color2 = R:225 G:220 B:212 7
Color3 = R:0 G:0 B:0 0
Color4 = R:0 G:0 B:0 0
Color5 = R:0 G:0 B:0 0
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp
index 7006545ea..0835032a3 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp
@@ -4509,6 +4509,24 @@ bool Takes(ParticleSystem *system)
const bool structFlat = flat && structural;
// a tank gun's FX go to its shot's volume, its flat ring on the ground (TankMuzzleWave) too
const bool gun = tankMuzzle(own), gunFlat = flat && gun;
+ // A building's fall's white shard burst (ReforgedBlastShards* and the puffs on each shard) stood
+ // over its fireball as a firework of fuzzy dots: hidden for a fall the volume draws, while it is
+ // young and beside it. Elsewhere, a tank's say, the shards keep their look.
+ if (std::strstr(own, "BlastShard") && TheGameLogic) {
+ Coord3D where;
+ system->getPosition(&where);
+ if (Particle *first = system->getFirstParticle()) where = *first->getPosition();
+ const int now = (int)TheGameLogic->getFrame();
+ for (const Volume &volume : volumes) {
+ if (!volume.live || volume.kind != Structure || volume.standing || now - volume.born > (int)(1.5f * LOGICFRAMES_PER_SECOND)) continue;
+ const float dx = where.x - (volume.origin[0] + (volume.blast[0] + 0.5f) * volume.cell);
+ const float dy = where.y - (volume.origin[1] + (volume.blast[1] + 0.5f) * volume.cell);
+ if (dx * dx + dy * dy > joinRadius(volume) * joinRadius(volume)) continue;
+ pruneSets();
+ takenSystems.insert(id);
+ return true;
+ }
+ }
if (!loose || (flat && system->getPriority() != DEATH_EXPLOSION && !nukeFlat && !structFlat && !gunFlat)) return takeAir(system);
// flying bits stay the game's own here too: a blast that took them drew nothing in their place
if (airLookOf(system->getTemplate(), system).scrap && !gun) return false;
@@ -4615,6 +4633,7 @@ bool Takes(ParticleSystem *system)
slot = i;
++droppedCount;
if (rankOf(volumes[slot]) > rank) {
+ if (type == Structure) DEBUG_LOG(("VOLSMOKE: frame %d, a structure's blast dropped: every slab held a higher rank\n", now));
pruneSets();
takenSystems.insert(id);
return true;
@@ -4704,7 +4723,7 @@ bool Takes(ParticleSystem *system)
&& now - other.born <= 2)
other.live = false;
static unsigned structuresLogged = 0;
- if (structuresLogged++ < 24)
+ if (structuresLogged++ < 24 || !volume.standing) // every fall, so a film can tell a missed one
DEBUG_LOG(("VOLSMOKE: frame %d, structure %s for '%s', %.0f by %.0f by %.0f units at %.1f a cell, %s, %u meshes, the first %.0f by %.0f, %.0f to %.0f up\n", now,
building ? "found" : "not found", own, volume.hull[2] * 2 * cell, volume.hull[3] * 2 * cell, volume.hull[4] * cell, cell,
volume.standing ? "a damaged stage" : "its fall", volume.partCount,