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.

feat(gameengine): retail ground movement with the fork's looks

Olcay Seygane0ef72f1dfb6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 763183340..50c637d67 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -376,16 +376,12 @@ found and fixed, EA's own, not port damage.**
- A kill used to promote only the unit that fired the last shot. Two Crusaders could grind an Overlord down to a sliver and a passing Humvee's rocket took every point of it. Now the killing blow earns a quarter and the rest is shared out among everything that hurt the target in the last ten seconds, by how much of its health each one took off. A unit that died before the kill leaves its share to the killer. Healing counts too: an Emperor, or an Overlord or Helix with a Propaganda Tower, earns for every friendly unit it patches up, half of that unit's worth as a kill for a full repair and less for less. The kill on the score screen and your general's promotion points still go to the last shot. Replays recorded before this change play out differently.
-## Tanks and cars drive like vehicles
+## Tanks and cars move as they did in Zero Hour
-- A Crusader used to reach top speed in a thirtieth of a second, on its very first frame moving twice as fast as it ever could again, and stopped dead the frame it was told to. Every tank, car and bike now picks up speed over about a second and brakes over most of one: told to stop at full speed, a Crusader rolls 12 more units and a Technical 26, where both used to halt on the spot. A vehicle sees the end of its move coming and is already braking for it.
-- Vehicles slow down for a corner they can see coming. EA cut a tank to 60% of its speed on every frame near a turn in its route and threw it back to full speed in between, so a column on a winding road lurched along in a sawtooth. Now a vehicle brakes before a bend by as much as the bend needs, turns through it on the move and speeds up out of it. A tank still stops and swings round on the spot for anything sharper than a right angle, at half the rate it used to; an Overlord sent straight behind itself comes all the way round in about 2.4 seconds.
-- Sent a short way behind itself, a tank backs up. It used to spin round on the spot and drive off nose first every time. A tank reverses at a bit under half speed, and only as far as backing up is still the quicker way there: about 40 units for a Crusader with the spot dead behind it. It used to back up for three of its lengths, and players noticed the crawl. A Crusader sent 70 behind itself spent 5.6 seconds reversing there and now turns round and arrives in 4.2. A car that has a reverse gear backs up to anything within three lengths behind it. A Humvee sent a long way behind does a three-point turn instead of pirouetting in its own length. Cars used to reverse at full speed; they now back up at 45% of it.
-- A car turns no tighter than a car can. EA turned a Quad Cannon round in less than its own length about its rear axle, so its middle swung sideways at twice the speed it drove. A car's turn is held to a circle one and a half lengths across at speed, and only when that circle cannot reach the spot it was sent to does it crawl round a tight one instead, so it still gets everywhere it used to. Without a reverse gear that costs time: a Quad Cannon sent 50 behind itself takes 4.8 seconds where it took 2.2.
-- A vehicle that had just parked used to start its next move with a lurch, and arrived crabbing sideways into its spot. Both are gone.
-- Players told us the tanks felt sluggish off the line, and they were right. Every vehicle you can build, on all three sides and in all nine generals' armies, now pulls away and brakes a quarter harder than it did. A Crusader is at full speed 1.17 seconds after the order instead of 1.37, an Overlord after 1.27 instead of 1.5, and a Humvee sent across a short stretch of ground arrives an eighth of a second sooner. Top speeds are unchanged, and soldiers, aircraft and boats are untouched. Replays recorded before this change will not play back.
-- They turn faster as well. Every vehicle you can build swings round a quarter faster than it did, and none turns slower than 120 degrees a second, so the Overlord gains most: sent somewhere straight behind it, an Overlord is rolling at speed 2.5 seconds after the order where it took 4.4, and a Crusader after 1.77 seconds instead of 1.93. The Emperor comes round twice as fast as before, the SCUD Launcher more than that. Turrets turn exactly as they did. Replays recorded before this change will not play back, and this version cannot join a game hosted on an older one.
-- Groups get where they are going as fast as before. Twenty Crusaders crossing a generated map arrived on average within 3% of the old time over eight maps, and the last of them a fifth of a second later. A replay recorded before this change plays back differently.
+- Players said the Humvee drove nothing like the original and the Dragon Tank crawled, and they were right. Since October every tank, car and bike had eased up to speed over a second, braked early for each stop and bend and backed up to a spot behind it, and even with a quarter more acceleration and turn rate on top it lost to Zero Hour over any distance. Tanks, cars and bikes drive on EA's own code and EA's own numbers again. Sent 300 east, a Crusader arrives in 9.7 seconds where it took 10.3. Sent 300 on a diagonal it arrives in 7.0 where it took 10.2, because EA measured a vehicle's speed in a way that let it run 41% faster at 45 degrees, and players have planned their raids on that since 2003, so it stays. A Humvee covers the same diagonal in 3.6 seconds instead of 5.6 and a Scorpion in 5.3 instead of 7.9. Start, stop, turns and the pivot on the spot are Zero Hour's to the frame, and a car still gains one or two frames on a short hop by sliding onto its spot a frame sooner. Soldiers keep their true speed at every heading.
+- They still look driven. The hull swings into a turn and settles out of it a few frames behind the tank's real heading, so a pivot no longer starts and stops dead, while the turret stays on its target. The squat as a tank pulls away, the dip when it brakes, the suspension and the moving treads are all still there, and none of it moves the tank by a step. Tanks keep firing on the move.
+- Columns mostly get there sooner. A column of Crusaders and Paladins through the streets of Alpine Assault had its last tank out in 33 seconds where it took 42.5, and of twenty Crusaders sent over the Golden Oasis bridge 19 were across after 50 seconds where 15 had been. Down the ramps of a generated map the last of nineteen arrives two seconds later than it did.
+- Replays recorded before this change play back differently, and this version cannot join a game hosted on an older one.
## Soldiers turn and stop on their feet
@@ -1304,7 +1300,7 @@ A third pass went through the generals' powers, promotions and unit abilities.
- A rifleman pulled off an oil derrick mid-capture left it flashing and chiming for the rest of the match, and the derrick changed hands anyway with nobody standing on it. Walking away now stops the capture, whether you or the computer gave the order.
- Every countdown on screen was a second too long. Rounding up a whole number of seconds gave a whole number plus one, so a ten second build said eleven - production queues, buildings going up, superweapons, all of it.
- A Chinese silo researching an upgrade while its missile charged drew both bars and both countdowns in the same row of pixels. They stack now.
-- Units moving diagonally ran up to 40% faster than their own stat sheet.
+- Soldiers moving diagonally ran up to 40% faster than their own stat sheet. Tanks and cars still do, as they always did in Zero Hour.
- Garrisoned infantry and base defences only ever range-checked one of their weapons.
- A Gattling Cannon, a Patriot battery or a Stinger Site no longer locks onto a tank it cannot reach. Each has a short-range ground gun (225) and a longer anti-air one (350 to 400), and the air gun's reach counted for ground targets: a tank at 300 became the target, the turret swung after it, nothing fired, and a helicopter overhead that the air gun could have hit went untouched until the tank left or died.
- Patriot batteries aim at the aircraft they shoot at. The lift they add to lob a missile over a ground target was added to every target, so against a helicopter the launcher pointed up to 40 degrees above it.
diff --git a/GeneralsMD/Code/BuildFingerprint.manifest b/GeneralsMD/Code/BuildFingerprint.manifest
index 730ec51f4..3994e990d 100644
--- a/GeneralsMD/Code/BuildFingerprint.manifest
+++ b/GeneralsMD/Code/BuildFingerprint.manifest
@@ -357,6 +357,7 @@ Data/Scenarios/reachshot.txt
Data/Scenarios/readme_hud.txt
Data/Scenarios/readme_water.txt
Data/Scenarios/repeatbuild.txt
+Data/Scenarios/retailpace.txt
Data/Scenarios/rf_mass840.txt
Data/Scenarios/rf_night.txt
Data/Scenarios/rf_nightday.txt
diff --git a/GeneralsMD/Code/Data/INI/BalanceReforged.ini b/GeneralsMD/Code/Data/INI/BalanceReforged.ini
index 7507c9cb3..31dbebe35 100644
--- a/GeneralsMD/Code/Data/INI/BalanceReforged.ini
+++ b/GeneralsMD/Code/Data/INI/BalanceReforged.ini
@@ -532,350 +532,20 @@ Object Tank_ChinaTankOverlordGattlingCannon
End
End
-; ---- tanks and cars build up speed and brake for it ----------------------------------------------
+; ---- tanks and cars keep EA's locomotors ----------------------------------------------------------
;
-; EA gave these Acceleration and Braking of 1000 (their own first numbers are still in the comments
-; of Locomotor.ini: 240 and 50), which takes a 30-speed tank from rest to top speed in one frame and
-; back in another. They now take about 1.2 seconds to get up to speed, a light vehicle about one, and
-; three quarters of a second to stop. The drive that uses them is Locomotor::moveTowardsPositionVehicle.
-; A Locomotor block here edits EA's template in place, like an Object block; AccelerationDamaged is
-; named because EA's file set it to 1000 too.
-;
-; Players found that 1.2 seconds sluggish, so every ground vehicle a player can build, on all three
-; sides and in every general's army, now has a quarter more Acceleration, AccelerationDamaged and
-; Braking than it had: a Crusader is at 99% of top speed 35 frames after the order where it took 41
-; (Scenarios/vehicleaccel.txt, -tracemove 57). The "was" comments
-; give the number before that. The Listening Outpost's Acceleration and every vehicle after it kept
-; EA's numbers until then and get the same quarter on top of them ("EA" comments). Speed is
-; untouched. Aircraft taxiing, infantry, boats and the campaign's civilian cars are left alone.
-;
-; The same vehicles turn faster too: TurnRate and TurnRateDamaged are a quarter above EA's, and never
-; below 120 degrees a second. The quarter alone left the Overlord at 75, and its sluggishness was the
-; turn, not the start: a tank pivots on the spot at half its TurnRate (TREAD_PIVOT_SHARE in
-; Locomotor.cpp), so EA's 60 swung it round at 30 degrees a second. The floor reaches the Overlord
-; family, the SCUD Launcher (EA: 50) and the 90-degree trucks, dozers and Nuke Cannon, and it also
-; lifts their TurnRateDamaged, which EA had set below TurnRate. Sent to a point straight behind it
-; (Scenarios/vehicleturn.txt), an Overlord reaches 90% of top speed on the new heading 74 frames after
-; the order where it took 131; a Crusader 53 where it took 58. Turret turn rates are separate and
-; untouched.
-
-Locomotor TomahawkLocomotor
- Acceleration = 31.25 ; was 25
- AccelerationDamaged = 31.25 ; was 25
- Braking = 50 ; was 40
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor CrusaderLocomotor
- Acceleration = 31.25 ; was 25
- AccelerationDamaged = 31.25 ; was 25
- Braking = 50 ; was 40
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor MilitiaTankLocomotor
- Acceleration = 31.25 ; was 25
- AccelerationDamaged = 31.25 ; was 25
- Braking = 50 ; was 40
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor BasicTankLocomotor
- Acceleration = 31.25 ; was 25
- AccelerationDamaged = 31.25 ; was 25
- Braking = 50 ; was 40
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor DragonLocomotor
- Acceleration = 31.25 ; was 25
- AccelerationDamaged = 31.25 ; was 25
- Braking = 50 ; was 40
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor InfernoLocomotor
- Acceleration = 31.25 ; was 25
- AccelerationDamaged = 31.25 ; was 25
- Braking = 50 ; was 40
- TurnRate = 150 ; EA: 120
- TurnRateDamaged = 120 ; EA: 90
-End
-
-Locomotor BattleMasterLocomotor
- Acceleration = 26.25 ; was 21
- AccelerationDamaged = 26.25 ; was 21
- Braking = 41.25 ; was 33
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor Tank_BattleMasterLocomotor
- Acceleration = 30 ; was 24
- AccelerationDamaged = 30 ; was 24
- Braking = 48.75 ; was 39
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor NuclearBattleMasterLocomotor
- Acceleration = 36.25 ; was 29
- AccelerationDamaged = 36.25 ; was 29
- Braking = 58.75 ; was 47
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor Tank_NuclearBattleMasterLocomotor
- Acceleration = 36.25 ; was 29
- AccelerationDamaged = 36.25 ; was 29
- Braking = 58.75 ; was 47
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor Nuke_FusionBattleMasterLocomotor
- Acceleration = 47.5 ; was 38
- AccelerationDamaged = 47.5 ; was 38
- Braking = 75 ; was 60
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor ScorpionLocomotor
- Acceleration = 45 ; was 36
- AccelerationDamaged = 45 ; was 36
- Braking = 71.25 ; was 57
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor MarauderLocomotor
- Acceleration = 41.25 ; was 33
- AccelerationDamaged = 41.25 ; was 33
- Braking = 66.25 ; was 53
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor GattlingTankLocomotor
- Acceleration = 45 ; was 36
- AccelerationDamaged = 45 ; was 36
- Braking = 71.25 ; was 57
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor HumveeLocomotor
- Acceleration = 75 ; was 60
- AccelerationDamaged = 75 ; was 60
- Braking = 107.5 ; was 86
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor AvengerLocomotor
- Acceleration = 37.5 ; was 30
- AccelerationDamaged = 37.5 ; was 30
- Braking = 53.75 ; was 43
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor QuadCannonLocomotor
- Acceleration = 50 ; was 40
- AccelerationDamaged = 50 ; was 40
- Braking = 71.25 ; was 57
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor TroopCrawlerLocomotor
- Acceleration = 50 ; was 40
- AccelerationDamaged = 50 ; was 40
- Braking = 71.25 ; was 57
- TurnRate = 150 ; EA: 120
- TurnRateDamaged = 150 ; EA: 120
-End
-
-Locomotor BombTruckLocomotor
- Acceleration = 62.5 ; was 50
- AccelerationDamaged = 62.5 ; was 50
- Braking = 88.75 ; was 71
- TurnRate = 120 ; EA: 90
- TurnRateDamaged = 120 ; EA: 60
-End
-
-Locomotor BattleBusLocomotor
- Acceleration = 72.5 ; was 58
- AccelerationDamaged = 72.5 ; was 58
- Braking = 116.25 ; was 93
- TurnRate = 120 ; EA: 90
- TurnRateDamaged = 120 ; EA: 60
-End
-
-Locomotor ListeningOutpostLocomotor
- Acceleration = 25 ; EA: 20
- AccelerationDamaged = 20 ; EA: 16
- Braking = 71.25 ; was 57
- TurnRate = 120 ; EA: 90
- TurnRateDamaged = 120 ; EA: 90
-End
-
-Locomotor OverlordLocomotor
- Acceleration = 18.75 ; EA: 15
- AccelerationDamaged = 18.75 ; EA: 15
- Braking = 62.5 ; EA: 50
- TurnRate = 120 ; EA: 60
- TurnRateDamaged = 120 ; EA: 60
-End
-
-Locomotor NuclearOverlordLocomotor
- Acceleration = 37.5 ; EA: 30
- AccelerationDamaged = 37.5 ; EA: 30
- Braking = 62.5 ; EA: 50
- TurnRate = 120 ; EA: 60
- TurnRateDamaged = 120 ; EA: 60
-End
-
-Locomotor Tank_OverlordLocomotor
- Acceleration = 18.75 ; EA: 15
- AccelerationDamaged = 18.75 ; EA: 15
- Braking = 62.5 ; EA: 50
- TurnRate = 120 ; EA: 60
- TurnRateDamaged = 120 ; EA: 60
-End
-
-Locomotor Nuke_FusionOverlordLocomotor
- Acceleration = 37.5 ; EA: 30
- AccelerationDamaged = 37.5 ; EA: 30
- Braking = 62.5 ; EA: 50
- TurnRate = 120 ; EA: 80
- TurnRateDamaged = 120 ; EA: 80
-End
-
-Locomotor ChinaNukeCannonLocomotor
- Acceleration = 37.5 ; EA: 30
- AccelerationDamaged = 10 ; EA: 8
- Braking = 62.5 ; EA: 50
- TurnRate = 120 ; EA: 90
- TurnRateDamaged = 120 ; EA: 60
-End
-
-Locomotor ChinaVehicleDozerLocomotor
- Acceleration = 37.5 ; EA: 30
- AccelerationDamaged = 10 ; EA: 8
- Braking = 62.5 ; EA: 50
- TurnRate = 120 ; EA: 90
- TurnRateDamaged = 120 ; EA: 60
-End
-
-Locomotor AmericaVehicleDozerLocomotor
- Acceleration = 37.5 ; EA: 30
- AccelerationDamaged = 10 ; EA: 8
- Braking = 62.5 ; EA: 50
- TurnRate = 120 ; EA: 90
- TurnRateDamaged = 120 ; EA: 60
-End
-
-Locomotor SupplyTruckLocomotor
- Acceleration = 300 ; EA: 240
- AccelerationDamaged = 225 ; EA: 180
- Braking = 62.5 ; EA: 50
- TurnRate = 120 ; EA: 90
- TurnRateDamaged = 120 ; EA: 60
-End
-
-Locomotor SentryLocomotor
- Acceleration = 75 ; EA: 60
- AccelerationDamaged = 75 ; EA: 60
- Braking = 75 ; EA: 60
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor ScudLauncherLocomotor
- Acceleration = 200 ; EA: 160
- AccelerationDamaged = 150 ; EA: 120
- Braking = 62.5 ; EA: 50
- TurnRate = 120 ; EA: 50
- TurnRateDamaged = 120 ; EA: 45
-End
-
-Locomotor TechnicalLocomotor
- Acceleration = 125 ; EA: 100
- AccelerationDamaged = 125 ; EA: 100
- Braking = 62.5 ; EA: 50
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor RocketBuggyLocomotor
- Acceleration = 112.5 ; EA: 90
- AccelerationDamaged = 100 ; EA: 80
- Braking = 62.5 ; EA: 50
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor RadarVanLocomotor
- Acceleration = 62.5 ; EA: 50
- AccelerationDamaged = 62.5 ; EA: 50
- Braking = 62.5 ; EA: 50
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor ToxinTruckLocomotor
- Acceleration = 125 ; EA: 100
- AccelerationDamaged = 125 ; EA: 100
- Braking = 125 ; EA: 100
- TurnRate = 225 ; EA: 180
- TurnRateDamaged = 225 ; EA: 180
-End
-
-Locomotor CombatBikeGroundLocomotor
- Acceleration = 112.5 ; EA: 90
- AccelerationDamaged = 100 ; EA: 80
- Braking = 75 ; EA: 60
- TurnRate = 150 ; EA: 120
- TurnRateDamaged = 150 ; EA: 120
-End
-
-Locomotor CombatBikeCliffLocomotor
- Acceleration = 112.5 ; EA: 90
- AccelerationDamaged = 100 ; EA: 80
- Braking = 75 ; EA: 60
- TurnRate = 150 ; EA: 120
- TurnRateDamaged = 150 ; EA: 120
-End
-
-Locomotor CombatBikeTerroristGroundLocomotor
- Acceleration = 85 ; EA: 68
- AccelerationDamaged = 75 ; EA: 60
- Braking = 75 ; EA: 60
- TurnRate = 150 ; EA: 120
- TurnRateDamaged = 150 ; EA: 120
-End
-
-Locomotor CombatBikeTerroristCliffLocomotor
- Acceleration = 62.5 ; EA: 50
- AccelerationDamaged = 50 ; EA: 40
- Braking = 75 ; EA: 60
- TurnRate = 150 ; EA: 120
- TurnRateDamaged = 150 ; EA: 120
-End
+; From 2026-10-03 every ground vehicle had its own Acceleration, Braking and TurnRate here, for the
+; eased drive in Locomotor::moveTowardsPositionVehicle. Players found tanks and cars slow against
+; Zero Hour's, so they drive EA's treads and wheels on EA's Locomotor.ini numbers again and the lean,
+; the suspension and an eased heading are drawn on top (Drawable::calcPhysicsXformGround).
+; Scenarios/retailpace.txt has the timings.
; ---- jets taxi on a nose wheel ---------------------------------------------------------------------
;
; EA taxied every jet on treads with a Braking of 999999: it stopped dead off its landing roll and at
; every corner of the taxiway, spun on the spot to the next leg at 180 degrees a second, and spun again
-; on its parking spot. On four wheels it drives the ground vehicles' drive (Locomotor::isGroundVehicle):
+; on its parking spot. On four wheels it drives the vehicle drive (Locomotor::isGroundVehicle), which
+; is now the jet's alone:
; it brakes for a corner and rounds it, crawls round one too tight for its turning circle instead of
; spinning, and slows to a stop at the end of the taxi. Turning on its spot to its parking heading or
; onto the runway eases in and out (Locomotor::locoUpdate_moveTowardsAngle). Speed is EA's.
diff --git a/GeneralsMD/Code/Data/Scenarios/retailpace.txt b/GeneralsMD/Code/Data/Scenarios/retailpace.txt
new file mode 100644
index 000000000..119867ed2
--- /dev/null
+++ b/GeneralsMD/Code/Data/Scenarios/retailpace.txt
@@ -0,0 +1,148 @@
+# Retail pace: does a tank or car take the time it took in Zero Hour?
+#
+# Twelve vehicles, one at a time down the same lane on the open grass of the small generated map,
+# each spawned facing east: leg A 300 east from a standstill, leg B 300 at 45 degrees (a 45 degree
+# turn first, then the diagonal, where EA's forward speed let a vehicle run 1.41 times its Speed),
+# leg C a 40 hop east. Each finished vehicle parks on the bottom edge before the next one spawns.
+#
+# generals.exe -headless -quickstart -noshellmap -observer -multiInstance -noFPSLimit
+# -randommap 1 2 small -autoskirmish 2 -takeover
+# -side 0 FactionAmerica -side 1 FactionChina -seed 1 -maxframes 48400
+# -scenario retailpace -logPrefix retailpace_
+#
+# then read the HEADLESS ARRIVE lines, logic frames from each order. Measured 2026-10-26: the
+# fork's eased drive / retail (EA's drives, EA's forward speed, EA's Locomotor.ini numbers, the
+# same tree otherwise) / the change that restored them, legs A, B and C:
+# Crusader, Paladin, Dragon, Tomahawk 616 614 108 / 582 418 75 / 582 418 75
+# Battlemaster 732 727 119 / 698 499 88 / 698 499 88
+# Overlord 909 901 138 / 911 671 142 / 911 671 142
+# Scorpion 471 471 93 / 438 316 58 / 438 316 58
+# Marauder 482 473 124 / 440 317 66 / 440 317 66
+# Humvee 328 333 80 / 293 217 44 / 293 217 43
+# Technical 239 245 73 / 250 233 71 / 250 230 70
+# Quad Cannon 476 469 124 / 441 316 65 / 440 316 64
+# Avenger 683 618 101 / 603 416 70 / 603 416 69
+# The frame or three the cars gain on retail is the slide onto the goal starting on the frame the
+# braking does, kept from the eased drive.
+#
+# See mobstress.txt for the line grammar.
+
+# AmericaTankCrusader
+70 spawn 0 AmericaTankCrusader 1 350 1325
+100 move 0 AmericaTankCrusader 650 1325
+100 arrive 0 AmericaTankCrusader 650 1325 10
+850 move 0 AmericaTankCrusader 862 1537
+850 arrive 0 AmericaTankCrusader 862 1537 10
+1750 move 0 AmericaTankCrusader 902 1537
+1750 arrive 0 AmericaTankCrusader 902 1537 5
+2000 move 0 AmericaTankCrusader 120 1775
+
+# AmericaTankPaladin
+2070 spawn 0 AmericaTankPaladin 1 350 1325
+2100 move 0 AmericaTankPaladin 650 1325
+2100 arrive 0 AmericaTankPaladin 650 1325 10
+2850 move 0 AmericaTankPaladin 862 1537
+2850 arrive 0 AmericaTankPaladin 862 1537 10
+3750 move 0 AmericaTankPaladin 902 1537
+3750 arrive 0 AmericaTankPaladin 902 1537 5
+4000 move 0 AmericaTankPaladin 250 1775
+
+# ChinaTankDragon
+4070 spawn 0 ChinaTankDragon 1 350 1325
+4100 move 0 ChinaTankDragon 650 1325
+4100 arrive 0 ChinaTankDragon 650 1325 10
+4850 move 0 ChinaTankDragon 862 1537
+4850 arrive 0 ChinaTankDragon 862 1537 10
+5750 move 0 ChinaTankDragon 902 1537
+5750 arrive 0 ChinaTankDragon 902 1537 5
+6000 move 0 ChinaTankDragon 380 1775
+
+# ChinaTankBattleMaster
+6070 spawn 0 ChinaTankBattleMaster 1 350 1325
+6100 move 0 ChinaTankBattleMaster 650 1325
+6100 arrive 0 ChinaTankBattleMaster 650 1325 10
+6850 move 0 ChinaTankBattleMaster 862 1537
+6850 arrive 0 ChinaTankBattleMaster 862 1537 10
+7750 move 0 ChinaTankBattleMaster 902 1537
+7750 arrive 0 ChinaTankBattleMaster 902 1537 5
+8000 move 0 ChinaTankBattleMaster 510 1775
+
+# ChinaTankOverlord
+8070 spawn 0 ChinaTankOverlord 1 350 1325
+8100 move 0 ChinaTankOverlord 650 1325
+8100 arrive 0 ChinaTankOverlord 650 1325 10
+8850 move 0 ChinaTankOverlord 862 1537
+8850 arrive 0 ChinaTankOverlord 862 1537 10
+9750 move 0 ChinaTankOverlord 902 1537
+9750 arrive 0 ChinaTankOverlord 902 1537 5
+10000 move 0 ChinaTankOverlord 640 1775
+
+# GLATankScorpion
+10070 spawn 0 GLATankScorpion 1 350 1325
+10100 move 0 GLATankScorpion 650 1325
+10100 arrive 0 GLATankScorpion 650 1325 10
+10850 move 0 GLATankScorpion 862 1537
+10850 arrive 0 GLATankScorpion 862 1537 10
+11750 move 0 GLATankScorpion 902 1537
+11750 arrive 0 GLATankScorpion 902 1537 5
+12000 move 0 GLATankScorpion 770 1775
+
+# GLATankMarauder
+12070 spawn 0 GLATankMarauder 1 350 1325
+12100 move 0 GLATankMarauder 650 1325
+12100 arrive 0 GLATankMarauder 650 1325 10
+12850 move 0 GLATankMarauder 862 1537
+12850 arrive 0 GLATankMarauder 862 1537 10
+13750 move 0 GLATankMarauder 902 1537
+13750 arrive 0 GLATankMarauder 902 1537 5
+14000 move 0 GLATankMarauder 900 1775
+
+# AmericaVehicleTomahawk
+14070 spawn 0 AmericaVehicleTomahawk 1 350 1325
+14100 move 0 AmericaVehicleTomahawk 650 1325
+14100 arrive 0 AmericaVehicleTomahawk 650 1325 10
+14850 move 0 AmericaVehicleTomahawk 862 1537
+14850 arrive 0 AmericaVehicleTomahawk 862 1537 10
+15750 move 0 AmericaVehicleTomahawk 902 1537
+15750 arrive 0 AmericaVehicleTomahawk 902 1537 5
+16000 move 0 AmericaVehicleTomahawk 1030 1775
+
+# AmericaVehicleHumvee
+16070 spawn 0 AmericaVehicleHumvee 1 350 1325
+16100 move 0 AmericaVehicleHumvee 650 1325
+16100 arrive 0 AmericaVehicleHumvee 650 1325 10
+16850 move 0 AmericaVehicleHumvee 862 1537
+16850 arrive 0 AmericaVehicleHumvee 862 1537 10
+17750 move 0 AmericaVehicleHumvee 902 1537
+17750 arrive 0 AmericaVehicleHumvee 902 1537 5
+18000 move 0 AmericaVehicleHumvee 1160 1775
+
+# GLAVehicleTechnical
+18070 spawn 0 GLAVehicleTechnical 1 350 1325
+18100 move 0 GLAVehicleTechnical* 650 1325
+18100 arrive 0 GLAVehicleTechnical* 650 1325 10
+18850 move 0 GLAVehicleTechnical* 862 1537
+18850 arrive 0 GLAVehicleTechnical* 862 1537 10
+19750 move 0 GLAVehicleTechnical* 902 1537
+19750 arrive 0 GLAVehicleTechnical* 902 1537 5
+20000 move 0 GLAVehicleTechnical* 1290 1775
+
+# GLAVehicleQuadCannon
+20070 spawn 0 GLAVehicleQuadCannon 1 350 1325
+20100 move 0 GLAVehicleQuadCannon 650 1325
+20100 arrive 0 GLAVehicleQuadCannon 650 1325 10
+20850 move 0 GLAVehicleQuadCannon 862 1537
+20850 arrive 0 GLAVehicleQuadCannon 862 1537 10
+21750 move 0 GLAVehicleQuadCannon 902 1537
+21750 arrive 0 GLAVehicleQuadCannon 902 1537 5
+22000 move 0 GLAVehicleQuadCannon 1420 1775
+
+# AmericaTankAvenger
+22070 spawn 0 AmericaTankAvenger 1 350 1325
+22100 move 0 AmericaTankAvenger 650 1325
+22100 arrive 0 AmericaTankAvenger 650 1325 10
+22850 move 0 AmericaTankAvenger 862 1537
+22850 arrive 0 AmericaTankAvenger 862 1537 10
+23750 move 0 AmericaTankAvenger 902 1537
+23750 arrive 0 AmericaTankAvenger 902 1537 5
+24000 move 0 AmericaTankAvenger 1550 1775
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
index 073b105f0..563efae82 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
@@ -208,6 +208,10 @@ public:
Real m_groundPitch; ///< a ground vehicle's chassis pitch, roll and lift from that frame, drawn until the next one
Real m_groundRoll;
Real m_groundZ;
+ Real m_headingLag; ///< a ground vehicle's drawn heading minus its logic heading, sprung back towards 0
+ Real m_headingLagRate; ///< and how fast that changes, a logic frame
+ Real m_headingLogic; ///< the logic heading on m_headingFrame
+ UnsignedInt m_headingFrame; ///< the logic frame the heading spring last stepped on
TWheelInfo m_wheelInfo; ///< Wheel offset & angle info for a wheeled type locomotor.
DrawableLocoInfo();
@@ -622,6 +626,8 @@ public:
const TWheelInfo *getWheelInfo(void) const { return m_locoInfo ? &m_locoInfo->m_wheelInfo : NULL; }
const DrawableLocoInfo *getLocoInfo() const { return m_locoInfo; }
+ /// how far the drawn hull of a tank or car trails its logic heading (calcPhysicsXformGround), 0 for anything else
+ Real getDrawnHeadingLag() const { return m_locoInfo ? m_locoInfo->m_headingLag : 0.0f; }
// this method must ONLY be called from the client, NEVER From the logic, not even indirectly.
Bool clientOnly_getFirstRenderObjInfo(Coord3D* pos, Real* boundingSphereRadius, Matrix3D* transform);
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h
index 158e40b62..b61c80d4e 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h
@@ -340,13 +340,14 @@ public:
Bool isHelicopter(const Object* obj) const;
/**
- A tank, car or bike driving under its own power: treads, four wheels or a motorcycle, not in
- an ULTRA_ACCURATE manoeuvre; or a jet taxiing on four wheels, which is. A helicopter taxiing
- on treads is not. Its speed eases up and down, it brakes into bends and stops it can see
- coming, treads back up to a goal close behind and wheels turn no tighter than their wheelbase
- allows.
+ A jet taxiing on four wheels, the one user left of moveTowardsPositionVehicle: its speed eases
+ up and down, it brakes into bends and stops it can see coming and turns no tighter than its
+ wheelbase allows. Tanks, cars and bikes drive EA's treads and wheels. A helicopter taxiing on
+ treads is not one either.
*/
Bool isGroundVehicle(const Object* obj) const;
+ /// treads, four wheels or a motorcycle: whatever drives on the ground on a vehicle's locomotor
+ Bool isGroundDrive() const;
/// the tightest circle a ground vehicle on wheels drives at speed, from its length
Real calcWheelTurnRadius(const Object* obj) const;
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h
index cd7dbc8ea..2c0962953 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h
@@ -156,6 +156,22 @@ public:
return vel.x * dir.x + vel.y * dir.y + vel.z * dir.z;
}
+ /**
+ EA's forward speed, kept for EA's own tread and wheel drives (Locomotor::moveTowardsPositionTreads
+ and moveTowardsPositionWheels): sqrt((vx*dx)^2 + (vy*dy)^2), signed by the dot product. It reads
+ 0.707 of the true speed at 45 degrees, so a drive closing its speed on it settles at up to 1.41
+ times its Speed off the axes. That is how fast a tank or a car crossed the map diagonally in Zero
+ Hour, and players time their moves on it. Only x and y are read.
+ */
+ static Real calcRetailForwardSpeed( const Coord3D& vel, const Coord3D& dir )
+ {
+ Real vx = vel.x * dir.x;
+ Real vy = vel.y * dir.y;
+ Real speed = (Real)sqrtf( vx*vx + vy*vy );
+ return (vx + vy >= 0.0f) ? speed : -speed;
+ }
+ Real getRetailForwardSpeed2D() const; ///< calcRetailForwardSpeed along the object's 2d direction vector
+
ObjectID getCurrentOverlap() const; ///< return object(s) being overlapped
ObjectID getPreviousOverlap() const; ///< return object(s) that were overlapped last frame
ObjectID getLastCollidee() const; ///< return object that was last collided with... can be quite old
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
index 8f82b5253..bf4eac31b 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
@@ -242,6 +242,10 @@ DrawableLocoInfo::DrawableLocoInfo()
m_groundPitch = 0.0f;
m_groundRoll = 0.0f;
m_groundZ = 0.0f;
+ m_headingLag = 0.0f;
+ m_headingLagRate = 0.0f;
+ m_headingLogic = 0.0f;
+ m_headingFrame = 0;
}
// ------------------------------------------------------------------------------------------------
@@ -1745,15 +1749,15 @@ void Drawable::applyPhysicsXform(Matrix3D* mtx)
{
const Object *obj = getObject();
- if( !obj || obj->isDisabledByType( DISABLED_HELD ) || !TheGlobalData->m_showClientPhysics )
- {
- return;
- }
-
Bool frozen = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished();
frozen = frozen || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript();
- if (frozen)
+ if( !obj || obj->isDisabledByType( DISABLED_HELD ) || !TheGlobalData->m_showClientPhysics || frozen )
+ {
+ // drawn on its logic heading, which is what the turret is drawn against (getDrawnHeadingLag)
+ if (m_locoInfo)
+ m_locoInfo->m_headingLag = 0.0f;
return;
+ }
PhysicsXformInfo info;
if (calcPhysicsXform(info))
{
@@ -2199,7 +2203,15 @@ void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, Physics
* follows the change of forward speed over a logic frame as a share of top speed, and in a turn
* speed times turn rate as a share of the most the locomotor can do, eased through three stages:
* a standing start to top speed inside one frame peaks four frames later at most of the limit and
- * has gone by about half a second, and a slower pull away leans less for longer. */
+ * has gone by about half a second, and a slower pull away leans less for longer. That one frame
+ * start is how a tank or car pulls away again (Locomotor::isGroundVehicle), so the share of top
+ * speed and of the turn is held to one: a diagonal start, at up to 1.41 times Speed, or a shove
+ * leans no further than a straight start.
+ *
+ * The drawn heading of a tank or car trails the logic one through a critically damped spring,
+ * HEADING_LAG_FRAMES behind on a steady turn, so EA's pivot, which starts and stops dead at full
+ * TurnRate, swings the hull up to speed and settles it. It is the picture only: the turret is drawn
+ * against the logic heading (W3DModelDraw::handleClientTurretPositioning). */
//-------------------------------------------------------------------------------------------------
void Drawable::calcPhysicsXformGround( const Locomotor *locomotor, PhysicsXformInfo& info )
{
@@ -2210,6 +2222,38 @@ void Drawable::calcPhysicsXformGround( const Locomotor *locomotor, PhysicsXformI
const Real LEAN_EASE_FRAMES = 3.0f; // each of the three smoothing stages, in retail frames
const Real START_GAIN = 11.0f; // a one frame start from rest to top speed peaks at tanh(1.2) of the limit
const Real DEFAULT_LEAN_LIMIT = 0.07f; // 4 degrees, for a locomotor that reacts but names no limit, like the Humvee's
+ const Real HEADING_LAG_FRAMES = 5.0f; // logic frames the drawn hull trails a steady turn by
+ const Real HEADING_MAX_LAG = PI / 4.0f; // never further behind than this: a heading a script sets is drawn there soon
+ const UnsignedInt HEADING_CATCH_UP_FRAMES = 8; // more logic frames than this unseen and the hull is drawn on its heading
+
+ // the spring is stepped once a logic frame, the rate the heading itself changes at
+ const Object *owner = getObject();
+ UnsignedInt logicFrame = TheGameLogic->getFrame();
+ UnsignedInt gap = logicFrame - m_locoInfo->m_headingFrame;
+ if (gap > HEADING_CATCH_UP_FRAMES || owner->isKindOf(KINDOF_AIRCRAFT))
+ {
+ // a taxiing jet or a landed helicopter eases its own turn in the logic
+ m_locoInfo->m_headingLag = 0.0f;
+ m_locoInfo->m_headingLagRate = 0.0f;
+ }
+ else if (gap != 0)
+ {
+ const Real omega = 2.0f / HEADING_LAG_FRAMES; // a ramp's lag is 2 / omega
+ Real turned = stdAngleDiff(getOrientation(), m_locoInfo->m_headingLogic) / gap;
+ for (UnsignedInt i = 0; i < gap; ++i)
+ {
+ m_locoInfo->m_headingLag -= turned;
+ m_locoInfo->m_headingLagRate += -omega * omega * m_locoInfo->m_headingLag - 2.0f * omega * m_locoInfo->m_headingLagRate;
+ m_locoInfo->m_headingLag += m_locoInfo->m_headingLagRate;
+ }
+ if (fabs(m_locoInfo->m_headingLag) > HEADING_MAX_LAG)
+ {
+ m_locoInfo->m_headingLag = (m_locoInfo->m_headingLag > 0.0f) ? HEADING_MAX_LAG : -HEADING_MAX_LAG;
+ m_locoInfo->m_headingLagRate = 0.0f;
+ }
+ }
+ m_locoInfo->m_headingLogic = getOrientation();
+ m_locoInfo->m_headingFrame = logicFrame;
/* Stepped on the retail clock, every second logic frame, so the springs, the locomotor's
stiffness and damping and the ease frames below keep the timing they were tuned at. Speeds are
@@ -2226,7 +2270,7 @@ void Drawable::calcPhysicsXformGround( const Locomotor *locomotor, PhysicsXformI
return;
BodyDamageType bdt = obj->getBodyModule()->getDamageState();
Real speed = physics->getForwardSpeed2D();
- Real angle = getOrientation();
+ Real angle = getOrientation() + m_locoInfo->m_headingLag; // the turn as drawn
if (steps > MAX_CATCH_UP_FRAMES)
{
// long unseen, or just loaded: let the springs settle without a lurch from the gap
@@ -2250,8 +2294,8 @@ void Drawable::calcPhysicsXformGround( const Locomotor *locomotor, PhysicsXformI
{
Real maxSpeed = locomotor->getMaxSpeedForCondition(bdt);
Real maxLateral = maxSpeed * locomotor->getMaxTurnRate(bdt) * LOGICFRAMES_PER_RETAIL_FRAME;
- pitchIn = maxSpeed > 0.0f ? -START_GAIN * forwardAccel / maxSpeed : 0.0f;
- rollIn = maxLateral > 0.0f ? -lateralAccel / maxLateral : 0.0f;
+ pitchIn = maxSpeed > 0.0f ? -START_GAIN * clamp(-1.0f, forwardAccel / maxSpeed, 1.0f) : 0.0f;
+ rollIn = maxLateral > 0.0f ? -clamp(-1.0f, lateralAccel / maxLateral, 1.0f) : 0.0f;
}
Real accelLimit = locomotor->getAccelPitchLimit();
Real decelLimit = locomotor->getDecelPitchLimit();
@@ -2289,6 +2333,7 @@ void Drawable::calcPhysicsXformGround( const Locomotor *locomotor, PhysicsXformI
}
info.m_totalPitch = m_locoInfo->m_groundPitch;
info.m_totalRoll = m_locoInfo->m_groundRoll;
+ info.m_totalYaw = m_locoInfo->m_headingLag;
info.m_totalZ = m_locoInfo->m_groundZ;
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp
index 0f477fc58..934b09514 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp
@@ -57,7 +57,7 @@
static const Real DONUT_TIME_DELAY_SECONDS=2.5f;
static const Real DONUT_DISTANCE=4.0*PATHFIND_CELL_SIZE_F;
-// Ground vehicles (Locomotor::isGroundVehicle). Speeds are per frame, as everywhere in this file;
+// The vehicle drive, which only a taxiing jet uses now (Locomotor::isGroundVehicle). Speeds are per frame, as everywhere in this file;
// the frame counts were tuned at the retail rate.
static const Real VEHICLE_ACCEL_EASE_FRAMES = ConvertRetailFrames(6.0f); // frames for the pull along the nose to build up to full Acceleration
static const Real VEHICLE_BRAKE_EASE_FRAMES = ConvertRetailFrames(3.0f); // and to full braking, which a driver stamps on harder
@@ -1206,14 +1206,20 @@ Bool Locomotor::isJet(const Object* obj) const
//-------------------------------------------------------------------------------------------------
Bool Locomotor::isGroundVehicle(const Object* obj) const
+{
+ /* Only a jet taxiing on its nose wheel (BasicJetTaxiLocomotor in BalanceReforged.ini), with the
+ precision its taxi asks for; a landed helicopter keeps EA's drive. Tanks, cars and bikes drive
+ EA's treads and wheels again, so they start, stop, turn and cross the map in the time they took
+ in Zero Hour: players found the eased drive slow. What made it look driven is now drawn only
+ (Drawable::calcPhysicsXformGround). */
+ return obj->isKindOf(KINDOF_AIRCRAFT) && m_template->m_appearance == LOCO_WHEELS_FOUR;
+}
+
+//-------------------------------------------------------------------------------------------------
+Bool Locomotor::isGroundDrive() const
{
LocomotorAppearance appearance = m_template->m_appearance;
- // a jet taxis on its nose wheel (BasicJetTaxiLocomotor in BalanceReforged.ini), with the precision
- // its taxi asks for; a landed helicopter keeps EA's drive
- if (obj->isKindOf(KINDOF_AIRCRAFT))
- return appearance == LOCO_WHEELS_FOUR;
- return (appearance == LOCO_TREADS || appearance == LOCO_WHEELS_FOUR || appearance == LOCO_MOTORCYCLE)
- && !getFlag(ULTRA_ACCURATE); // a dozer or a POW truck lining up on its spot keeps EA's drive
+ return appearance == LOCO_TREADS || appearance == LOCO_WHEELS_FOUR || appearance == LOCO_MOTORCYCLE;
}
//-------------------------------------------------------------------------------------------------
@@ -1403,7 +1409,9 @@ void Locomotor::locoUpdate_moveTowardsPosition(Object* obj, const Coord3D& chase
/* A vehicle slides onto its goal on the frames physics leaves its position alone, which is this
frame's flag. Last frame's put the slide one frame late: the frame braking began moved nothing,
and the first frame of the next order both slid and drove, up to twice top speed. */
- if (groundVehicle)
+ // a helicopter landed on treads is left as it was
+ Bool groundDrive = isGroundDrive() && (groundVehicle || !obj->isKindOf(KINDOF_AIRCRAFT));
+ if (groundDrive)
wasBraking = getFlag(IS_BRAKING);
if (wasBraking)
@@ -1448,6 +1456,9 @@ void Locomotor::locoUpdate_moveTowardsPosition(Object* obj, const Coord3D& chase
// a helicopter's speed need not lie along its nose
const Coord3D *v = physics->getVelocity();
Real vel = isHelicopter(obj) ? sqrt(sqr(v->x) + sqr(v->y)) : fabs(physics->getForwardSpeed2D());
+ // EA's treads and wheels slide at the speed they drive on, EA's own
+ if (groundDrive && !groundVehicle)
+ vel = fabs(physics->getRetailForwardSpeed2D());
// a vehicle's planned stop has already slowed it; a third of a cell a frame would put the speed back
Real minVel = groundVehicle ? VEHICLE_MIN_SLIDE : MIN_VEL;
if (vel < minVel)
@@ -1509,7 +1520,9 @@ void Locomotor::moveTowardsPositionTreads(Object* obj, PhysicsBehavior *physics,
// if (speed < m_minTurnSpeed)
// speed = m_minTurnSpeed;
- Real actualSpeed = physics->getForwardSpeed2D();
+ // EA's measure, so a tank keeps the diagonal pace it had in Zero Hour (calcRetailForwardSpeed); a
+ // helicopter landed on treads is left as it was
+ Real actualSpeed = obj->isKindOf(KINDOF_AIRCRAFT) ? physics->getForwardSpeed2D() : physics->getRetailForwardSpeed2D();
Real slowDownTime = actualSpeed / getBraking();
Real slowDownDist = (actualSpeed/1.50f) * slowDownTime;
@@ -1620,7 +1633,8 @@ void Locomotor::moveTowardsPositionWheels(Object* obj, PhysicsBehavior *physics,
}
- Real actualSpeed = physics->getForwardSpeed2D();
+ // EA's measure, so a car keeps the diagonal pace it had in Zero Hour (calcRetailForwardSpeed)
+ Real actualSpeed = obj->isKindOf(KINDOF_AIRCRAFT) ? physics->getForwardSpeed2D() : physics->getRetailForwardSpeed2D();
Bool do3pointTurn = false;
#if 1
if (actualSpeed==0.0f) {
@@ -1924,7 +1938,9 @@ void Locomotor::turnVehicle(Object* obj, PhysicsBehavior *physics, Real yaw)
//-------------------------------------------------------------------------------------------------
/*
- A tank, car or bike under its own power. EA's treads and wheels set the speed they wanted on the
+ A jet taxiing on its nose wheel (isGroundVehicle). It drove every tank, car and bike from 2026-10-03
+ until players found them slow against Zero Hour's; they are back on EA's drives, written up here
+ for what they do differently. EA's treads and wheels set the speed they wanted on the
next frame (Acceleration and Braking were 1000, a thirtieth of a second from rest to top speed),
cut it to 60% on every frame near a waypoint that was not dead ahead, pivoted a tank on the spot
at full TurnRate for anything past 45 degrees, and turned a car round in less than its own length.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp
index a53c8c5cd..145739ae9 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp
@@ -1007,6 +1007,12 @@ Real PhysicsBehavior::getForwardSpeed2D() const
return calcForwardSpeed( vel2D, dir2D );
}
+//-------------------------------------------------------------------------------------------------
+Real PhysicsBehavior::getRetailForwardSpeed2D() const
+{
+ return calcRetailForwardSpeed( m_vel, *getObject()->getUnitDirectionVector2D() );
+}
+
//-------------------------------------------------------------------------------------------------
/**
* Return the current velocity magnitude in the forward direction.
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp
index 2e1e336bf..e4e9a6cf3 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp
@@ -2906,8 +2906,9 @@ void W3DModelDraw::handleClientTurretPositioning()
if (obj)
{
const AIUpdateInterface* ai = obj->getAIUpdateInterface();
- if (ai)
- ai->getTurretRotAndPitch((WhichTurretType)tslot, &turretAngle, &turretPitch);
+ // a turret aims from the logic heading, which the drawn hull of a tank or car trails
+ if (ai && ai->getTurretRotAndPitch((WhichTurretType)tslot, &turretAngle, &turretPitch))
+ turretAngle -= getDrawable()->getDrawnHeadingLag();
}
// do turret, if any
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index 0c3480f3b..c9e59a116 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -1851,6 +1851,24 @@ TEST(physics_forward_speed_is_the_projection_not_a_per_axis_norm)
CHECK_NEAR( PhysicsBehavior::calcForwardSpeed( climb, up ), 12.0f, 0.01f );
}
+/* EA's treads and wheels drive on EA's own measure again, which is what let a tank or car cross the
+ map diagonally 1.41 times as fast as along an axis in Zero Hour: exact on the axes, 0.707 of the
+ speed at 45 degrees, and signed by the dot product. */
+TEST(physics_retail_forward_speed_keeps_eas_per_axis_norm)
+{
+ const Real speed = 40.0f;
+ const Real d = 0.70710678f;
+ Coord3D east; east.x = 1.0f; east.y = 0.0f; east.z = 0.0f;
+ Coord3D diag; diag.x = d; diag.y = d; diag.z = 0.0f;
+ Coord3D velEast; velEast.x = speed; velEast.y = 0.0f; velEast.z = 0.0f;
+ Coord3D velDiag; velDiag.x = speed * d; velDiag.y = speed * d; velDiag.z = 0.0f;
+ Coord3D velBack; velBack.x = -speed * d; velBack.y = -speed * d; velBack.z = 0.0f;
+
+ CHECK_NEAR( PhysicsBehavior::calcRetailForwardSpeed( velEast, east ), speed, 0.01f );
+ CHECK_NEAR( PhysicsBehavior::calcRetailForwardSpeed( velDiag, diag ), speed * d, 0.01f );
+ CHECK_NEAR( PhysicsBehavior::calcRetailForwardSpeed( velBack, diag ), -speed * d, 0.01f );
+}
+
/* CommandXlat.cpp: only the attack key arms force fire. Holding ctrl used to do it too, so a
ctrl click on the ground shelled the dirt instead of moving. */
extern Bool CommandXlat_isForceAttackTargeting( Bool forceAttackArmed, Bool attackMoveArmed );