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(turkiye): sixteen kargu drones take off in a stream
Olcay Seygan4bb6aefd2020
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0f63fc2ae..3ca8981aa 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -146,7 +146,7 @@ found and fixed — EA's own, not port damage.**- The Korkut is air defense and nothing else. Its cannons reach 350 into the air and no longer fire at the ground, where they used to outrange the Altay; three Korkut that cut down eight Rangers without a scratch now lose to them, and still shoot down three Comanches untouched. The Kizilelma's missiles hit the ground as well as the air, and it costs 1800 instead of 2200. It carried 380 health on a Raptor's frame and shot a Raptor down in 29 seconds while the Raptor needed 86 for it; at the Raptor's 160 the duel is even and the dearer jet loses on price. The Akinci drops its own bomb, one a sortie; it had been dropping the Aurora's. With 420 health no ground air defense paid for itself against it. At 200 a Gattling Tank or a Missile Defender beats it for the money and a Quad Cannon breaks even.- Every Turkish unit has its own command bar with only buttons that work: no drone buttons on the Altay and the Cobra, no TOW on the Cobra, no rocket pods on the Bayraktar, no flash-bang switch on the Mehmetcik. The Barracks sells Capture Building, so the Mehmetcik's capture button works.- Turkiye's first rank buys its own power, a Minefield a cargo plane sows wherever you point, beside the Spy Drone and Fuel Resupply, which keeps the drones over the target longer. Rank 3 offers a loitering munition that dives on whatever it is pointed at, Electronic Blinding, which shuts every enemy radar in the area off for 30 seconds, and Rapid Deployment, six Mehmetcik and two Sungur gunners by parachute. The top rank buys the Swarm Strike: ten munitions over a wide circle, each on a different target and the most expensive first, so a column of tanks loses its tanks and the riflemen walking beside them are left standing. Beside it sit the Fire Mission, 36 heavy shells from off the map, and the Commando Raid, a Maroon Beret and two spotter teams dropped behind the enemy's lines. The American Paradrop, Leaflet Drop, Spectre gunship and CIA intelligence are gone from the Headquarters and the power bar.-- Turkiye has a superweapon: the Kargu Drone Base. It costs 5000, draws 10 power, opens once you have a Factory and a Radar Tower, counts against the lobby's superweapon limit like the Particle Cannon, the nuke and the Scud Storm, and every player watches its five-minute countdown. The base is an airfield with two runways and four hangars, and you tell it from Turkiye's own airfield at a glance because it wears China's. Fire it and the twelve kamikaze drones roll out of the hangars one after another, run down the runways, lift off and climb, then fly straight across the map where everyone can see them coming. Each goes for one of the twelve most expensive things inside the target circle, tips into its dive about 120 short and hits for 700. With fewer targets than drones the spares go round again, dearest first, and a drone whose target died on the way takes the dearest enemy left in the circle. They are aircraft, so anti-air shoots them down on the way in. The last drone leaves its hangar thirteen seconds after you fire and the last one hits after twenty-seven. Fired across Twilight Flame into an undefended American base, the swarm killed three of eight Crusaders and three of six Humvees, took 39% off the War Factory, 43% off the two power plants and 11% off the Command Center. The Turkish computer builds and fires it on every difficulty: Hard as soon as it can pay, about fifteen minutes in on that map, Medium after seventeen minutes and Easy after thirty, the same clock America's plans keep for their Particle Cannon. China's airfield and the Hellfire drone are on loan, and the announcer calls it a Scud Storm until Turkiye has art and voices of its own.+- Turkiye has a superweapon: the Kargu Drone Base. It costs 5000, draws 10 power, opens once you have a Factory and a Radar Tower, counts against the lobby's superweapon limit like the Particle Cannon, the nuke and the Scud Storm, and every player watches its five-minute countdown. The base is an airfield with two runways and four hangars, and you tell it from Turkiye's own airfield at a glance because it wears China's. Fire it and sixteen kamikaze drones take off in a stream, one down each runway in turn every quarter of a second, roll, lift off and climb, and all sixteen are in the air under six seconds after you fire. Then they fly straight across the map where everyone can see them coming. Each goes for one of the sixteen most expensive things inside the target circle, tips into its dive about 120 short and hits for 700, 11,200 for the whole swarm. With fewer targets than drones the spares go round again, dearest first, and a drone whose target died on the way takes the dearest enemy left in the circle. They are aircraft, so anti-air shoots them down on the way in. The last one hits fourteen seconds after you fire. Fired across Twilight Flame into an undefended American base, the swarm killed two of eight Crusaders and three of six Humvees, took 35% off the War Factory, 43% off the two power plants and 19% off the Command Center. The Turkish computer builds and fires it on every difficulty: Hard as soon as it can pay, about fifteen minutes in on that map, Medium after seventeen minutes and Easy after thirty, the same clock America's plans keep for their Particle Cannon. China's airfield and the Hellfire drone are on loan, and the announcer calls it a Scud Storm until Turkiye has art and voices of its own.- Two engineers on one building put it up in half the time, three in a third.- The Koral electronic warfare vehicle jams everything within 400 of it. Enemy drones and spotters inside the field go nearly blind, and guided missiles fired into it lose their lock and fly wide.- The Maroon Beret is a hero against every side. He is camouflaged, sees 350 for the artillery from inside the camouflage, and carries Burton's knife and timed and remote charges. He no longer hijacks supply trucks, which used him up for good and found nothing to take from America.diff --git a/GeneralsMD/Code/Data/INI/TurkiyeReforged.ini b/GeneralsMD/Code/Data/INI/TurkiyeReforged.iniindex c580b9b76..de772e639 100644--- a/GeneralsMD/Code/Data/INI/TurkiyeReforged.ini+++ b/GeneralsMD/Code/Data/INI/TurkiyeReforged.ini@@ -231,12 +231,12 @@ Object TurkiyeRadarTowerEndEnd-; The Kargu base, Turkiye's superweapon: a drone airfield whose swarm of twelve kamikaze drones-; flies out to the twelve dearest targets in a wide circle and dives into them. With fewer than-; twelve targets in the circle the spare drones go round them again, dearest first. The drones are-; jets (TurkiyeKarguDrone): each one rolls out of a hangar, down one of the two runways and climbs-; away, and the four hangars send the twelve out as they empty, one every half second at most-; (ParkingPlaceBehavior::scramble). It is China's airfield, so it looks nothing like Turkiye's own,+; The Kargu base, Turkiye's superweapon: a drone airfield whose swarm of sixteen kamikaze drones+; flies out to the sixteen dearest targets in a wide circle and dives into them. With fewer than+; sixteen targets in the circle the spare drones go round them again, dearest first. The drones are+; jets (TurkiyeKarguDrone): each one starts on the threshold of one of the two runways, rolls down+; it and climbs away, the runways in turn, one drone every quarter second, so the last is rolling+; under four seconds after the call (ParkingPlaceBehavior::scramble). It is China's airfield, so it looks nothing like Turkiye's own,; the American one, and it carries what the Particle Cannon lent it before: price, build time,; power draw, health and armour, the superweapon limit and the public countdown. Turkiye has no; Strategy Center, so the Factory and a Radar Tower open it: an Easy computer, on America's Easy@@ -280,11 +280,12 @@ Object TurkiyeKarguBaseSubdualDamageHealAmount = 100EndEnd- ; China's airfield, but a drone's climb out ends at 30 rather than 50, and its hangar is free sooner+ ; China's airfield, but a drone's climb out ends at 30 rather than 50, and a space for each of the+ ; sixteen drones: they start on the runways, eight to a runway, so only the runway of a space countsReplaceModule ModuleTag_10Behavior = ParkingPlaceBehavior ModuleTag_10_TurkiyeHealAmountPerSecond = 10- NumRows = 2+ NumRows = 8NumCols = 2HasRunways = YesApproachHeight = 30@@ -303,7 +304,7 @@ Object TurkiyeKarguBaseBehavior = SwarmStrikeSpecialPower ModuleTag_TurkiyeKarguSwarmSpecialPowerTemplate = SuperweaponTurkiyeKarguSwarmRadius = 350- TargetCount = 12+ TargetCount = 16RepeatTargets = YesDrone = TurkiyeKarguDroneEnddiff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.strindex 015ed2e07..79322d790 100644--- a/GeneralsMD/Code/Data/Patch.str+++ b/GeneralsMD/Code/Data/Patch.str@@ -3203,7 +3203,7 @@ CONTROLBAR:ConstructTurkiyeKarguBaseENDCONTROLBAR:ToolTipTurkiyeKarguBase-"Sends a swarm of twelve kamikaze drones anywhere on the map. Each one hunts down one of the most valuable targets in the circle and dives into it; spread-out armies suffer most. \n \n Requires: Factory, Radar Tower \n Energy Required: 10 \n Recharge: 5:00"+"Sends a swarm of sixteen kamikaze drones anywhere on the map. Each one hunts down one of the most valuable targets in the circle and dives into it; spread-out armies suffer most. \n \n Requires: Factory, Radar Tower \n Energy Required: 10 \n Recharge: 5:00"ENDCONTROLBAR:TurkiyeKarguSwarmdiff --git a/GeneralsMD/Code/Data/Scenarios/kargu.txt b/GeneralsMD/Code/Data/Scenarios/kargu.txtindex a420946fe..a47f589a2 100644--- a/GeneralsMD/Code/Data/Scenarios/kargu.txt+++ b/GeneralsMD/Code/Data/Scenarios/kargu.txt@@ -1,13 +1,13 @@# Turkiye's Kargu base fired across Twilight Flame into an American base: a War Factory, two power# plants and the command centre, eight Crusaders and six Humvees spread around them. The swarm is-# called at frame 60. The drones roll out of the base's four hangars, take off from its two runways-# one after another and fly the 1400 to the American base; a SCRAMBLE line says when each one left-# its hangar (the last about 13 seconds after the call) and a KAMIKAZE line where it began its dive-# (the last about 27 seconds after). The tallies of TurkiyeKarguDrone count the jets rolling or in-# the air, those of TurkiyeKarguDroneDive the drones in their dive. Compare the American tallies at-# frame 50 and at frame 950, after the last hit and before the buildings heal, and read the SWARM-# lines for the targets the drones were sent at. SCRAMBLE and KAMIKAZE count logic frames, 60 a-# second; the frames of this file are 30 a second.+# called at frame 60. The sixteen drones start on the base's two runways in turn, one every quarter+# second, roll down them, climb away and fly the 1400 to the American base; a SCRAMBLE line says+# when each one started its roll (the last under four seconds after the call) and a KAMIKAZE line+# where it began its dive (the last about 14 seconds after). The tallies of TurkiyeKarguDrone count+# the jets rolling or in the air, those of TurkiyeKarguDroneDive the drones in their dive. Compare+# the American tallies at frame 50 and at frame 500, just after the last hit and before the American+# dozers repair the buildings, and read the SWARM lines for the targets the drones were sent at.+# SCRAMBLE and KAMIKAZE count logic frames, 60 a second; the frames of this file are 30 a second.## generals.exe -headless -quickstart -noshellmap -observer -multiInstance -noFPSLimit# -map "Maps\Twilight Flame\Twilight Flame.map" -autoskirmish 2 -takeover@@ -36,14 +36,9 @@400 tally 0 TurkiyeKarguDroneDive500 tally 0 TurkiyeKarguDrone500 tally 0 TurkiyeKarguDroneDive-600 tally 0 TurkiyeKarguDrone-600 tally 0 TurkiyeKarguDroneDive-700 tally 0 TurkiyeKarguDrone-800 tally 0 TurkiyeKarguDrone-950 tally 0 TurkiyeKarguDrone-950 tally 1 AmericaWarFactory-950 tally 1 AmericaPowerPlant-950 tally 1 AmericaCommandCenter-950 tally 1 AmericaTankCrusader-950 tally 1 AmericaVehicleHumvee-950 tally 1 *+500 tally 1 AmericaWarFactory+500 tally 1 AmericaPowerPlant+500 tally 1 AmericaCommandCenter+500 tally 1 AmericaTankCrusader+500 tally 1 AmericaVehicleHumvee+500 tally 1 *diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.strindex 5c9ae3819..89166dd7a 100644--- a/GeneralsMD/Code/Data/Turkish/Generals.str+++ b/GeneralsMD/Code/Data/Turkish/Generals.str@@ -17500,7 +17500,7 @@ CONTROLBAR:ConstructTurkiyeKarguBaseENDCONTROLBAR:ToolTipTurkiyeKarguBase-"Haritanın herhangi bir yerine on iki kamikaze İHA'dan oluşan bir sürü gönderir. Her biri dairedeki en değerli hedeflerden birini bulur ve üstüne dalar; dağınık ordular en çok zarar görür. \n \n Gereken: Fabrika, Radar Kulesi \n Gereken Enerji: 10 \n Geri Sayım: 5:00"+"Haritanın herhangi bir yerine on altı kamikaze İHA'dan oluşan bir sürü gönderir. Her biri dairedeki en değerli hedeflerden birini bulur ve üstüne dalar; dağınık ordular en çok zarar görür. \n \n Gereken: Fabrika, Radar Kulesi \n Gereken Enerji: 10 \n Geri Sayım: 5:00"ENDCONTROLBAR:TurkiyeKarguSwarmdiff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.hindex ced9d50c5..1a80c9c63 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.h@@ -140,6 +140,8 @@ public:void friend_purgePendingCommand();/// a kamikaze whose target dies on the way looks for another here, and dives here when there is nonevoid friend_setKamikazeArea( const Coord3D *pos ) { m_kamikazeArea = *pos; }+ /// put on its runway's threshold with its space reserved, it starts the takeoff roll now+ void friend_takeOffNow();protected:diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.hindex 6fc4211e9..85194c390 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h@@ -158,8 +158,8 @@ public:virtual const std::vector<Coord3D>* getTaxiLocations( ObjectID id ) const { return NULL; }virtual const std::vector<Coord3D>* getCreationLocations( ObjectID id ) const { return NULL; }- /// a new jet of this kind comes out of the next free space, one every half second at most, and is- /// sent at the target, or at the point when the target is gone by then (the Kargu base's swarm)+ /// a new jet of this kind rolls down the runways in turn, one every quarter second, and is sent at+ /// the target, or at the point when the target is gone by then (the Kargu base's swarm)void scramble( const ThingTemplate *jet, ObjectID target, const Coord3D *pos );private:diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cppindex f4a6e4fcb..9f6d218c8 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp@@ -707,8 +707,9 @@ void ParkingPlaceBehavior::onCapture( Player *oldOwner, Player *newOwner )}//--------------------------------------------------------------------------------------------------// one scrambled jet at most every this many frames, so a full field does not roll out on one frame-const UnsignedInt SCRAMBLE_INTERVAL_FRAMES = LOGICFRAMES_PER_SECOND / 2;+// one scrambled jet every this many frames, the runways in turn, so each runway sends one every+// half second and a jet is 15 down its runway, about a drone's length, when the next one starts+const UnsignedInt SCRAMBLE_INTERVAL_FRAMES = LOGICFRAMES_PER_SECOND / 4;//-------------------------------------------------------------------------------------------------void ParkingPlaceBehavior::scramble( const ThingTemplate *jet, ObjectID target, const Coord3D *pos )@@ -721,8 +722,11 @@ void ParkingPlaceBehavior::scramble( const ThingTemplate *jet, ObjectID target,}//--------------------------------------------------------------------------------------------------/** The next scrambled jet, when its turn has come and a space is free: it comes out of the hangar- * like a built one and is handed its target, which it takes off for. */+/** The next scrambled jet, when its turn has come: it appears on its runway's threshold and starts+ * its takeoff roll at once (JetAIUpdate::friend_takeOffNow), with no hangar, taxi or queue for the+ * runway, so a swarm is in the air within seconds rather than four at a time out of the hangars.+ * The runways take turns by the count left, and a jet holds one of the spaces, the runway's, until+ * it is airborne; the field has a space for every jet of a swarm. *///-------------------------------------------------------------------------------------------------void ParkingPlaceBehavior::launchScramble(){@@ -730,25 +734,41 @@ void ParkingPlaceBehavior::launchScramble()if( m_scrambles.empty() || now < m_nextScrambleFrame )return;- const ScrambleInfo& next = m_scrambles.front();- ExitDoorType door = reserveDoorForExit( next.m_jet, NULL );- if( door == DOOR_NONE_AVAILABLE )+ const Int runway = (Int)m_scrambles.size() % (Int)m_runways.size();+ ParkingPlaceInfo* space = NULL;+ for( std::vector<ParkingPlaceInfo>::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it )+ {+ if( it->m_runway == runway && it->m_objectInSpace == INVALID_ID && !it->m_reservedForExit )+ {+ space = &(*it);+ break;+ }+ }+ if( space == NULL )return;+ const ScrambleInfo& next = m_scrambles.front();Object *jet = TheThingFactory->newObject( next.m_jet, getObject()->getControllingPlayer()->getDefaultTeam() );jet->setProducer( getObject() );- exitObjectViaDoor( jet, door );- jet->getAIUpdateInterface()->getJetAIUpdate()->friend_setKamikazeArea( &next.m_pos );-+ space->m_objectInSpace = jet->getID();+ const RunwayInfo& strip = m_runways[ runway ];+ jet->setPosition( &strip.m_start );+ jet->setOrientation( ATan2( strip.m_end.y - strip.m_start.y, strip.m_end.x - strip.m_start.x ) );+ TheAI->pathfinder()->addObjectToPathfindMap( jet );++ JetAIUpdate *jetAI = jet->getAIUpdateInterface()->getJetAIUpdate();+ jetAI->friend_setKamikazeArea( &next.m_pos );// a script's order: a human player's unit given CMD_FROM_AI will not fly out of its sight to chase- // (AIAttackApproachTargetState), and this target is a map away+ // (AIAttackApproachTargetState), and this target is a map away. On the ground the jet keeps it as+ // its pending command and flies it once airborne.Object *target = TheGameLogic->findObjectByID( next.m_target );if( target && !target->isEffectivelyDead() )- jet->getAIUpdateInterface()->aiAttackObject( target, NO_MAX_SHOTS_LIMIT, CMD_FROM_SCRIPT );+ jetAI->aiAttackObject( target, NO_MAX_SHOTS_LIMIT, CMD_FROM_SCRIPT );else- jet->getAIUpdateInterface()->aiAttackPosition( &next.m_pos, NO_MAX_SHOTS_LIMIT, CMD_FROM_SCRIPT );- DEBUG_LOG(( "SCRAMBLE frame %d '%s' %d from door %d at %d (%.0f,%.0f), %d to go\n", now,- next.m_jet->getName().str(), jet->getID(), (Int)door, next.m_target, next.m_pos.x, next.m_pos.y,+ jetAI->aiAttackPosition( &next.m_pos, NO_MAX_SHOTS_LIMIT, CMD_FROM_SCRIPT );+ jetAI->friend_takeOffNow();+ DEBUG_LOG(( "SCRAMBLE frame %d '%s' %d down runway %d at %d (%.0f,%.0f), %d to go\n", now,+ next.m_jet->getName().str(), jet->getID(), runway, next.m_target, next.m_pos.x, next.m_pos.y,(Int)m_scrambles.size() - 1 ));m_scrambles.pop_front();diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cppindex d455f83e0..e7175ba3d 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp@@ -2627,6 +2627,16 @@ Bool JetAIUpdate::getTreatAsAircraftForLocoDistToGoal() const}}+//----------------------------------------------------------------------------------------+/** A scrambled jet skips the taxi, the wait for the runway and the pause on it: the order it was+ * given stays pending, as on any jet on the ground, and is flown once it is airborne. */+void JetAIUpdate::friend_takeOffNow()+{+ getStateMachine()->clear();+ getStateMachine()->setState( TAKING_OFF );+ friend_enableAfterburners( true );+}+//----------------------------------------------------------------------------------------/*** Follow the path defined by the given array of points