230 Commits

Author SHA1 Message Date
Dan Albert
b1356551c6 Move threat zones out of MapModel. 2022-02-22 19:59:29 -08:00
Dan Albert
0e6a303c17 Move NavMesh out of MapModel. 2022-02-22 18:49:12 -08:00
Dan Albert
9e2e4ffa74 Update pydcs, adapt to new Point APIs.
This is briefly moving us over to my fork of pydcs while we wait for
https://github.com/pydcs/dcs/pull/206 to be merged. The adaptation is
invasive enough that I don't want it lingering for long.
2022-02-23 01:02:48 +00:00
Dan Albert
ac80c4adc1 Finish moving gen into game. 2022-02-22 00:10:31 -08:00
Dan Albert
df7be8603b Clean up some uses of Point to prep for update. 2022-02-21 18:12:59 -08:00
RndName
2c17a9a52e Refactor Templates to Layouts, Review and Cleanup
- Fix tgogenerator
- Fix UI for ForceGroup and Layouts
- Fix ammo depot handling
- Split bigger files in smaller meaningful files (TGO, layouts, forces)
- Renamed Template to Layout
- Renamed GroundGroup to TheaterGroup and GroundUnit to TheaterUnit
- Reorganize Layouts and UnitGroups to a ArmedForces class and ForceGroup similar to the AirWing and Squadron
- Reworded the UnitClass, GroupRole, GroupTask (adopted to PEP8) and reworked the connection from Role and Task
- added comments
- added missing unit classes
- added temp workaround for missing classes
- add repariable property to TheaterUnit
- Review and Cleanup

Added serialization for loaded templates

