396 Commits

Author SHA1 Message Date
Dan Albert
f72b2a21f7 Remove the old map.
The new map has no open bugs.
2022-03-20 16:13:07 -07:00
Benjamin Fischer
be67d6dbc6
Fix custom waypoint addition/removal.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2063.
2022-03-18 00:06:41 -07:00
Dan Albert
4993353184 RTB canceled in-progress flights.
The UI won't stop you from aborting a flight that is already home, but
that should also result in it re-completing again on the next tick.

https://github.com/dcs-liberation/dcs_liberation/issues/1680
2022-03-08 01:04:19 -08:00
Dan Albert
baae65919f Enable configuration of the server bind address.
A serverconfig.env (or just environment variables) can be set to
override the default bind address/port for the backend. This is passed
to the front end as a query parameter.
2022-03-07 17:53:55 -08:00
Dan Albert
6ee235545f Clean up leaflet polygon API surface. 2022-03-06 23:25:25 -08:00
Dan Albert
904602510d Remove API key auth; CORS is sufficient.
The React UI running in a browser can't connect to the backend without
punching a hole for CORS, which isn't done by default. We don't need the
API key to protect from browsers, and anything else running on the
user's machine that can access the backend (that's hosted on only
localhost) already has enough control to do damage without using
Liberation as an attack vector.

https://github.com/dcs-liberation/dcs_liberation
2022-03-06 01:57:12 -08:00
Dan Albert
8165d3bd8c Add support for running the build react map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-06 01:53:22 -08:00
Dan Albert
c5c596dc2f Move TGOs out of MapModel. 2022-03-03 17:11:01 -08:00
Dan Albert
ccb510fe47 Move front lines out of MapModel. 2022-03-03 02:17:13 -08:00
Dan Albert
8d806def5b Use FastAPI interface for the front lines.
Can't submit yet because there's no way to uniquely identify front-
lines, so no way to update these as they change.
2022-03-03 00:43:13 -08:00
Dan Albert
59e98b31df Add a basic React implementation of the map.
See client/README.md for instructions.
2022-02-28 00:31:56 -08:00
Dan Albert
02383763ec Update TGOs to use milsymbol for icons. 2022-02-27 22:13:06 -08:00
Dan Albert
e7398af877 Update ControlPoint UI to use milsymbol library.
This gets us out of the business of maintaining our own icons. The
milsymbol library generates the SVG data needed to display anything
covered by APP-6.
2022-02-27 19:10:22 -08:00
RndName
762bc328e1
Fix SA-8 LD used incorrectly as SA-13 and cleanup
- The SA-8 LD unit hat the SA-13 unit name as variant. The Layout tried to create a SA-13 SHORAD Site but actually used an SA-8 LD unit instead with zero threat range. This resulted in a yellow marked GroundObject on the map
- Cleaned up the treat and radar range functions a bit
2022-02-26 22:32:25 +01:00
Dan Albert
45e76e12b6 Move FlightJs out of MapModel. 2022-02-25 01:31:07 -08:00
Dan Albert
b1356551c6 Move threat zones out of MapModel. 2022-02-22 19:59:29 -08:00
Dan Albert
1c543666b5 Move unculled zones out of MapModel. 2022-02-22 19:37:43 -08:00
Dan Albert
95836a217c Remove dead code. 2022-02-22 19:17:55 -08:00
Dan Albert
2ae820fb20 Move MapZones out of MapModel. 2022-02-22 19:16:55 -08:00
Dan Albert
0e6a303c17 Move NavMesh out of MapModel. 2022-02-22 18:49:12 -08:00
Dan Albert
1a9930b93a Remove our old lat/lon support code.
pydcs provides this now.
2022-02-22 17:40:35 -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
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
c16ca40894 Move waypoints and commit boundaries to FastAPI. 2022-02-20 13:30:36 -08:00
Dan Albert
5cd9af32fa Move UI-only waypoint number out of the model.
This isn't needed by the backend, so just handle it in the front end.
2022-02-19 15:09:58 -08:00
Dan Albert
4c3509a455 Remove unused signals. 2022-02-19 14:49:04 -08:00
Dan Albert
77d29e314c Add API key authentication.
We don't have any sensitive data, but we do access the file system. On
the off chance that some phishing website decides to try to use
Liberation as an attack vector, prevent access to the API by
unauthorized applications. An API key is generated at each program start
and passed to the front end via the QWebChannel.
2022-02-19 14:41:39 -08:00
Dan Albert
09457d8aab Move frozen combat handling out of MapModel. 2022-02-19 13:51:18 -08:00
Dan Albert
21f7912458 Add websocket event stream for sim updates.
As a proof of concept this only covers the flight positions.
2022-02-16 01:34:56 -08:00
Dan Albert
350f08be2f Add FastAPI interface between the game and map.
A possible explanation for the infrequent CTDs we've been seeing since
adding fast forward is that QWebChannel doesn't keep a reference to the
python objects that it passes to js, so if the object is GC'd before the
front end is done with it, it crashes.

