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.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(w3ddevice): -volsmoke tank death sparks streak, dark masses at base
Olcay Seygan56fdc05797e9
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b36fdb95a..6cb930b6d 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 half a second after the flash, while hot sparks streak up out of the fire in long thin lines and fall back. The wreck's black column is gone about two seconds after the death, and a thin wisp over a glowing ember fades out by three and a half, a quarter as long as the game's own smoke with the setting Off, so a fast game is never fighting through last minute's smoke; 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 every gun but a tank's keeps the soft grey muzzle puff it always had, 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. 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 masses bank up on both long sides of the hull at its top, in front of the fire, with flame showing between them, and slump away inside a second; the soot laid there before burned with the fire beside it and from the side read as a haze. Hot sparks streak up out of the fire and out over the fan in long thin straight lines and fall back, where they were short beaded comets. The wreck's black column is gone about two seconds after the death, and a thin wisp over a glowing ember fades out by three and a half, a quarter as long as the game's own smoke with the setting Off, so a fast game is never fighting through last minute's smoke; 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 every gun but a tank's keeps the soft grey muzzle puff it always had, where it had turned into a flat tan disc on the ground.- A tank gun fires the way footage of a real one does. A cone of flame comes straight out of the muzzle along the barrel's own aim, white-hot at the tip and orange-red at its fringe, widening forward, and is gone in about a sixth of a second; the first version blew a round ball a gun's length ahead of the barrel with a gap behind it. It leaves a little grey smoke in front of the gun over the dust the blast blows off the ground round the tank's front, and both are gone in a second and a half. A Battlemaster's or a Scorpion's smaller gun throws a smaller flame, an Overlord's a bigger one. A shell striking armour throws one dense burst of thin white-yellow streaks out of the point it struck, over a hot white core, back towards the tank that fired it. The game's own sparks used to burst over the turret whichever side was struck, and stacked on the new ones they read as fireworks all over the tank: for those hits they are gone, and the white oval that used to flash over the whole tank is a small flash now. In a fight of fifteen tanks the shots and hits cost about 0.2 ms of GPU time a frame on High and next to nothing on Low, on an RTX 2060. Six shots at a time draw this way on High and three on Low; past that a shot keeps the game's own flash, and a shot whose slab a bigger blast takes gets its own flash back.- 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.diff --git a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.iniindex 8336a122a..531fa4467 100644--- a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini+++ b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini@@ -6488,16 +6488,16 @@ 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, 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.+; fire and could not be seen. Each spark is a small soft dot dragging a long tail of its own+; (ReforgedTankDeathSparkTail below), so it flies as one long thin straight line; drawn with EA's+; spark texture, a starburst, at 4.5 to 6.5 across, each read as a little star at the head of a+; comet. Their names hold "Spark", which keeps the smoke volume from taking them.ParticleSystem ReforgedTankDeathSparksPriority = UNIT_DAMAGE_FXIsOneShot = NoShader = ADDITIVEType = PARTICLE- ParticleName = EXSpark02.tga+ ParticleName = EXFuzzyDot.tgaPerParticleAttachedSystem = ReforgedTankDeathSparkTailAngleZ = 0.00 6.28AngularRateZ = 0.00 0.00@@ -6506,9 +6506,9 @@ ParticleSystem ReforgedTankDeathSparksGravity = -0.30Lifetime = 20.00 32.00SystemLifetime = 4- Size = 4.50 6.50+ Size = 2.00 2.60StartSizeRate = 0.00 0.00- SizeRate = -0.04 -0.02+ SizeRate = -0.03 -0.02SizeRateDamping = 1.00 1.00Alpha1 = 0.00 0.00 0Alpha2 = 0.00 0.00 0@@ -6550,33 +6550,32 @@ ParticleSystem ReforgedTankDeathSparksWindPingPongEndAngleMax = 6.283185End-; The tail one spark drags: a point every frame where the spark is, left standing and fading over-; 0.4 s while it shrinks to nothing, so a spark reads as a thin straight streak, widest at its head-; and tapering behind it. The points start wider than a spark moves in a frame (6 to 13 units), so-; near the head they overlap into a line (at 2.6 to 3.6, and at 4.2 to 5.2 over this life, they read-; as a line of beads); a life of 4 or 5 frames left a short comet where the footage has long-; streaks. A point a frame is the finest the per-particle system gives, so the far end still beads-; a little where the points have shrunk. 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. Its points rank as-; debris trails, so at the particle cap the tails give way before other effects do (about 300 points-; a tank).+; The tail one spark drags: a point every frame where the spark is, joined into one thin ribbon of its+; own points (a STREAK that links nothing but them), standing and fading over 0.45 s while it tapers+; to nothing, so a spark reads as a long thin straight streak, widest at its head. It wears the+; missiles' contrail texture: a ribbon tiles its texture once a link, and a soft dot there beaded it+; just as loose points do. Loose points read+; as a line of beads wherever the spark outran their width, and as a short comet with EA's spark+; texture at 7 to 8 across (pass 17). 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. Its points rank as debris trails, so at the particle cap the tails+; give way before other effects do (about 300 points a tank). Each tail is one line draw.ParticleSystem ReforgedTankDeathSparkTailPriority = DEBRIS_TRAILIsOneShot = NoShader = ADDITIVE- Type = PARTICLE- ParticleName = EXSpark02.tga+ Type = STREAK+ ParticleName = EXContrail.tgaAngleZ = 0.00 6.28AngularRateZ = 0.00 0.00AngularDamping = 0.00 0.00VelocityDamping = 1.00 1.00Gravity = 0.00- Lifetime = 11.00 13.00+ Lifetime = 13.00 14.00SystemLifetime = 33- Size = 7.00 8.00+ Size = 1.40 1.70StartSizeRate = 0.00 0.00- SizeRate = -0.53 -0.50+ SizeRate = -0.10 -0.10SizeRateDamping = 1.00 1.00Alpha1 = 0.00 0.00 0Alpha2 = 0.00 0.00 0@@ -6686,7 +6685,8 @@ ParticleSystem ReforgedTankHitSparksEnd; A hit spark's tail: a point a frame left where the spark is, joined into one thin ribbon (a STREAK-; of its own points only), tapering to nothing over 0.13 s, so the spark reads as a bright line. Loose+; of its own points only, in the missiles' contrail texture: a soft dot tiled once a link beaded it),+; tapering to nothing over 0.13 s, so the spark reads as a bright line. Loose; points read as dots wherever the spark outran their width, as stars at 4 units with EA's spark; texture. Its life of 9 frames, past the spark's 8, ends one a saved game restored without its spark.ParticleSystem ReforgedTankHitSparkTail@@ -6694,7 +6694,7 @@ ParticleSystem ReforgedTankHitSparkTailIsOneShot = NoShader = ADDITIVEType = STREAK- ParticleName = EXFuzzyDot.tga+ ParticleName = EXContrail.tgaAngleZ = 0.00 6.28AngularRateZ = 0.00 0.00AngularDamping = 0.00 0.00diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cppindex c0ea8fa97..c97639fb4 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp@@ -7,8 +7,8 @@//// A tank's death is an ammunition cook-off, laid out on the dying hull's own box (its template's// length, width and height and its heading, read from the drawable). Orange flame and black soot-// burst out low along the hull and roll along the ground off both ends over a skirt of pale dust,-// a ragged plume of fire, white in the middle and orange at its edges, fans up out of the hull+// burst out low along the hull and roll along the ground off both ends between near-black masses+// banked on its long flanks, a ragged plume of fire, white in the middle and orange at its edges, fans up out of the hull// top in thirteen jets, the middle one tallest, on High twice as high as the band is long, and// cools to grey-brown smoke, two to four// smaller pops follow over a few seconds, and then the hull burns: a thick black column for half@@ -109,7 +109,7 @@ struct TierShape { unsigned gx, gy, gz, slabs, first; };TierShape TierShapes[3] = { { 48, 48, 40, 24, 0 }, { 96, 96, 80, 2, 24 }, { 32, 32, 48, 12, 26 } };const unsigned MaxVolumes = 38; // all three tiers' slabs at High, the small tier's first, the fires' lastconst unsigned MaxSlabs = 24; // the constant arrays' length, the same in both tiers-const unsigned MaxPuffs = 28; // a tank's 28 (base, jets, stem, soot, skirt); PUFFS in the HLSL is the same+const unsigned MaxPuffs = 28; // a tank's 24 (base, jets, stem, dark base masses); PUFFS in the HLSL is the sameconst unsigned MaxMovers = 16; // High's; Low takes the nearest 8const unsigned NoiseSide = 32;@@ -151,7 +151,7 @@ const float GroundDustHalfLife = 0.38f, GroundRollHalfLife = 1.5f;// slumps and spreads as a gravity current (about 5 cells/s two cells deep at 10; at 20 it lay as a// flat sheet), and a shell's thrown dirt falls back out of the air; at the shared 1 a Rocket Buggy's// dirt fountains stood beside a fallen War Factory as tan fingers for ten seconds.-const float RollWeight = 10.0f, DirtWeight = 30.0f;+const float RollWeight = 10.0f, DirtWeight = 30.0f, TankMassWeight = 0.2f;const float CapSpillHalfLife = 1.0f; // a nuclear cap's soot once the flow has carried it out of the capconst float StructureSootHalfLife = 0.75f; // a building's blast's soot: at 7 a fall's smoke was on screen for 14 s, at 3 for 7 to 10, at 1.5 for 5 to 6// A tank's soot from 1.25 s on, once its column is falling: its black column is gone from the play@@ -2314,7 +2314,12 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)hx * va - hy * vc, hy * va + hx * vc, vz, sootRate, heat, dustRate, push });};auto unit = [&](unsigned salt) { return hashUnit(volume.seed, salt); };- dust[0] = 0.70f; dust[1] = 0.62f; dust[2] = 0.50f; // sunlit, fire-lit dust, warm against the tan ground+ // The dust channel carries the near-black soot masses at the base (below): it never glows (the+ // march lights fire by the soot's share of a cell alone), so laid beside the fire it stays a+ // dark mass in front of it, where soot laid there burned with the fire's heat and read as haze.+ // So the tank's dust is dark brown-black; what dust the jets and the base band carry darkens+ // with it. (Pale, 0.70/0.62/0.50, it was the sunlit skirt of passes 6-17.)+ dust[0] = 0.10f; dust[1] = 0.085f; dust[2] = 0.075f;// The base: orange flame and black soot bursting out low along the whole hull, rolling off// both ends and a little to the sides, held down by the dust in it. The four towards the// ends do not glow (heat 0.5, where fireColour starts), so the hot middle sits between dark@@ -2346,7 +2351,7 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)const float reach = (std::min)((std::max)(2.2f * (2.3f * L + 1.7f * W), 12.0f), TierShapes[0].gz - 20.0f);// an odd count, so one jet stands straight up the middle: with fourteen the two middle ones// leaned apart and notched the top into a heart- const unsigned jets = 13; // with the base, the stem, the soot and the skirt, the 28 a slab holds+ const unsigned jets = 13; // with the base, the stem and the four dark base masses, 24 of the 28 a slab holds// A shorter reach (Low's, or a very small hull's on High) fans a short hull's rays less and// from less of its length, so its fan is as tall for its width as High's: at High's angles// Low's came out a round dome. Long hulls do not use it.@@ -2470,45 +2475,27 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)// the default 1.6 once the flare is over; about a third of a second of white, as long as// the jets run, and no longer, so several tanks dying at once do not white out the viewsoot[3] = 1.6f + 4.2f * std::exp(-t / 0.22f);- // Dark soot banked on the hull: four big lobes lying low along its length, two over each- // half from the jets' roots out past the end, which the base fire edges red, so the bright- // core stands between near-black masses as in the photo and the fan's top stays clear of- // them. They swell for nearly a second, past the flash, and the column takes over. Heat- // 0.3 does not glow at all (fireColour starts at 0.5). Heat is the hottest emitter's, so laid- // inside the jets' roots the soot burned as bright as they did; laid round the hull's sides- // 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. Laid at- // 0.75 to 1 of the hull's height, over the base band's glow, with no dust in them (dust is lit- // pale): lower and dusty they glowed inside the band and read as haze from the side.- // 22 a second at most and half as wide again by 0.6 s: at 45 and nearly twice as wide they- // 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.- // (halved a second time to 0.48 s, at the owner's word: a fast game)- if (t < 0.48f) {- const float fade = 1 - t / 0.48f, swell = 1 + 0.7f * (std::min)(t / 0.3f, 1.0f);+ // Near-black masses banked at the base, as in the photo, in front of the fire with flame+ // showing between them: two on each long flank near the middle, thick (opaque in a few cells)+ // and laid in the dust channel, which never glows, so the base band's heat beside them does+ // not light them. Soot lobes (passes 12-17) burned with whatever heat they sat in and read as+ // haze from the side, wherever along the hull they were put. Two a side and off the ends, no+ // ring from the play camera (round the whole hull, pass 12, they closed into one). Pushed out+ // slowly, swelling by half, gone in about a second: heavy, they slump onto the ground, which+ // eats the dust lying on it (GroundDustHalfLife).+ // (at 70 a second over a hull and a half for 0.85 s they closed round the wreck into a black+ // ring from the play camera and lay on as a dark disc)+ if (t > 0.05f && t < 0.75f) {+ const float fade = 1 - (t - 0.05f) / 0.7f, swell = 1 + 0.4f * (std::min)(t / 0.4f, 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.25f) continue;+ const float s = (k < 2 ? -0.35f : 0.35f) * (0.85f + 0.3f * unit(980 + k)), side = (k & 1) ? 1.0f : -1.0f;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.75f + 0.25f * 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, 0.0f, 0.35f);- }- }- // Pale dust lifted along the ground on both sides of the hull, pushed out low, no ring. From- // a third of a second, once the soot lobes stand: lifted at once it veiled them from the side.- if (t > 0.3f && t < 1.2f) {- const float fade = 1 - (t - 0.3f) / 0.9f;- for (unsigned k = 0; k < 4; ++k) {- const float s = k < 2 ? -0.7f : 0.7f, side = (k & 1) ? 1.0f : -1.0f;- onHull(s * L * (1.0f + 0.4f * unit(960 + k)), side * W * 1.1f, 0.5f, (std::max)(W * 0.9f, 2.5f),- s * 4.0f * fade, side * 6.0f * fade, 0.5f, 0, 0, 10.0f * fade, 0.3f);+ // (at 0.4 and at 0.75 to 0.95 of the hull's height they lay black on the black hull's side+ // and did not show from the side: the photo's stand against the flame, so these stand at+ // the hull's top, in front of the fan's foot)+ onHull(s * L, side * W * (1.0f + 0.1f * unit(984 + k)), H * (1.0f + 0.2f * unit(986 + k)) + 0.3f * std::sin(wander),+ (std::max)(W * 0.8f, 2.4f) * swell * (0.85f + 0.3f * unit(996 + k)),+ s * 2.0f * fade + 1.5f * std::cos(wander), side * 2.0f * fade, 0.8f, 0, 0.3f, 45.0f * fade * fade, 0.3f);}}// the cook-off pops, two to four, each a hot orange puff out of a hatch somewhere on the hull@@ -3117,7 +3104,10 @@ void step(ID3D11DeviceContext *context, unsigned t, int now, float dt, float secsim.Thin[slab][0] = std::pow(0.5f, dt / TankSootHalfLife);const bool rolls = (volume.kind == Structure && !volume.standing) || volume.kind == Launch || volume.kind == Muzzle;// (not a bomb's: its small mushroom's stem would fall out of it)- sim.Thin[slab][1] = rolls ? RollWeight : volume.kind == Shell && volume.scale < 2.0f ? DirtWeight : 0.0f;+ // (a tank's: its dark base masses slump slowly onto the ground, which eats them; the weight goes+ // with the dust's density, and at RollWeight or 1.5 the thick masses fell flat before they showed)+ sim.Thin[slab][1] = rolls ? RollWeight : volume.kind == TankDeath ? TankMassWeight+ : volume.kind == Shell && volume.scale < 2.0f ? DirtWeight : 0.0f;sim.Thin[slab][2] = std::pow(0.5f, dt / (rolls ? GroundRollHalfLife : GroundDustHalfLife));// its heat kept over this step on top of the tier's (a gun's fireball goes in a few frames)sim.Thin[slab][3] = volume.kind == Muzzle ? std::pow(0.5f, dt / MuzzleHeatHalfLife) : 1.0f;