AEWC optimizations

- setting for on-station time
- always include CVN carriers as targets
- autoplanner adjustment for continuous coverage
This commit is contained in:
Raffson 2024-12-24 05:02:09 +01:00
parent 2c2573240a
commit 1a628888f7
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
4 changed files with 33 additions and 5 deletions

View File

@ -12,7 +12,7 @@ from game.utils import Distance, Heading, Speed, knots, meters, nautical_miles
class AewcFlightPlan(PatrollingFlightPlan[PatrollingLayout]):
@property
def patrol_duration(self) -> timedelta:
return timedelta(hours=4)
return self.flight.coalition.game.settings.desired_awacs_mission_duration
@property
def patrol_speed(self) -> Speed:

View File

@ -12,6 +12,7 @@ from game.theater import MissionTarget
if TYPE_CHECKING:
from game.coalition import Coalition
from game.ato import Package
class MissionScheduler:
@ -41,6 +42,7 @@ class MissionScheduler:
]
carrier_etas = []
previous_aewc_end_time: dict[MissionTarget, datetime] = defaultdict(now.replace)
start_time = start_time_generator(
count=len(non_dca_packages),
@ -62,14 +64,19 @@ class MissionScheduler:
else:
package.time_over_target = previous_end_time
departure_time = package.mission_departure_time
# Should be impossible for CAPs
departure_time = self._get_departure_time(package)
if departure_time is None:
logging.error(f"Could not determine mission end time for {package}")
continue
previous_cap_end_time[package.target] = departure_time
elif package.auto_asap:
package.set_tot_asap(now)
elif package.primary_task is FlightType.AEWC:
last = previous_aewc_end_time[package.target]
package.time_over_target = tot if tot > last else last
departure_time = self._get_departure_time(package)
if departure_time is None:
continue
previous_aewc_end_time[package.target] = departure_time
else:
# But other packages should be spread out a bit. Note that take
# times are delayed, but all aircraft will become active at
@ -94,3 +101,11 @@ class MissionScheduler:
package.time_over_target = carrier_etas.pop(0)
else:
break
@staticmethod
def _get_departure_time(package: Package) -> datetime | None:
departure_time = package.mission_departure_time
# Should be impossible for CAP/AEWC
if departure_time is None:
logging.error(f"Could not determine mission end time for {package}")
return departure_time

View File

@ -185,6 +185,9 @@ class TheaterState(WorldState["TheaterState"]):
if not bp.blocking_capture or cp.is_fleet
]
aewc_targets = [cp for cp in finder.friendly_control_points() if cp.is_carrier]
aewc_targets.append(finder.farthest_friendly_control_point())
return TheaterState(
context=context,
barcaps_needed={
@ -194,7 +197,7 @@ class TheaterState(WorldState["TheaterState"]):
active_front_lines=list(finder.front_lines()),
front_line_stances={f: None for f in finder.front_lines()},
vulnerable_front_lines=list(finder.front_lines()),
aewc_targets=[finder.farthest_friendly_control_point()],
aewc_targets=list(aewc_targets),
refueling_targets=[finder.closest_friendly_control_point()],
recovery_targets={cp: 0 for cp in finder.friendly_naval_control_points()},
enemy_air_defenses=list(finder.enemy_air_defenses()),

View File

@ -214,6 +214,16 @@ class Settings:
),
)
# CAMPAIGN DOCTRINE
desired_awacs_mission_duration: timedelta = minutes_option(
"Desired AWACS on-station time",
page=CAMPAIGN_DOCTRINE_PAGE,
section=GENERAL_SECTION,
default=timedelta(minutes=120),
min=60,
max=300,
detail="Implicitly determines the number of AWACS flights planned by taking the mission duration"
" and dividing it by the desired on-station time.",
)
autoplan_tankers_for_strike: bool = boolean_option(
"Auto-planner plans refueling flights for Strike packages",
page=CAMPAIGN_DOCTRINE_PAGE,