1605 Commits

Author SHA1 Message Date
Dan Albert
c010ef9994 Add support for DCS 2.9's AI unlimited fuel.
This is enabled by default because I can't think of a time where it's
ever been more fun to watch the AI run out of fuel after cycling between
afterburner and speedbrake for twenty minutes.

This is only lightly tested (I verified that the task shows up
appropriately in the ME when set, not when unset, and never for
players), since the interesting part of the implementation is up to ED.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3201.
2023-11-01 18:08:04 -07:00
zhexu14
ac2fbc2940
Support planning TARCAP at last airfield.
This PR addresses #771 by adding special handling for the scenario where
there is only one remaining enemy airfield. An example of the race track
generated using this logic is shown below.

![Screenshot 2023-10-31
230938](https://github.com/dcs-liberation/dcs_liberation/assets/64713351/3fb2027e-f496-4325-a3c5-2abe2a45b58f)

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/771.
2023-11-01 16:52:35 -07:00
Dan Albert
376c1137d7 Fix stale waypoint tasks for custom flight plans.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3189.
2023-10-21 15:35:05 -07:00
Dan Albert
884993dd46 Fix empty string CLSID issue for default loadouts.
We had two different paths for converting pydcs loadouts because pydcs's
APIs for some reason return the loadouts in different shapes which made
it difficult to share the code for converting them. Rather than fix the
bug in both places, extract the common code and adapt the result of one
API to match the other.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3171.
2023-10-20 14:47:40 -07:00
Dan Albert
c5d5ea81de Ensure speed lock for waypoint 0.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3195.
2023-10-20 14:28:19 -07:00
Dan Albert
0e01aaf9cd Filter out empty string CLSIDs.
There's more detail in the comment, but this fixes an issue where some
Mosquito loadouts could not be loaded.

Might fix https://github.com/dcs-liberation/dcs_liberation/issues/3171.
There aren't enough instructions in the bug for me to be sure, but it
sounds like a similar problem, although I came across it with bombs
rather than rockets.
2023-10-20 14:22:36 -07:00
Dan Albert
dfb74cfd48 Fix kneeboard generation following Pillow update.
We don't have tests for this, so dependabot broke it and we didn't
notice.
2023-10-19 19:47:36 -07:00
Dan Albert
256c9ce73d Add a package kneeboard page.
The package page shows each flight member in the whole package. The data
shown for now is the callsign, task, radio frequency, and laser code.
The STN for each flight will be added once that's done.

This does generate one package page per flight. That means that packages
where multiple flights have players and use the same aircraft type will
have some duplicated pages, but the alternative is that some players
would need to skip past all their flight members' pages to find their
package page instead of having it grouped with their own.
2023-10-03 21:50:29 -07:00
Dan Albert
e9133bffab Group briefing data by package.
This is just the refactor to make way for the real change: adding a
package page to the kneeboard so players can get package-level
information like other radio, laser, and STNs.
2023-10-03 21:50:29 -07:00
zhexu14
f9916e47d8 address issue 3175 by introducing special divide by zero handling 2023-10-01 23:08:05 -07:00
zhexu14
20574e3fbb address issue 3162 by applying threshold to CVN position check 2023-10-01 16:10:10 -07:00
Dan Albert
69ec9adec7 Remove code for old squadron rules. 2023-10-01 12:21:37 -07:00
Dan Albert
63584321c6 Bump campaign version for squadron sizes.
The old mode where squadrons started empty and had no size limit is
going away.

I bumped the campaign versions for the ones that claimed support and
tested a handful. All of Fuzzle's campaigns actually had the wrong
version in the yaml. They claim support for this but none that I tested
actually fit within the limits (despite having sizes defined). Either it
was supposed to be 10.7, or maybe the airports lost some parking.
2023-10-01 12:21:37 -07:00
Dan Albert
2344fc0b5c Add campaign support for ferry-only bases.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3170.
2023-09-21 21:34:31 -07:00
Dan Albert
e43874e553 Increase max distance for waypoint solver.
1000km isn't large enough in the case where there's an off-map spawn
that's a long way from the target, but still in range for aircraft like
the B-1. Double it, which for now is enough to fix the one pathological
case we know.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3156.
2023-09-20 22:02:01 -07:00
Dan Albert
3862ec1b2e Convert escort request to a waypoint property.
Another step in reducing the rigidity of FlightPlan and making it
testable.

There is one intentional behavior change here: escort flights no longer
request escorts. That actually has a very minimal effect because these
properties are only used for two things: determining if a package needs
escorts or not, and determining when the TARCAP should show up and
leave. Since escorts won't have been in the package when the first part
happens anyway, that has no effect. The only change is that TARCAP won't
show up earlier or stay later just because of a TOT offset for an escort
flight.
2023-09-11 22:25:58 -07:00
Dan Albert
502d37058c Remove dead code. 2023-09-11 20:51:16 -07:00
Dan Albert
b7723843c6 Migrate sweep ingress's tasks to waypoint actions. 2023-08-29 21:57:17 -07:00
Dan Albert
c00f853f34 Roll-over excess time from tasks. 2023-08-29 21:57:17 -07:00
Dan Albert
cb9063b5be Remove bingo estimates from FlightPlan.
This doesn't need to be a part of FlightPlan, and it's easier to test if
it isn't. Move it out and add the tests.

It's pretty misleading to allow this in the core of the flight plan code
anything. This is an extremely unreliable estimate for most aircraft so
it should be more clearly just for briefing purposes.
2023-08-23 20:14:16 -07:00
Dan Albert
99eed33241 Remove useless TravelTime class.
This is only called for real in one spot. The other callers should have
been deferring to the one real caller.
2023-08-22 20:31:20 -07:00
Dan Albert
1902618f45 Remove dead code. 2023-08-21 22:42:00 -07:00
Dan Albert
eebb172333 Remove flight-size-specific formations.
No reason to do this, and it's making the task rework annoying.
2023-08-17 20:27:34 -07:00
Dan Albert
5f3e342a0e Use SEAD for SEAD.
The F-14 was fixed to allow this in the latest patch.
2023-08-16 19:42:11 -07:00
Dan Albert
87441b8939 Formalize waypoint actions.
Create a WaypointAction class that defines the actions taken at a
waypoint. These will often map one-to-one with DCS waypoint actions but
can also be higher level and generate multiple actions. Once everything
has migrated all waypoint-type-specific behaviors of
PydcsWaypointBuilder will be gone, and it'll be easier to keep the sim
behaviors in sync with the mission generator behaviors.

For now only hold has been migrated. This is actually probably the most
complicated action we have (starting with this may have been a mistake,
but it did find all the rough edges quickly) since it affects waypoint
timings and flight position during simulation. That part isn't handled
as neatly as I'd like because the FlightState still has to special case
LOITER points to avoid simulating the wrong waypoint position. At some
point we should probably start tracking real positions in FlightState,
and when we do that will be solved.
2023-08-13 12:43:59 -07:00
Dan Albert
aaf66107ad Improve type inference in loiter flight plans. 2023-08-13 12:28:43 -07:00
Dan Albert
59756ce14c Differentiate total time and travel time.
There's an ugly special case in flight simulation to handle hold points
because we don't differentiate between the total time between two
waypoints (which can include delays from actions like holding) and
travel time. Split those up and remove the special case.
2023-08-13 11:36:05 -07:00
Dan Albert
bf1e559a41 Remove dead code. 2023-08-13 11:36:05 -07:00
Dan Albert
5f4a75601b Show the real front line bounds on the map.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1067.
2023-08-10 21:01:44 -07:00
Dan Albert
c4358daccc Revert "Remove dead code."
Not used by python, but is used by jinja templates.

This reverts commit 1f3eee90f148c7a7fdc442e1b403b3c9c2bcfac9.
2023-08-10 00:53:29 -07:00
Dan Albert
3f0b565b82 Drop save compat hacks.
The CAS flight plan tweaks break save compat in a way that's not as easy
to fix. Accept it and drop the existing hacks since they won't be useful
any more.
2023-08-10 00:47:13 -07:00
Dan Albert
cb3bf56d84 Add a real CAS ingress point.
Putting the ingress point directly on one end of the FLOT means that AI
flights won't start searching and engaging targets until they reach that
point. If the front line has advanced toward the flight's departure
airfield, it might overfly targets on its way to the IP.

Instead, place an IP for CAS the same way we place any other IP. The AI
will fly to that and start searching from there.

This also:

* Removes the midpoint waypoint, since it didn't serve any real purpose
* Names the FLOT boundary waypoints for what they actually are

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2231.
2023-08-10 00:47:13 -07:00
Dan Albert
3c2ace09f3 Add display name property for unit types.
Unlike the variant ID, this can be changed without breaking save compat.
2023-08-09 22:50:05 -07:00
Dan Albert
58d8203c83 Fix unit variants to actually allow variance.
This was always the intent, but apparently it wasn't implemented
correctly. All properties of the unit type can now be overridden per
variant.
2023-08-09 22:50:05 -07:00
Dan Albert
1f3eee90f1 Remove dead code. 2023-08-09 22:27:21 -07:00
Dan Albert
0be6952a93 Rename UnitType.name what it is: the variant ID.
This property affects safe compat because the ID is what gets preserved
in the save, but it's unfortunately also used as the display name, which
means changing the display name breaks save compat. It also prevents us
from changing display names without breaking faction definitions.

This is the first step in fixing that. The next is adding a separate
display_name property that can be updated without breaking either of
those.
2023-08-09 21:53:25 -07:00
Dan Albert
09f1af37fd Force dumping debug info on recreate.
We need a way to debug successful solvers that's still targeting to a
specific flight. This will do for now.
2023-08-08 21:46:52 -07:00
Dan Albert
1708baf772 Add fuzz testing for waypoint solvers.
This fuzz test generates random inputs for waypoint solvers to check if
they can find a solution. If they can't, the debug info for the solver
is dumped to the testcases directory. Another test loads those test
cases, creates a solver from them, and checks that a solution is found.
Obviously it won't be immediately, but it's a starting point for fixing
the bug and serves as a regression test afterward.
2023-08-08 21:46:52 -07:00
Dan Albert
6b6c4f4112 Migrate IP placement to WaypointSolver. 2023-08-08 21:46:52 -07:00
Dan Albert
5cb4c363e3 Build common interface for waypoint geometry constraints.
This is a replacement for the existing "zone geometry" classes that are
currently used for choosing locations for IP, hold, and join points.
The older approach required the author to define the methods for
choosing locations at a rather low level using shapely APIs to merge or
mask geometries. Debug UIs had to be defined manually which was a great
deal of work. Worse, those debug UIs were only useable for *successful*
waypoint placement. If there was a bug in the solver (which was pretty
much unavoidable during development or tuning), it wasn't possible to
use the debug UI.

This new system adds a (very simple) geometric constraint solver to
allow the author to describe the requirements for a waypoint at a high
level. Each waypoint type will define a waypoint solver that defines one
or more waypoint strategies which will be tried in order. For example,
the IP solver might have the following strategies:

1. Safe IP
2. Threat tolerant IP
3. Unsafe IP
4. Safe backtracking IP
5. Unsafe backtracking IP

We prefer those in the order defined, but the preferred strategies won't
always have a valid solution. When that happens, the next one is tried.

The strategies define the constraints for the waypoint location. For
example, the safe IP strategy could be defined as (in pseudo code):

* At least 5 NM away from the departure airfield
* Not farther from the departure airfield than the target is
* Within 10 NM and 45 NM of the target (doctrine dependent)
* Safe
* Within the permissible region, select the point nearest the departure
  airfield

When a solver fails to find a solution using any strategy, debug
information is automatically written in a GeoJSON format which can be
viewed on geojson.io.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3085.
2023-08-08 21:46:52 -07:00
Dan Albert
13ccf3f536 Add __str__ for Distance. 2023-08-08 01:56:18 -07:00
Dan Albert
42fa5dce94 Add name to Doctrine. 2023-08-08 01:56:06 -07:00
Nosajthedevil
58ede1b888
Add support for ARA Veinticinco de Mayo.
Includes an Argentina 1982 faction for testing purposes, although it's
sparse because of a lack of assets in DCS.

Note that the carrier is mispelled as the Vienticinco in the game.

Includes prerequisite pydcs update.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3123.
2023-08-02 01:26:08 +00:00
Dan Albert
2c51e126b7 Fix shapely error during mission generation.
It seems shapely doesn't allow `unary_union` on collections any more.
2023-07-31 17:32:46 -07:00
Dan Albert
899620c242 Add TODO note to joinzonegeometry. 2023-07-29 21:56:56 -07:00
Dan Albert
431165ab83 Add __str__ for Heading. 2023-07-29 21:56:43 -07:00
Dan Albert
d81ed26fa6 Stop gap fix for AI speed to nav points.
This isn't a great fix for the reason I mention in the comment, but it's
quick and actually is accurate since it looks like we don't actually
handle formation speeds correctly in most cases...

This is probably as "fixed" as this is going to get for now since most
of the flight planning code is in the process of being rewritten.

https://github.com/dcs-liberation/dcs_liberation/issues/3113
2023-07-29 10:31:05 -07:00
Dan Albert
160d464f9a Fix synchronization of loadouts on change.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3111.
2023-07-27 22:25:51 -07:00
Dan Albert
c7a991687c Configure target points for F-15E S4+.
We don't need explicit configuration of initial points. The plane
automatically configures any steerpoint immediately before a target
point as an initial point.

Target offset points and aim points have not been implemented because I
can't find any information the describes their intent.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3088.
2023-07-23 14:51:56 -07:00
Dan Albert
d2152a259c Handle TOT offsets for patrolling flight plans.
https://github.com/dcs-liberation/dcs_liberation/issues/3107
2023-07-23 11:51:07 -07:00