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(gameengine): leave air behind the blocker for EA's instant brake
Olcay Seygan40b3672dd021
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 50c637d67..97a2b3d7d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -380,7 +380,7 @@ found and fixed, EA's own, not port damage.**- 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.+- Columns get there sooner and bump each other less. EA's tanks stop dead, so a tank behind another now stops a short gap back instead of nosing into its tail. Over four runs each of a column through the streets of Alpine Assault, twenty Crusaders over the Golden Oasis bridge and nineteen tanks down the ramps of a generated map, the average tank arrived about a tenth sooner than before, 74 of the 80 Crusaders made it over the bridge where 67 had, and tanks spent fewer moments shoving the one ahead or wedged against it in every one of the three.- 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 feetdiff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cppindex fe460881e..3a19d066a 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp@@ -1808,12 +1808,18 @@ static const Int CROWD_PASS_RETRY = ConvertRetailFrames(10); ///< queued thisstatic const Real CROWD_TAPER_DIST = PATHFIND_CELL_SIZE_F * 8.0f; ///< the band closes over the last of the routestatic const Real CROWD_PLAN_END_SLACK = PATHFIND_CELL_SIZE_F * 3.0f; ///< how far the move state may move a planned route's end and it still be the same orderstatic const Int CROWD_BRAKE_FRAMES = ConvertRetailFrames(8); ///< frames of closing time a brake is allowed to read+/* EA's treads and wheels stop in a frame, so a brake aimed at touching the blocker touches it, and every+ touch is a blocked frame and a shove. This much air is left instead. With it, four seeds each of+ chokeprobe, bridgecross and towncross (and the slower release below) spent fewer blocked and wedged+ unit-frames than the eased vehicle drive did, and still arrived sooner. */+static const Real CROWD_BRAKE_AIR = 12.0f;static const Int CROWD_FAN_FRAMES = ConvertRetailFrames(12); ///< held up this long before spreading outstatic const Real CROWD_FAN_RATE = ConvertRetailPerFrameRate(0.8f); ///< and then sideways at this much a framestatic const Real CROWD_LANE_RATE_MIN = ConvertRetailPerFrameRate(0.4f); ///< the slowest a lane change is taken, per frame// the filters below are lerp fractions per frame, written for 30 Hzstatic const Real CROWD_SEP_FILTER = 1.0f - ConvertRetailPerFrameFactor(1.0f - 0.13f); ///< how much of a frame's sideways push is believed (~4/sec)static const Real CROWD_RELEASE_FILTER = 1.0f - ConvertRetailPerFrameFactor(1.0f - 0.15f); ///< how fast the throttle comes back once a brake lifts (~half a second to full)+static const Real CROWD_VEHICLE_RELEASE_FILTER = 1.0f - ConvertRetailPerFrameFactor(1.0f - 0.08f); ///< and for a vehicle, whose drive is back to EA's instant one (~a second to full)static const Real CROWD_AIM_CRUISE = 1.0f - ConvertRetailPerFrameFactor(1.0f - 0.23f); ///< how fast the aim follows the route while driving (~7/sec)static const Real CROWD_AIM_URGENT = 1.0f - ConvertRetailPerFrameFactor(1.0f - 0.67f); ///< and while manoeuvring (~20/sec), where lag is worse than twitchstatic const Real CROWD_AIM_DEAD = 0.035f; ///< two degrees: hold the wheel still rather than chase the noise@@ -3657,7 +3663,7 @@ void AIUpdateInterface::crowdSteer( Coord3D& goalPos, Real& speed )speed and the time it leaves is the only thing worth reading. */if (blockerMoving && !pressing){- const Real want = Crowd_brakeSpeed( speed, blockerSpeed, blockerGap, CROWD_BRAKE_FRAMES );+ const Real want = Crowd_brakeSpeed( speed, blockerSpeed, blockerGap - CROWD_BRAKE_AIR, CROWD_BRAKE_FRAMES );if (want < cap)cap = want;}@@ -3858,7 +3864,7 @@ void AIUpdateInterface::crowdSteer( Coord3D& goalPos, Real& speed )}else{- m_crowdCap = Crowd_releaseCap( m_crowdCap, cap, CROWD_RELEASE_FILTER );+ m_crowdCap = Crowd_releaseCap( m_crowdCap, cap, foot ? CROWD_RELEASE_FILTER : CROWD_VEHICLE_RELEASE_FILTER );}if (m_crowdCap < speed)