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(turkiye): kargu drones leave hangars and dive steeply

Olcay Seygan89e925ec89b0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9bd3eb153..cb97dac63 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 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. Every target in the circle gets one drone before any gets a second, and the spares go round again dearest first. A drone whose target died on the way takes the dearest enemy in the circle that no other drone is already after, and doubles up only when every one has a drone coming. 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.
+- 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 four hangar doors open, and a second later sixteen kamikaze drones roll out of them in a stream, each turning straight onto a runway, one down each runway in turn every quarter of a second, and lift off and climb; all sixteen are in the air seven seconds after you fire. Then they fly straight across the map at 150, high enough that everyone sees them coming. Each goes for one of the sixteen most expensive things inside the target circle, noses over 60 short of it into a steep dive from straight above, steers onto it all the way down so a tank driving away still takes the hit, and hits for 700, 11,200 for the whole swarm. Every target in the circle gets one drone before any gets a second, and the spares go round again dearest first. A drone whose target died on the way takes the dearest enemy in the circle that no other drone is already after, and doubles up only when every one has a drone coming. They are aircraft, so anti-air shoots them down on the way in. The last one hits twenty seconds after you fire. Fired across Twilight Flame into an undefended American base, the swarm killed six of eight Crusaders and three of six Humvees, took 69% off the War Factory, 43% off the two power plants and 29% off the Command Center, 8500 worth of the base where the shallower dive took 3900. Into eight Crusaders and six Humvees driving across the circle it killed eleven of the fourteen; the shallow dive killed two. 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.ini
index de772e639..03290bd5b 100644
--- a/GeneralsMD/Code/Data/INI/TurkiyeReforged.ini
+++ b/GeneralsMD/Code/Data/INI/TurkiyeReforged.ini
@@ -1182,10 +1182,11 @@ End
; The Kargu base's drone, drawn as the Hellfire drone. It is a jet on the MiG's frame (no other
; Turkiye object is a MiG, and ThingFactory::newObject wants one Turkiye reskin per source), so it
-; taxis out of its hangar, rolls down the runway, lifts off and climbs (JetAIUpdate's takeoff), then
-; flies straight at its target on a jet's banked turns. Its one weapon lets go of the diving drone
-; below and the jet is gone the same frame (KamikazeRange); with its target dead on the way it takes
-; the dearest enemy within 350 of itself instead. Nobody can select it, so nobody can call it home.
+; rolls out of its hangar and down the runway, lifts off and climbs (JetAIUpdate's takeoff), then
+; flies straight at its target at 150 on a jet's banked turns. Its one weapon lets go of the diving
+; drone below and the jet is gone the same frame (KamikazeRange); with its target dead on the way it
+; takes the dearest enemy within 350 of where it was sent instead. Nobody can select it, so nobody
+; can call it home.
; Shot down, it falls and bursts like a scout drone, without its warhead.
Locomotor TurkiyeKarguDroneLocomotor
@@ -1201,7 +1202,7 @@ Locomotor TurkiyeKarguDroneLocomotor
LiftDamaged = 80
Braking = 10
MinTurnSpeed = 100
- PreferredHeight = 80
+ PreferredHeight = 150
AllowAirborneMotiveForce = Yes
ZAxisBehavior = SURFACE_RELATIVE_HEIGHT
CirclingRadius = 80
@@ -1293,10 +1294,13 @@ Object TurkiyeKarguDrone
End
End
-; The drone's dive, the last 150: the Tomahawk missile drawn as the drone, let go at the drone's
-; height and speed and pointed at the target, so the swap from the jet does not show. No ignition
-; flash, no smoke trail and a steady homing locomotor, where the Tomahawk's thrust snaked. The
-; Tomahawk names no side, so a Firtina's missile stays a missile (ThingFactory::newObject).
+; The drone's dive: the Tomahawk missile drawn as the drone, let go at the drone's height and speed
+; and pointed at the target, so the swap from the jet does not show. It is let go at 60 out and 150
+; up and locks on at once (DistanceToTargetForLock 200), so the dive is the missile's kill run: a
+; straight, steep line onto the target that follows it as it drives, where the cruise and a lock at
+; 10 skimmed in at tank height and missed a moving Crusader by a tank length. No ignition flash, no
+; smoke trail. The Tomahawk names no side, so a Firtina's missile stays a missile
+; (ThingFactory::newObject).
Locomotor TurkiyeKarguDroneDiveLocomotor
Surfaces = AIR
@@ -1308,7 +1312,7 @@ Locomotor TurkiyeKarguDroneDiveLocomotor
MaxThrustAngle = 15
AllowAirborneMotiveForce = Yes
Appearance = THRUST
- PreferredHeight = 80
+ PreferredHeight = 150
AirborneTargetingHeight = 30
PreferredHeightDamping = 0.7
End
@@ -1336,7 +1340,7 @@ Object TurkiyeKarguDroneDive
InitialVelocity = 160
DistanceToTravelBeforeTurning = 10
DistanceToTargetBeforeDiving = 120
- DistanceToTargetForLock = 10
+ DistanceToTargetForLock = 200
End
Locomotor = SET_NORMAL TurkiyeKarguDroneDiveLocomotor
End
diff --git a/GeneralsMD/Code/Data/INI/TurkiyeWeaponReforged.ini b/GeneralsMD/Code/Data/INI/TurkiyeWeaponReforged.ini
index c167e25d1..26e7eeb19 100644
--- a/GeneralsMD/Code/Data/INI/TurkiyeWeaponReforged.ini
+++ b/GeneralsMD/Code/Data/INI/TurkiyeWeaponReforged.ini
@@ -837,17 +837,18 @@ Weapon TurkiyeSwarmStrikeWeapon
AntiAirborneInfantry = No
End
-; The Kargu drone's one shot, itself (TurkiyeKarguBase, TurkiyeKarguDrone): within 150 of its
-; target the jet lets go of the diving drone, a projectile, and is gone. Unlike the rank tree's
-; munitions it can be seen coming and shot down on the way. 700 kills any tank but the Overlord and
-; the Emperor, and twelve of them are the Scud Storm's nine missiles spread over a wider circle.
+; The Kargu drone's one shot, itself (TurkiyeKarguBase, TurkiyeKarguDrone): 60 short of its target
+; and 150 above it the jet lets go of the diving drone, a projectile, and is gone, so the dive comes
+; down steeply from above. Unlike the rank tree's munitions it can be seen coming and shot down on
+; the way. 700 kills any tank but the Overlord and the Emperor, and sixteen of them are the Scud
+; Storm's nine missiles spread over a wider circle.
; RETURN_TO_BASE with a clip of one is what tells the jet it has fired (JetAIUpdate KamikazeRange).
Weapon TurkiyeKarguDroneWeapon
PrimaryDamage = 700.0
PrimaryDamageRadius = 20.0
SecondaryDamage = 150.0
SecondaryDamageRadius = 50.0
- AttackRange = 150.0
+ AttackRange = 60.0
AcceptableAimDelta = 30
DamageType = EXPLOSION
DeathType = EXPLODED
diff --git a/GeneralsMD/Code/Data/Scenarios/kargu.txt b/GeneralsMD/Code/Data/Scenarios/kargu.txt
index a47f589a2..35da9e1d1 100644
--- a/GeneralsMD/Code/Data/Scenarios/kargu.txt
+++ b/GeneralsMD/Code/Data/Scenarios/kargu.txt
@@ -1,11 +1,12 @@
# 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 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
+# called at frame 60. The hangar doors open, and a second later the sixteen drones roll out of the
+# hangars onto the base's two runways in turn, one every quarter second, climb away to 150 and fly
+# the 1400 to the American base; a SCRAMBLE line says when each one started its roll (the last under
+# five seconds after the call) and a KAMIKAZE line where it began its dive, 150 over its target.
+# 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 700, 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.
#
@@ -36,9 +37,10 @@
400 tally 0 TurkiyeKarguDroneDive
500 tally 0 TurkiyeKarguDrone
500 tally 0 TurkiyeKarguDroneDive
-500 tally 1 AmericaWarFactory
-500 tally 1 AmericaPowerPlant
-500 tally 1 AmericaCommandCenter
-500 tally 1 AmericaTankCrusader
-500 tally 1 AmericaVehicleHumvee
-500 tally 1 *
+700 tally 0 TurkiyeKarguDrone
+700 tally 1 AmericaWarFactory
+700 tally 1 AmericaPowerPlant
+700 tally 1 AmericaCommandCenter
+700 tally 1 AmericaTankCrusader
+700 tally 1 AmericaVehicleHumvee
+700 tally 1 *
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h
index 85194c390..f5f4932e2 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h
@@ -158,8 +158,9 @@ 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 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)
+ /// a new jet of this kind rolls out of a hangar and 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:
@@ -224,6 +225,7 @@ private:
void purgeDead();
void resetWakeFrame();
void launchScramble();
+ void holdHangarDoorsOpen( Bool hold );
ParkingPlaceInfo* findPPI(ObjectID id);
ParkingPlaceInfo* findEmptyPPI();
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp
index 9f6d218c8..4cc437895 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp
@@ -703,6 +703,8 @@ void ParkingPlaceBehavior::onDie( const DamageInfo *damageInfo )
// the old owner's scramble was aimed at the old owner's enemies
void ParkingPlaceBehavior::onCapture( Player *oldOwner, Player *newOwner )
{
+ if( !m_scrambles.empty() )
+ holdHangarDoorsOpen( false );
m_scrambles.clear();
}
@@ -710,10 +712,32 @@ void ParkingPlaceBehavior::onCapture( Player *oldOwner, Player *newOwner )
// 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;
+// the model's hangars: the first rows of spaces, one hangar to a runway in each row
+const Int HANGAR_ROWS = 2;
+// the hangar doors take two seconds to open; the first jet rolls when they are half way
+const UnsignedInt HANGAR_DOOR_LEAD_FRAMES = LOGICFRAMES_PER_SECOND;
+
+//-------------------------------------------------------------------------------------------------
+/// hold every hangar door open, or let go of those no jet holds a space behind
+void ParkingPlaceBehavior::holdHangarDoorsOpen( Bool hold )
+{
+ ProductionUpdateInterface* pu = getObject()->getProductionUpdateInterface();
+ const Int hangars = HANGAR_ROWS * (Int)m_runways.size();
+ for( Int i = 0; i < hangars; ++i )
+ {
+ if( hold || m_spaces[ i ].m_objectInSpace == INVALID_ID )
+ pu->setHoldDoorOpen( m_spaces[ i ].m_door, hold );
+ }
+}
//-------------------------------------------------------------------------------------------------
void ParkingPlaceBehavior::scramble( const ThingTemplate *jet, ObjectID target, const Coord3D *pos )
{
+ if( m_scrambles.empty() )
+ {
+ holdHangarDoorsOpen( true );
+ m_nextScrambleFrame = TheGameLogic->getFrame() + HANGAR_DOOR_LEAD_FRAMES;
+ }
ScrambleInfo info;
info.m_jet = jet;
info.m_target = target;
@@ -722,11 +746,13 @@ void ParkingPlaceBehavior::scramble( const ThingTemplate *jet, ObjectID target,
}
//-------------------------------------------------------------------------------------------------
-/** 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
+/** The next scrambled jet, when its turn has come: it comes out of one of its runway's two hangars,
+ * whose doors the swarm holds open, and starts its takeoff roll at once (JetAIUpdate::
+ * friend_takeOffNow), straight out of the door onto the runway, with no 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. */
+ * The runways take turns by the count left, and a runway's hangars by the count after that; 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()
{
@@ -751,9 +777,10 @@ void ParkingPlaceBehavior::launchScramble()
Object *jet = TheThingFactory->newObject( next.m_jet, getObject()->getControllingPlayer()->getDefaultTeam() );
jet->setProducer( getObject() );
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 ) );
+ const Int hangarRow = ( (Int)m_scrambles.size() / (Int)m_runways.size() ) % HANGAR_ROWS;
+ const ParkingPlaceInfo& hangar = m_spaces[ hangarRow * (Int)m_runways.size() + runway ];
+ jet->setPosition( &hangar.m_hangarStart );
+ jet->setOrientation( hangar.m_hangarStartOrient );
TheAI->pathfinder()->addObjectToPathfindMap( jet );
JetAIUpdate *jetAI = jet->getAIUpdateInterface()->getJetAIUpdate();
@@ -767,12 +794,14 @@ void ParkingPlaceBehavior::launchScramble()
else
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,
+ DEBUG_LOG(( "SCRAMBLE frame %d '%s' %d from hangar %d down runway %d at %d (%.0f,%.0f), %d to go\n", now,
+ next.m_jet->getName().str(), jet->getID(), hangarRow, runway, next.m_target, next.m_pos.x, next.m_pos.y,
(Int)m_scrambles.size() - 1 ));
m_scrambles.pop_front();
m_nextScrambleFrame = now + SCRAMBLE_INTERVAL_FRAMES;
+ if( m_scrambles.empty() )
+ holdHangarDoorsOpen( false );
}
//-------------------------------------------------------------------------------------------------