114 Commits

Author SHA1 Message Date
Dan Albert
b0787d9a3f Build a proper type for StartType. 2021-10-22 11:42:13 -07:00
Dan Albert
be69d17345 Move Flight and its related components out of gen. 2021-10-22 11:30:28 -07:00
MetalStormGhost
2a79e4a4e5
Force carrier planes to start at +1s (#1600)
Forces carrier planes with original start_time of zero seconds to have a start time of 1 second. This will prevent them from spawning on the 'sixpack' and functions as a workaround for a DCS problem (deadlock / traffic jam).

Fixes #1309.
2021-10-13 17:10:17 -07:00
Dan Albert
1a4be911c0 Implement ferry flights for squadron transfers.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1145
2021-08-31 23:03:27 -07:00
Magnus Wolffelt
08365bcbda Simplify and enhance tarcap flight planning 2021-08-16 10:37:44 +02:00
Magnus Wolffelt
30801dff9f
Use more sensible patrol speeds for CAP, and fix is_helo (#1492)
* Use more sensible patrol speeds for CAP, and fix is_helo
2021-08-03 12:22:55 +02:00
Magnus Wolffelt
a3e3e9046f Estimate preferred patrol altitude based on max speed 2021-08-01 12:15:15 -07:00
bgreman
91d430085e
Addresses #478, adding a heading class to represent headings and angles (#1387)
* Addresses #478, adding a heading class to represent headings and angles
Removed some unused code

* Fixing bad merge

* Formatting

* Fixing type issues and other merge resolution misses
2021-07-21 10:29:37 -04:00
Dan Albert
e22e8669e1 Add fallback locations for join zones.
It's rare with the current 5NM buffer around the origin, but if we use
the hold distance as the buffer like we maybe should it's possible for
the preferred join locations to fall entirely within the home zone. In
that case, fall back to a location within the max-turn-zone that's
outside the home zone and is nearest the IP.
2021-07-18 14:52:12 -07:00
Dan Albert
c11c6f40d5 Add minimum fuel per waypoint on the kneeboard. 2021-07-17 19:51:55 -07:00
Dan Albert
82cca0a602 [3/3] Rework hold points. 2021-07-15 23:21:56 -07:00
Dan Albert
d444d716f5 [2/3] Improve join point placement. 2021-07-15 23:18:10 -07:00
Dan Albert
e03d710d53 [1/3] Rework IP placement.
Test cases:

1. Target is not threatened.

   The IP should be placed on a direct heading from the origin to the
   target at the max ingress distance, or very near the origin airfield
   if the airfield is closer to the target than the IP distance.

2. Unthreatened home zone, max IP between origin and target, safe
   locations available for IP.

   The IP should be placed in LAR at the closest point to home.

3. Unthreatened home zone, origin within LAR, safe locations available
   for IP.

   The IP should be placed near the origin airfield to prevent
   backtracking more than needed.

4. Unthreatened home zone, origin entirely nearer the target than LAR,
   safe locations available for IP.

   The IP should be placed in LAR as close as possible to the origin.

5. Threatened home zone, safe locations available for IP.

   The IP should be placed in LAR as close as possible to the origin.

6. No safe IP.

   The IP should be placed in LAR at the point nearest the threat
   boundary.
2021-07-15 23:18:10 -07:00
Dan Albert
a7d49b986d Exclude both path endpoints for joins/splits.
Without this the points would often be placed exactly on top of the
origin airfield, when in that case we actually should use the fallback
behavior.
2021-07-13 20:11:09 -07:00
Dan Albert
7c3e08050f Perturb fallback join/split points.
Otherwise they're placed exactly on top of each other, which makes the
map harder to read.
2021-07-13 20:10:29 -07:00
Dan Albert
076df7cf66 Fix placement of fallback split points.
Using the target placed the split in the threatened area.
2021-07-13 20:07:42 -07:00
Dan Albert
415b8c6317 Allow the split point to differ from the join.
This places the split point based on the best path from the IP to home,
rather than the best path from home to the target. The outcome is that
the planner might choose an alternate route out of a threatened area
based on the safest escape from the IP, which is where the aircraft
should be when it releases its weapons, rather than at the target.
That's of course not always perfect since the IP distance is not based
on the carried weapon, but it's a better choice when it matters more
(when carrying standoff weapons attacking a more dangerous target).
2021-07-13 19:59:22 -07:00
Dan Albert
8e59c99666 Improve hold point placement for nearby joins. 2021-07-13 18:43:02 -07:00
Dan Albert
dfcd372d2d Remove egress points from most flight plans.
These don't have any function. Remove them and remove the angled attack
heading from the IP.
2021-07-13 18:36:38 -07:00
Dan Albert
f7bbe0fa94 Improve flight plan layout for untheatened IPs.
Try all the nav points between the origin and the target rather than
just the first non-threatened point. This prevents us from using the
fallback behavior for any target that's sufficiently far from the
package airfield.
2021-07-13 18:22:42 -07:00
Dan Albert
24f6aff8c8 Reduce mission planning dependence on Game. 2021-07-13 15:20:42 -07:00
Dan Albert
6ce02282e7 Correct int/float confusion in Point APIs.
The heading and distance calculations always return floats.
2021-07-11 14:33:46 -07:00
Dan Albert
96c7b87ac7 More adaptation for pydcs updates.
This is as much as we can do until pydcs actually adds the py.typed
file. Once that's added there are a few ugly monkey patching corners
that will just need `# type: ignore` for now, but we can't pre-add those
since we have mypy warning us about superfluous ignore comments.
2021-07-09 16:35:03 -07:00
Dan Albert
53f6a0b32b Fix some typing in preparation for pydcs types.
Not complete, but progress.
2021-07-08 23:23:05 -07:00
Dan Albert
299ed88f09 Fix unreachable code issues, enable checking.
The loadout case actually could (and previously did) hide bugs from the
type checker, since mypy was smart enough to see that we were removing
None from the input it assumed that the member was non-optional, but
later modifications could cause null values, and since those came from
the UI mypy couldn't reason about this. This meant that mypy assumed the
type could not be optional and wouldn't check that case.
2021-07-07 15:17:05 -07:00
Dan Albert
80cf8f484d Fix targeting of carrier groups with TGOs.
The assumption that the first group is the carrier group is wrong.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1346
2021-06-25 16:46:49 -07:00
Mike Jones
a75688f89c Add patrol configuration to unit data files.
This allows altitude/speed of AEW&C and tankers to be configured.
2021-06-22 14:35:28 -07:00
Mike Jones
30763b5401 Fix unit type comparisons.
When comparing UnitType against a pydcs type, use .dcs_unit_type.
2021-06-22 14:35:28 -07:00
SnappyComebacks
a53a648a63 Add plannable tankers.
This Pull Request lets users plan Tanker flights.

Features:

- Introduction of `Refueling` flight type.
- Tankers can be purchased at airbases and carriers.
- Tankers get planned by AI.
- Tankers are planned from airbases and at aircraft carriers.
- Tankers aim to be at high, fast, and 70 miles from the nearest threat.
  (A10s won't be able to tank)
- Tankers racetrack orbit for one hour.
- Optional Tickbox to enable legacy tankers.
- S-3B Tanker added to factions.
- KC-130 MPRS added to factions.
- Kneeboard shows planned tankers, their tacans, and radios.

Limitations:

- AI doesn't know whether to plan probe and drogue or boom refueling
  tankers.
- User can't choose tanker speed.  Heavily loaded aircraft may have
  trouble.
- User can't choose tanker altitude.  A-10s will not make it to high
  altitude.

Problems:

- Tanker callsigns do not increment, see attached image.  (Investigated:
  Need to use `FlyingType.callsign_dict`, instead of just
  `FlyingType.callsign`.  This seems like it might be significant work
  to do.).
- Having a flight of two or more tankers only spawns one tanker.
- Let me know if you have a solution, or feel free to commit one.

https://user-images.githubusercontent.com/74509817/120909602-d7bc3680-c633-11eb-80d7-eccd4e095770.png
2021-06-09 21:14:10 -07:00
Dan Albert
d498bb9cff Give AEW&C a significant buffer from threats. 2021-05-31 15:33:21 -07:00
Dan Albert
355e6e1d15 Fix several cases of wrongly using broken runways.
The usual symptom here was the game breaking when a carrier is
destroyed. The carrier would no longer be operational but missions would
be assigned there that could not generate flight plans.
2021-05-31 14:13:33 -07:00
Dan Albert
5b271df66f Propagate planning error for package waypoints.
We did this for the flight plan itself, but did not if the package
waypoints failed to generate.

https://github.com/dcs-liberation/dcs_liberation/issues/1140
2021-05-28 17:26:31 -07:00
Dan Albert
4147d2f684 Initial squadrons implementation.
Doesn't actually do anything yet, but squadrons are created for each
aircraft type and pilots will be created as needed to fill flights.

https://github.com/dcs-liberation/dcs_liberation/issues/276
2021-05-26 17:49:53 -07:00
Dan Albert
4939faf5fa Schedule SEAD with a one minute lead time. 2021-05-25 22:53:57 -07:00
Dan Albert
eedb5c26a9 Ignore non-escorted regions when planning escorts.
We shouldn't consider the non-escorted parts of the flight path when
checking for threats to determine if escorts should be used or not,
since escorts can't help in those areas anyway. This was causing escorts
to be overly requested since the bullseye is now a part of the
"flight plan", but could have also triggered for divert waypoints, or
for aircraft taking off in a retreat from a threatened location.
2021-05-23 13:01:44 -07:00
Dan Albert
b6154b273c Differentiate SEAD and SEAD escorts.
SEAD suppresses the package's target. SEAD escort protects the package
from any SAM threat along its flight path.
2021-05-22 14:24:13 -07:00
Dan Albert
2ca0edf5fd Increase estimate for airfield ground ops.
5 minutes is pretty optimistic at most airfields.
2021-05-22 01:09:43 -07:00
Dan Albert
a382e74a89 Set up bullseye early, create waypoints.
Setting this up as part of the game makes it possible for us to show in
the UI.

https://github.com/dcs-liberation/dcs_liberation/issues/136
2021-05-20 18:29:35 -07:00
Dan Albert
b0c24f6e51 Refactor front line code to make sides explicit.
A was intended to be the blue point and B was intended to be the red
point. Make this a part of the name so that's clear, and clean up
related code to keep that reliable.
2021-05-07 21:10:22 -07:00
Dan Albert
028bfc11eb Fix convoys skipping intermediate stops. 2021-04-25 17:38:05 -07:00
Dan Albert
2d64acf299 Add mission targeting for cargo ships.
https://github.com/Khopa/dcs_liberation/issues/826
2021-04-25 14:31:13 -07:00
Dan Albert
481f195725 Airlift support.
UI isn't finished. Bulk transfers where the player doesn't care what
aircraft get used work (though they're chosen with no thought at all),
but being able to plan your own airlift flight isn't here yet.

Cargo planes are not implemented yet.

No way to view the cargo of a flight (will come with the cargo flight
planning UI).

The airlift flight/package creation should probably be moved out of the
UI and into the game code.

AI doesn't use these yet.

https://github.com/Khopa/dcs_liberation/issues/825
2021-04-22 00:30:18 -07:00
Dan Albert
50d8e08a34 Redo convoy attack flight plans.
The previous flight plan only makes sense if the convoy will make it a
significant distance from its starting point. At road speeds over the
typical mission duration this is not true, so we can actually plan this
as if it was a strike mission near the origin point and that's close
enough.

There's some cleanup work to do here that I've added todos for.

Fixes https://github.com/Khopa/dcs_liberation/issues/996
2021-04-20 22:04:57 -07:00
Dan Albert
3f16c0378a Add BAI planning against supply routes.
This currently is only supported for player flights. I have no idea how
to create an AI flight plan that won't just get them killed. AI-only BAI
missions against supply routes will warn the player on mission creation.
2021-04-19 23:09:39 -07:00
Simon Krüger
260358c5fb
AEW&C kneeboard + actually do AEW&C (#922)
* AEW&C will now do AEW&C
* AEW&C gets a frequency
* AEW&C is added to kneeboard (Frequency, Depature, Depature Time, Arrival Time)
2021-03-13 14:07:19 -08:00
Dan Albert
0f07b2c095 Increase size of navmesh to avoid planning issues.
The tradeoff is that any flights that might have previously routed
_around_ a threat near the edge of the map may no longer do so as the
zones at the edge are significantly larger now.

Fixes https://github.com/Khopa/dcs_liberation/issues/903
2021-03-13 13:41:57 -08:00
Dan Albert
6200ec8e0e Don't plan BAI targets at dead subgroups.
Fixes https://github.com/Khopa/dcs_liberation/issues/900
2021-03-13 13:16:10 -08:00
sikruger
03251d5bd5 some improvements 2021-02-24 22:06:42 +01:00
sikruger
4f1b0055e1 new point generation 2021-02-19 20:40:58 +01:00
sikruger
dd9fe87ff4 new point generation 2021-02-18 16:08:23 +01:00