Loading the templates from the .miz files takes a lot of computation time and in the future there will be more templates added to the system. Therefore a local pickle serialization for the loaded templates was re-added:
- The pickle will be created the first time the TemplateLoader will be accessed
- Pickle is stored in Liberation SaveDir
- Added UI option to (re-)import templates
2022-02-21 20:45:41 +01:00
RndName
d154069877 Refactor ground objects and prepare template system
- completly refactored the way TGO handles groups and replaced the usage of the pydcs ground groups (vehicle, ship, static) with an own Group and Unit class.
- this allows us to only take care of dcs group generation during miz generation, where it should have always been.
- We can now have any type of unit (even statics) in the same logic ground group we handle in liberation. this is independent from the dcs group handling. the dcs group will only be genarted when takeoff is pressed.
- Refactored the unitmap and the scenery object handling to adopt to changes that now TGOs can hold all Units we want.
- Cleaned up many many many lines of uneeded hacks to build stuff around dcs groups.
- Removed IDs for TGOs as the names we generate are unique and for liberation to work we need no ids. Unique IDs for dcs will be generated for the units and groups only.
2022-02-21 20:45:41 +01:00
Dan Albert
cba68549d8 Add a UUID -> Flight database to Game.
This will be expanded with other types as needed.
2022-02-19 12:57:41 -08:00
SnappyComebacks
3987f26689
Add performance option to not cull threatening IADS (#1953)
- Don't cull EWRs in detection range.
- Don't cull SAMs within threat range + small buffer.
2022-02-05 18:38:25 -07:00
leemarov
5d291846d5
Fix unculled zones not updating when needed.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1034.
2022-01-16 13:54:09 -08:00
Dan Albert
12f420f50e Pre-emptive Python 3.10 compat.
Iterator is no longer exposed directly in collections, but is in
collections.abc.
2021-11-20 18:49:14 -08:00
Dan Albert
b728fcc2d6 Clean up mission result handling. 2021-10-22 14:36:51 -07:00
Dan Albert
74291271e3 Move mission generation code into game.
Operation has been renamed MissionGenerator and is no longer a static
class.
2021-10-22 13:48:43 -07:00
Dan Albert
be69d17345 Move Flight and its related components out of gen. 2021-10-22 11:30:28 -07:00
Dan Albert
b174e668f4 Fix day being off-by-one on turn zero.
Doesn't have any real effect since no mission can be generated for that
turn, but shows up wrong in the top bar.
2021-10-17 17:33:29 -07:00
Khopa
e84e36fd22 Merge remote-tracking branch 'khopa/develop' into helipads
# Conflicts:
#	changelog.md
2021-09-08 21:56:45 +02:00
Dan Albert
45b52f4dea Remove auto-loss on front line for skipped turns. 2021-09-05 21:19:36 -07:00
Dan Albert
18336f58d3 Minor cleanup of notification system. 2021-09-05 21:15:32 -07:00
Dan Albert
4715773bba Store the owning coalition in ControlPoint.
This is needed fairly often, and we have a lot of Game being passed
around to ControlPoint methods specifically to support this. Just store
the owning Coalition directly in the ControlPoint to clean up. I haven't
cleaned up *every* API here, but did that aircraft allocations as an
example.
2021-08-28 16:40:55 -07:00
C. Perreau
707d13a65c
Merge branch 'develop' into helipads 2021-08-16 12:20:43 +02:00
Dan Albert
4423288a53 Assign aircraft to squadrons rather than bases.
This is needed to support the upcoming squadron transfers, since
squadrons need to bring their aircraft with them.

https://github.com/dcs-liberation/dcs_liberation/issues/1145
2021-08-15 17:42:56 -07:00
Dan Albert
90ad1f4a61 Change squadrons to operate out of a single base.
https://github.com/dcs-liberation/dcs_liberation/issues/1145

Currently this is fixed at the start of the campaign. The squadron
locations are defined by the campaign file.

Follow up work:

* Track aircraft ownership per-squadron rather than per-airbase.
* UI for relocating squadrons.
* Ferry missions for squadrons that are relocating.
* Auto-relocation (probably only for retreat handling).

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1138
2021-08-14 21:46:27 -07:00
Khopa
fbd0198771 Fixed mypy errors 2021-08-03 00:37:26 +02:00
Khopa
5b37698d36 Fixed mypy errors 2021-08-03 00:28:22 +02:00
Khopa
483640b0c6 Fixed errors after merge on helipad feature. 2021-08-03 00:15:14 +02:00
Khopa
71143536bf Merge branch 'develop' into helipads
# Conflicts:
#	game/game.py
#	game/operation/operation.py
#	game/theater/conflicttheater.py
#	game/theater/controlpoint.py
#	gen/groundobjectsgen.py
#	resources/campaigns/golan_heights_lite.miz
2021-08-02 19:34:05 +02:00
Dan Albert
edf95ea9fb Dedup purchase requests.
Since the theater commander runs once per campaign action, missions that
do not have aircraft available may be checked more than once a turn.
Without deduping requests this can lead to cases where the AI buys
dozens of tankers on turn 0.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1470
2021-08-01 15:17:43 -07:00
Dan Albert
9bb8e00c3d Allow configuration of the air wing at game start.
After completing the new game wizard but before initializing turn 0,
open a dialog to allow the player to customize their air wing. With this
they can remove squadrons from the game, rename them, add players, or
change allowed mission types. *Adding* squadrons is not currently
supported, nor is changing the squadron's livery (the data in pydcs is
an arbitrary class hierarchy that can't be safely indexed by country).

This only applies to the blue air wing for now.

Future improvements:

* Add squadron button.
* Collapse disable squadrons to declutter?
* Tabs on the side like the settings dialog to group by aircraft type.
* Top tab bar to switch between red and blue air wings.
2021-07-17 14:29:04 -07:00
Dan Albert
72c181a399 Fix budget mismatch in the UI.
Much of the UI was using the old budget which wasn't removed from Game
like it should have been when Coaltion was introduced. The UI displayed
(and in some cases pulled from) the starting budget rather than the real
budget.
2021-07-14 17:33:01 -07:00
Dan Albert
17c19d453b Factor out Coalition from Game. 2021-07-13 14:29:40 -07:00
Dan Albert
0a416ab758 Let the TheaterCommander manage front line stance.
This improves the AI behavior by choosing the stances non-randomly:

* Breakthrough will be used if the base is expected to be capturable and
  the coalition outnumbers the enemy by 20%.
* Elimination will be used if the coalition has at least as many units
  as the enemy.
* Defensive will be used if the coalition has at least half as many
  units as the enemy.
* Retreat will be used if the coalition is significantly outnumbers.

This also exposes the option to the player.
2021-07-12 21:12:02 -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
fb9a0fe833 Flesh out typing information, enforce. 2021-07-07 17:41:29 -07:00
Dan Albert
7983cd8d62 Add documentation for turn processing. 2021-07-07 14:44:38 -07:00
RndName
05fab1f79d correct display of turn statistics 2021-07-07 14:12:20 -07:00
RndName
7229b886e0 replan opfor mission on sell or buy of tgos 2021-07-07 14:12:20 -07:00
RndName
de443fa3f0 reworked the skynet group name generation
- added information about the role of the aa site
- moved handling of ground name from tgo to the sam generator to make the tgo cleaner
- adjusted the skynet-config lua to the changes
2021-07-02 01:25:03 -07:00
Chris Seagraves
e94d48c265
Notes to kneeboard (#1375)
Adds global-level kneeboard notes.  Explicit save compatability with 4.0.0
2021-06-30 18:07:53 -04:00
Khopa
1b9da9cdd8 Fixed mypy error after merge 2021-06-26 20:00:10 +02:00
Khopa
7667a4f8c0 Merge branch 'develop' into helipads
# Conflicts:
#	game/game.py
#	resources/campaigns/golan_heights_lite.miz
2021-06-26 18:00:36 +02:00
bgreman
b43e5bac0b
Fix #1329 player loses frontline progress when skipping turn 0 (#1330) 2021-06-24 02:04:27 -04:00
Simon Clark
963ab38b2e Refactor the mod select changes, re-add accidentally deleted factions. 2021-06-21 01:16:48 +01:00
Simon Clark
11069cc219 Make mod selection nicer and deprecate MB-339.
Mod selection is now done via checkbox in the new game wizard.

The MB-339 is being turned into a paid module, and the free mod no longer works, so it's been removed.
2021-06-21 01:16:41 +01:00
Khopa
c70169b4a0 Merge branch 'develop' into helipads
# Conflicts:
#	game/game.py
#	game/operation/operation.py
#	game/theater/controlpoint.py
#	gen/aircraft.py
#	resources/campaigns/golan_heights_lite.miz
2021-06-20 18:07:50 +02:00
Dan Albert
2dee702060 Persist name generator state to the save game.
This is a bit of an ugly hack but it's effectively what we would need
anyway. We could clean up the global replacement by making the name
generator _only_ a property of Game and plumbing it through to a large
number of places. Could maybe also use `__getstate__` and `__setstate__`
tricks to save `naming.namegen` to the file even without making it truly
a part of Game.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1247
2021-06-18 19:24:23 -07:00
Dan Albert
ace42019fb Cap squadron size, limit replenishment rate.
This caps squadrons to 12 pilots and limits their replenishment rate to
1 pilot per turn. Should probably make those values configurable, but
they aren't currently.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1136
2021-06-13 14:40:15 -07:00
Khopa
adad88681e Generate helipads as neutral objects, so they do not interfer with base capture trigger 2021-06-10 23:18:41 +02:00
Florian
3a592aee8b Split purchase budget based on investment ratio.
The AI purchaser will aim to have a 50/50 ground/air investment mix.
This allows it to overspend on one category if significant losses were
taken the previous turn.

The total purchase amount is still limited, so if the bases are full
when only 10% of the investment is in ground units, the full budget for
the turn will still go to air.
2021-06-05 14:07:18 -07:00
Dan Albert
77373606fe Fix crash in startup. 2021-05-31 14:36:25 -07:00
Dan Albert
417fc3af5b Allow objects near missile launchers to be culled.
We want the scud to not be culled, but we should still cull things
nearby. Rather than making the scud the center of a 2.5km unculled zone,
just exclude missile objectives from culling.
2021-05-30 19:29:59 -07:00