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
feat(gameengine): take a tunnel whenever it is shorter than the walk
Olcay Seygand15e021dc4c8
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 20a34b20c..d3a4ae962 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -400,7 +400,7 @@ found and fixed — EA's own, not port damage.**- Circular range checks are circles now, not the square drawn around them.- A tunnel network heals at one rate, however many entrances it has.-- GLA units take the tunnels on their own. Give a move order across the map, and if the way through your network is clearly shorter than the walk, the whole selection goes down the tunnel nearest it and comes up at the one nearest where you sent it, then walks the rest. An attack move does the same and comes up still attack-moving, and fresh units heading for a rally point across the map take the tunnels too, fighting on the way if they would have walked there fighting. Passing through does not count as resting: only units you put inside yourself are healed. The group decides together: fifteen Rebels with six places already taken all go through, where a first version sent ten underground and walked the other five. The green order line shows it: one line to the tunnel they go down and one from the tunnel they come up at to where you sent them. Twelve Rebels crossing a small map with a tunnel at each end got there in 21 seconds instead of 50, four Scorpions in 9 instead of 21. A tunnel that has just been hit is skipped, so nobody surfaces into the fire. The computer does it too: a GLA team losing a fight near one of its tunnels falls back underground and comes up at home, which happened 10 to 25 times a match in four Brutal GLA mirrors on Twilight Flame, and an attack wave takes the tunnels when they come up nearer your base than its road does. And the computer now digs them on purpose: a tunnel at home, one at the expansion it holds, and one three quarters of the way down the road its next wave will take, as long as nothing it has seen there can shoot. It does not wait for a fat bank to do it: a tunnel costs 800 and pays back on the first wave. In four Brutal GLA mirrors on Twilight Flame, 10 of 49 attack waves went underground, where none had before, and beaten teams fell back through a tunnel 250 times. Units you put in a tunnel yourself stay put, and a network they have filled is left alone: the order walks. With one place free, everybody still goes through it one after the other, since a unit passing through leaves the moment it arrives. Replays recorded before this change play out differently.+- GLA units take the tunnels on their own. Give a move order across the map, and if the way through your network is any shorter than the walk, the whole selection goes down the tunnel nearest it and comes up at the one nearest where you sent it, then walks the rest. An attack move does the same and comes up still attack-moving, and fresh units heading for a rally point across the map take the tunnels too, fighting on the way if they would have walked there fighting. The tunnels used to have to be almost a third shorter before anybody took them, so fresh units with a tunnel beside their barracks and one beside the rally point mostly walked anyway. Passing through does not count as resting: only units you put inside yourself are healed. The group decides together: fifteen Rebels with six places already taken all go through, where a first version sent ten underground and walked the other five. The green order line shows it: one line to the tunnel they go down and one from the tunnel they come up at to where you sent them. Twelve Rebels crossing a small map with a tunnel at each end got there in 21 seconds instead of 50, four Scorpions in 9 instead of 21. A tunnel that has just been hit is skipped, so nobody surfaces into the fire. The computer does it too: a GLA team losing a fight near one of its tunnels falls back underground and comes up at home, which happened 10 to 25 times a match in four Brutal GLA mirrors on Twilight Flame, and an attack wave takes the tunnels when they come up nearer your base than its road does. And the computer now digs them on purpose: a tunnel at home, one at the expansion it holds, and one three quarters of the way down the road its next wave will take, as long as nothing it has seen there can shoot. It does not wait for a fat bank to do it: a tunnel costs 800 and pays back on the first wave. In four Brutal GLA mirrors on Twilight Flame, 10 of 49 attack waves went underground, where none had before, and beaten teams fell back through a tunnel 250 times. Units you put in a tunnel yourself stay put, and a network they have filled is left alone: the order walks. With one place free, everybody still goes through it one after the other, since a unit passing through leaves the moment it arrives. Replays recorded before this change play out differently.## The power bar tells the truth@@ -438,7 +438,7 @@ found and fixed — EA's own, not port damage.**- The GLA's decoy build list toggles both ways now.- Workers go back to collecting supplies when they finish.- Workers and supply trucks walk to a pile up to 1400 feet away, the reach the computer opponent always had. Yours gave up at 700: when the pile beside your base ran dry they went home and stood there, with the next pile in plain sight.-- Every countdown reads real seconds and answers the game speed.+- Every countdown reads real seconds and answers the game speed. That means the speed the match is really running at, measured over the last second, and not the one it was set to: a barracks that says 10s in a match holding 30 frames a second says 30s once a crowded fight drags it down to 10, because that is how long you will wait for it. Build buttons, the production queue, buildings going up, the bars over your units and the bomb timers all read it.- The clock and frame-rate readout is drawn on top of everything.- The superweapon countdowns are pictures now, not a list of names: the same strip treatment, in the top right corner, under that readout. Each one wears its own seconds and a sweeping clock, the next to land sits at the right hand end, and if you are watching more than eighteen of them the rest become a count.- Every button's corner markings - the hotkey, the price, the time, the number queued - sit flush in the corners instead of floating a few pixels inside them, and are set a size smaller than the button's own text: four labels at full size were eating the picture they were meant to annotate.diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cppindex 73c376503..5504be922 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp@@ -309,8 +309,6 @@ Int TunnelTracker::getResidentCount() const}// -------------------------------------------------------------------------static const Real TUNNEL_SHORTCUT_SHARE = 0.7f; ///< the longest a way through the tunnels may be, as a share of the walk-/** Whoever moves - a player's selection, a computer's wave, a unit falling back - decides once forthe whole group, from its middle: deciding member by member split a selection, the back of itwalking while the front went underground. A network with no free place is not looked at at all,@@ -318,6 +316,8 @@ static const Real TUNNEL_SHORTCUT_SHARE = 0.7f; ///< the longest a way through tpassing through leaves by the far mouth the frame after it arrives: sixteen went through one placeas fast as through ten (tunnelqueue.txt against tunnelshortcut.txt).+ Any way through that is shorter than the walk is taken. It used to have to come in under 70% of+ it, and a rally point with a tunnel beside the factory and another beside the point still walked.The legs to and from the tunnels are straight lines. `walk` is the caller's to measure: thestraight line for a move order, the length of the path for a wave that follows one.ponytail: straight lines, not path lengths; a tunnel across a river the walk has to go round@@ -334,7 +334,7 @@ Object *TunnelTracker::findTunnelShortcut( const Coord3D *from, const Coord3D *tconst Real toEntrance = (Real)sqrt( ThePartitionManager->getDistanceSquared( entrance, from, FROM_CENTER_2D ) );const Real fromExit = (Real)sqrt( ThePartitionManager->getDistanceSquared( exit, to, FROM_CENTER_2D ) );- if( toEntrance + fromExit > walk * TUNNEL_SHORTCUT_SHARE )+ if( toEntrance + fromExit >= walk )return NULL;return entrance;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cppindex 61e731a4a..ec470a7df 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp@@ -4943,9 +4943,9 @@ void AIPlayer::doEconomy( void )static const Real TUNNEL_COVER_RADIUS = 350.0f;/** How far out along the line to the nearest enemy the forward tunnel goes, as a share of the way.- * A wave sets off from the edge of its own base, and a shortcut has to save 30% of the walk- * (TunnelTracker::findTunnelShortcut), so an exit short of the enemy's doorstep never beats walking:- * at 0.45 not one wave in four matches went underground. */+ * A wave sets off from the edge of its own base, and an exit short of the enemy's doorstep saves+ * little or nothing over walking (TunnelTracker::findTunnelShortcut): at 0.45, when a shortcut still+ * had to save 30% of the walk, not one wave in four matches went underground. */static const Real FORWARD_TUNNEL_SHARE = 0.75f;/** A tunnel network the builder can put up right now, off its own buttons. The tunnel carries