We don't really like QWebChannel anyway, so this begins replacing that
with FastAPI.
2022-02-15 18:14:34 -08:00
Dan Albert
6ebda41922 Replace debug QObject models with Pydantic.
This requires less duplication and paves the way for us replacing
QWebChannel with FastAPI, which in turn gets us closer to not needing
Qt.
2022-02-13 14:52:41 -08:00
Dan Albert
1adafac35f Make lines_to_leaflet tolerant of single lines. 2022-02-13 14:35:31 -08:00
Dan Albert
d488bcffbd Fix debug zones not updating on flight switch. 2022-02-13 14:35:30 -08:00
Dan Albert
51961294dd Fix incorrect HoldZonesJs initialization. 2022-02-13 14:35:30 -08:00
Dan Albert
205929bfc9 Log time spent running to first contact. 2022-01-24 18:24:28 -08: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
656a98675e Rework sim status update to not need a thread.
Rather than polling at 60Hz (which may be faster than the tick rate,
wasting cycles; and also makes synchronization annoying), collect events
during the tick and emit them after (rate limited, pooling events until
it is time for another event to send).

This can be improved by paying attention to the aircraft update list,
which would allow us to avoid updating aircraft that don't have a status
change. To do that we need to be able to quickly lookup a FlightJs
matching a Flight through, and Flight isn't hashable.

We should also be removing dead events and de-duplicating. Currently
each flight has an update for every tick, but only the latest one
matters. Combat update events also don't matter if the same combat is
new in the update.

https://github.com/dcs-liberation/dcs_liberation/issues/1680
2021-12-23 17:46:24 -08:00
Dan Albert
43d5dc0528 Fix bad import. 2021-12-23 12:57:14 -08:00
Dan Albert
515efd0598 Draw frozen combat on the map.
Very basic display. Draws the engagement footprint for air-to-air
combat, a line from the flight to the target for IP, and lines from SAMs
to their target for air defense.

https://github.com/dcs-liberation/dcs_liberation/issues/1680
2021-12-21 14:56:25 -08:00
Dan Albert
fb10a8d28e Add frozen combat modelling.
This doesn't do anything yet, but sets up the data model handling for
frozen combat. The next step is to show combat in the map view, since
that will be helpful when debugging the step after that one: resolving
frozen combat.

This would benefit from caching the Shapely data for SAM threat zones.
Right now it's generating them once per tick and the stuttering is
visible at max speed.

https://github.com/dcs-liberation/dcs_liberation/issues/1680
2021-12-21 14:52:28 -08:00
Dan Albert
8867aaeb6d Break up mapmodel.py monolith. 2021-12-21 13:01:24 -08:00
Dan Albert
2a75d14e0e Revert upgrade to pyside6.
This appears to be incompatible with pyinstaller. I get the following
when trying to run the executable generated with pyside6:

```
Traceback (most recent call last):
  File "qt_ui\main.py", line 29, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
  File "qt_ui\windows\QLiberationWindow.py", line 28, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
  File "qt_ui\widgets\map\QLiberationMap.py", line 11, in <module>
ImportError: could not import module 'PySide6.QtPrintSupport'
```
2021-11-21 17:39:43 -08:00
Dan Albert
bc819d59f4 Prevent drawing flights that are being deleted.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1720
2021-11-21 13:21:25 -08:00
Dan Albert
4a7dae9cc2 Upgrade to PySide6.
PySide2 renamed to PySide6 for Qt 6 support. It doesn't seem like
PySide2 is getting a 3.10 wheel, so upgrade to Qt 6 to prep for that.
2021-11-20 19:26:18 -08:00
Dan Albert
753b301e88 Fix crash when creating packages.
I'm not sure if this is a symptom of the bug or if this is actually a
separate bug, but pushing this for now to make the bug less severe.

https://github.com/dcs-liberation/dcs_liberation/issues/1720
2021-11-07 19:25:38 -08:00
Dan Albert
d31f0e22e3 Show the status of each flight in the UI.
https://github.com/dcs-liberation/dcs_liberation/issues/1704
2021-11-07 11:27:50 -08:00
Dan Albert
30cfd8a769 Don't rebuild the ATO model on selection change.
Much faster and avoids nasty concurrency issues between the JS and
Python side.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1719
2021-11-07 01:38:55 -07:00
Dan Albert
03430a4df5 Update the UI to show sim state.
https://github.com/dcs-liberation/dcs_liberation/issues/1704
2021-11-02 23:34:51 -07:00