Migrate generators to templats

- added all new templates
- deleted the generators
- added documentation
This commit is contained in:
RndName
2022-01-29 00:43:28 +01:00
parent 60c8c80480
commit 344d4e31b7
128 changed files with 2736 additions and 4198 deletions

BIN
doc/templates/ground_object_buy_menu.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

56
doc/templates/template_list.md vendored Normal file
View File

@@ -0,0 +1,56 @@
| Role | Tasks | Template Name | Units |
|---------------|------------------------------|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| AntiAir | AAA | AAA Site | <ul><li>Classes = [ AAA]</li><li>Classes = [ Logistics]</li></ul> |
| AntiAir | AAA | AAA Mobile | <ul><li>Classes = [ AAA]</li><li>Classes = [ Logistics]</li></ul> |
| AntiAir | AAA | AAA Radar Site | <ul><li>Classes = [ SearchRadar]</li><li>Classes = [ AAA]</li><li>Classes = [ Logistics]</li></ul> |
| AntiAir | AAA | Cold War Flak Site | <ul><li>Classes = [ SearchRadar]</li><li>8.8 cm Flak 18</li><li>S-60 57mm</li><li>Classes = [ AAA]</li><li>Classes = [ Logistics]</li></ul> |
| AntiAir | AAA | Flak Site | <ul><li>2 cm Flakvierling 38, 8.8 cm Flak 18, 8.8 cm Flak 36, 8.8 cm Flak 37, 8.8 cm Flak 41, 2 cm Flak 38</li><li>2 cm Flakvierling 38</li><li>8.8 cm Flak 36</li><li>SL Flakscheinwerfer 37</li><li>PU Maschinensatz_33</li><li>AAA SP Kdo.G.40</li><li>LUV Kubelwagen 82</li><li>Truck Opel Blitz</li></ul> |
| AntiAir | AAA | WW2 Flak Site | <ul><li>8.8 cm Flak 18</li><li>Truck Opel Blitz</li></ul> |
| AntiAir | AAA | WW2 Ally Flak Site | <ul><li>QF 3.7-inch AA Gun</li><li>M1 37mm Gun</li><li>M45 Quadmount</li><li>Willys Jeep</li><li>M30 Cargo Carrier</li><li>M4 High-Speed Tractor</li><li>Truck Bedford</li></ul> |
| AntiAir | MERAD | Hawk Site | <ul><li>SAM Hawk SR (AN/MPQ-50)</li><li>SAM Hawk Platoon Command Post (PCP)</li><li>SAM Hawk TR (AN/MPQ-46)</li><li>SAM Hawk LN M192</li><li>M163 Vulcan Air Defense System</li></ul> |
| AntiAir | MERAD | SA-2/S-75 Site | <ul><li>SAM P19 "Flat Face" SR (SA-2/3)</li><li>SAM SA-2 S-75 "Fan Song" TR</li><li>SAM SA-2 S-75 "Guideline" LN</li></ul> |
| AntiAir | MERAD | SA-3/S-125 Site | <ul><li>SAM P19 "Flat Face" SR (SA-2/3)</li><li>SAM SA-3 S-125 "Low Blow" TR</li><li>SAM SA-3 S-125 "Goa" LN</li></ul> |
| AntiAir | MERAD | SA-6 Kub Site | <ul><li>SAM SA-6 Kub "Straight Flush" STR</li><li>SAM SA-6 Kub "Gainful" TEL</li></ul> |
| AntiAir | MERAD | SA-11 Buk Battery | <ul><li>SAM SA-11 Buk "Gadfly" Snow Drift SR</li><li>SAM SA-11 Buk "Gadfly" C2</li><li>SAM SA-11 Buk "Gadfly" Fire Dome TEL</li></ul> |
| AntiAir | MERAD | SA-17 Grizzly Battery | <ul><li>SAM SA-11 Buk "Gadfly" Snow Drift SR</li><li>SAM SA-11 Buk "Gadfly" C2</li><li>SAM SA-17 Buk M1-2 LN 9A310M1-2</li></ul> |
| AntiAir | MERAD | NASAMS AIM-120B | <ul><li>SAM NASAMS SR MPQ64F1</li><li>SAM NASAMS C2</li><li>SAM NASAMS LN AIM-120B</li></ul> |
| AntiAir | MERAD | NASAMS AIM-120C | <ul><li>SAM NASAMS SR MPQ64F1</li><li>SAM NASAMS C2</li><li>SAM NASAMS LN AIM-120C</li></ul> |
| AntiAir | SHORAD | Rapier AA Site | <ul><li>SAM Rapier Blindfire TR</li><li>SAM Rapier Tracker</li><li>SAM Rapier LN</li></ul> |
| AntiAir | SHORAD | Roland Site | <ul><li>SAM Roland EWR</li><li>Roland 2 (Marder Chassis)</li><li>Truck M818 6x6</li></ul> |
| AntiAir | SHORAD | HQ-7 Site | <ul><li>HQ-7 Self-Propelled STR</li><li>HQ-7 Launcher</li><li>ZU-23 on Ural-375</li></ul> |
| AntiAir | SHORAD | Freya EWR Site | <ul><li>EWR FuMG-401 Freya LZ</li><li>2 cm Flakvierling 38</li><li>8.8 cm Flak 18</li><li>LUV Kubelwagen 82</li><li>Sd.Kfz.7 Tractor</li><li>LUV Kettenrad</li><li>PU Maschinensatz_33</li><li>AAA SP Kdo.G.40</li><li>Infantry Mauser 98</li></ul> |
| AntiAir | SHORAD | Short Range Anti Air Group | <ul><li>Classes = [ SHORAD]</li><li>Classes = [ Logistics]</li></ul> |
| AntiAir | LORAD | Patriot Battery | <ul><li>SAM Patriot STR</li><li>SAM Patriot CR (AMG AN/MRC-137)</li><li>SAM Patriot ECS</li><li>SAM Patriot C2 ICC</li><li>SAM Patriot EPP-III</li><li>SAM Patriot LN</li><li>Classes = [ AAA]</li><li>Classes = [ SHORAD]</li></ul> |
| AntiAir | LORAD | SA-5/S-200 Site | <ul><li>SAM SA-5 S-200 ST-68U "Tin Shield" SR</li><li>SAM SA-5 S-200 "Square Pair" TR"</li><li>Truck Ural-375</li><li>SAM SA-5 S-200 "Gammon" LN"</li></ul> |
| AntiAir | LORAD | SA-12/S-300V Battery | <ul><li>SAM SA-12 S-300V 9S15 SR</li><li>SAM SA-12 S-300V 9S19 SR</li><li>SAM SA-12 S-300V 9S457 CP</li><li>SAM SA-12 S-300V 9S32 TR</li><li>SAM SA-12 S-300V 9A82 LN</li><li>SAM SA-12 S-300V 9A83 LN</li><li>SA-19 Grison (2K22 Tunguska)</li><li>SA-15 Tor</li></ul> |
| AntiAir | LORAD | SA-20/S-300PMU-1 Battery | <ul><li>SAM SA-20 S-300PMU1 SR 5N66E</li><li>SAM SA-20 S-300PMU1 SR 64N6E</li><li>SAM SA-20 S-300PMU1 CP 54K6</li><li>SAM SA-20 S-300PMU1 TR 30N6E</li><li>SAM SA-20 S-300PMU1 LN 5P85CE</li><li>SAM SA-20 S-300PMU1 LN 5P85DE</li><li>SA-19 Grison (2K22 Tunguska)</li><li>SA-15 Tor</li></ul> |
| AntiAir | LORAD | SA-20B/S-300PMU-2 Battery | <ul><li>SAM SA-20 S-300PMU1 SR 5N66E</li><li>SAM SA-20 S-300PMU1 SR 64N6E</li><li>SAM SA-20B S-300PMU2 CP 54K6E2</li><li>SAM SA-20B S-300PMU2 TR 92H6E(truck)</li><li>SAM SA-20B S-300PMU2 LN 5P85SE2</li><li>SA-19 Grison (2K22 Tunguska)</li><li>SA-15 Tor</li></ul> |
| AntiAir | LORAD | SA-23/S-300VM Battery | <ul><li>SAM SA-23 S-300VM 9S15M2 SR</li><li>SAM SA-23 S-300VM 9S19M2 SR</li><li>SAM SA-23 S-300VM 9S457ME CP</li><li>SAM SA-23 S-300VM 9S32ME TR</li><li>SAM SA-23 S-300VM 9A82ME LN</li><li>SAM SA-23 S-300VM 9A83ME LN</li><li>SA-19 Grison (2K22 Tunguska)</li><li>SA-15 Tor</li></ul> |
| AntiAir | LORAD | SA-10/S-300PS Battery | <ul><li>SAM SA-10 S-300 "Grumble" Clam Shell SR</li><li>SAM SA-10 S-300 "Grumble" Big Bird SR</li><li>SAM SA-10 S-300 "Grumble" C2</li><li>SAM SA-10 S-300 "Grumble" Flap Lid TR</li><li>SAM SA-10 S-300 "Grumble" TEL D</li><li>SAM SA-10 S-300 "Grumble" TEL C</li><li>Classes = [ AAA]</li><li>Classes = [ SHORAD]</li></ul> |
| AntiAir | EarlyWarningRadar | Early-Warning Radar | <ul><li>Classes = [ EarlyWarningRadar]</li></ul> |
| Building | StrikeTarget | ww2bunker1 | <ul><li>Siegfried Line</li><li>Fire Control Bunker</li><li></li></ul> |
| Building | StrikeTarget | allycamp1 | <ul><li>FARP Tent</li><li>Haystack 4</li><li>Haystack 3</li><li>Concertina wire</li><li></li></ul> |
| Building | StrikeTarget | fuel1 | <ul><li>Tank</li><li>Tank 3</li></ul> |
| Building | StrikeTarget | ware1 | <ul><li>Warehouse</li><li>Hangar A</li></ul> |
| Building | StrikeTarget | farp1 | <ul><li>FARP Tent</li><li>FARP Ammo Dump Coating</li><li>FARP CP Blindage</li><li>FARP Fuel Depot</li></ul> |
| Building | StrikeTarget | derrick1 | <ul><li>Oil derrick</li><li>Pump station</li><li>Subsidiary structure 2</li></ul> |
| Building | StrikeTarget | village1 | <ul><li>Small house 1A</li><li>Small werehouse 1</li><li>Small house 1B</li></ul> |
| Building | StrikeTarget | ww2bunker2 | <ul><li>Fire Control Bunker</li><li>Siegfried Line</li><li>Concertina wire</li><li>Belgian gate</li><li>Czech hedgehogs 1</li></ul> |
| Building | Ammo | ammo1 | <ul><li>.Ammunition depot</li><li>Hangar B</li></ul> |
| Building | StrikeTarget, Comms | comms | <ul><li>TV tower, Comms tower M</li></ul> |
| Building | Oil | oil1 | <ul><li>Oil platform</li></ul> |
| Building | FOB | fob1 | <ul><li>.Command Center</li><li>Barracks 2</li><li>Garage small B</li></ul> |
| Building | StrikeTarget, Power | power1 | <ul><li>Repair workshop</li><li>Workshop A</li><li>Garage B</li><li>Farm B</li></ul> |
| Building | Factory | factory1 | <ul><li>Tech combine</li><li>Tech hangar A</li></ul> |
| Defenses | Missile | Missile | <ul><li>Classes = [ Missile]</li><li>Classes = [ Logistics]</li><li>Classes = [ AAA]</li><li>Classes = [ SHORAD]</li></ul> |
| Defenses | Coastal | Silkworm | <ul><li>Classes = [ SearchRadar]</li><li>Classes = [ Missile]</li><li>Classes = [ Logistics]</li><li>Classes = [ AAA]</li><li>Classes = [ SHORAD]</li></ul> |
| GroundForce | BaseDefense, FrontLine | Armor Group | <ul><li>Classes = [ APC, ATGM, IFV, Tank]</li></ul> |
| GroundForce | BaseDefense, FrontLine | Armor Group with Anti-Air | <ul><li>Classes = [ APC, ATGM, IFV, Tank]</li><li>Classes = [ AAA, SHORAD, Manpad]</li></ul> |
| Naval | Navy | WW2 LST Group | <ul><li>LS Samuel Chase</li><li>LST Mk.II</li></ul> |
| Naval | Navy | Russian Navy | <ul><li>Corvette 1124.4 Grish, Corvette 1241.1 Molniya</li><li>Frigate 11540 Neustrashimy, Frigate 1135M Rezky</li><li>Cruiser 1164 Moskva</li></ul> |
| Naval | Navy | Chinese Navy | <ul><li>Type 054A Frigate</li><li>Type 052C Destroyer, Type 052B Destroyer</li></ul> |
| Naval | Navy | Naval Two Ship | <ul><li>Classes = [ Destroyer, Cruiser, Boat, Submarine, LandingShip]</li></ul> |
| Naval | AircraftCarrier | Carrier Group | <ul><li>Classes = [ AircraftCarrier]</li><li>Classes = [ Destroyer]</li></ul> |
| Naval | AircraftCarrier | Carrier Strike Group 8 | <ul><li>CVN-74 John C. Stennis</li><li>DDG Arleigh Burke IIa</li><li>CG Ticonderoga</li></ul> |
| Naval | HelicopterCarrier | LHA Group | <ul><li>Classes = [ HelicopterCarrier]</li><li>Classes = [ Destroyer]</li></ul> |
| Missing Units | SK_C_28_naval_gun, house2arm | | |

BIN
doc/templates/template_miz_example.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
doc/templates/template_overview.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

202
doc/templates/templates.md vendored Normal file
View File

@@ -0,0 +1,202 @@
# The Template System
The Template System is a complete rework of the generator-based logic to build theater-ground-objects (Liberation Objects).
In the original system the generator was written in python and generated a group with a defined and static logic, written in code.
The template sytem will now decouple the alignment / positioning from units and the definition of theire actual type (like Ural-375).
The template system allows to define the layout and set which unit types or classes (All logistic units for example) are able to fit into the template.
Ultimately this will allow to have generalized templates which can be reused by multiple types of units. Best example is the definition of a SAM layout.
Previously we had a generator for every different SAM Site, now we can just reuse the alignemnt (e.g. 6 Launchers in a circle alignment) with more generalization.
This also allows Users and Designers to easily create or modify templates as the new templates are defined with the DCS Mission editor and an additional .yaml file which provides mapping information.
In total the new system reduces the complexity and allows to precisely align / orient units as needed and create realistic looking ground units.
As the whole ground unit generation and handling was reworked it is now also possible to add static units to a ground object, so even Fortifcation or similar can be added to templates in the future.
## General Concept
![Overview](template_overview.png)
TODO: Describe the general flow of the Template system
TODO Lifecycle:
The template will be automatically validated on campaign generation against the player and enemy factions.
If the factions support the template (based on the unit_types and unit_classes) then it will be added to the game.
If a faction does not support a group from the template it will be removed if optional == True otherwise the complete template will be marked as unsupported and will not be used for the game.
During campaign initialization the start_generator will request unit_groups for the preset locations defined by the campaign designer. The faction will then offer possible groups and the matching template.
The Liberation Group (TheaterGroundObject) is then being generated from this UnitGroup.
- GroundWar currently does **not** use the template system
- User can buy new SAM or ArmorGroup using this template system
Example for a customized Ground Object Buy Menu which makes use of Templates and UnitGroups:
![ground_object_buy_menu.png](ground_object_buy_menu.png)
### The template miz
*Important*: Every unit_type has to be in a separate Group for the template to work.
The template system merges the groups back together later with the group_id property (defaults to 1 which means that all groups in the template will be merged to group 1)
The function of the miz is to have the positioning and alignment of all the units within the template. Coordinates and headings will be used for the generated group.
Unit Count per group has to be the amount set with the unit_count property.
During template generation the system will go through all possible units and will assign the respective unit_type to the units up to the maximum allow unit_count from the mapping.
![template_miz_example.png](template_miz_example.png)
### The template yaml
Possible Information:
| Property | Type | Required | Description | Example |
|---------------|-----------------------|----------|----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|
| Name | (str) | Yes | A name to identify the template | `name: Armor Group` |
| Role | (GroupRole) | Yes | The role which the template should fit in | `role: AntiAir` or `role: GroundForce` |
| Tasks | (list of GroupTask) | Yes | A list of tasks which the template can fullfill | `tasks: - AAA - SHORAD` |
| Generic | (bool, default False) | No | If this is true this template will be used to create general unitGroups | |
| Description | (str) | No | Short description of the template | |
| category | (str) | No | Only used for building templates to identify the type of the building | `category: ammo` |
| Groups | (list of Groups) | Yes | see below for definition of a group | |
| template_file | (str) | No | the .miz file which has the template included. Only needed if the file has a different name than the yaml file | `template_file: resources/templates/anti_air/legacy_ground_templates.miz` |
Groups within the template are defined as following:
| Property | Type | Required | Description | Example |
|--------------|------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| name | (str) | Yes | The group name used in the .miz. Must match exactly! | |
| optional | (bool, default: False) | No | Defines wether the template can be used without this group if the faction has no access to the unit type or the user wants to disable this group | |
| group | (int, default: 1) | No | The ID of the group which the templategroup will be merged into | |
| unit_count | (list of int) | No | Amount of units to be generated for this group. Can be fixed or a range where it will be picked randomly | |
| unit_types | (list dcs unit types) | No | Specific unit_types for ground units. Complete list from pydcs: [Vehicles.py](https://github.com/pydcs/dcs/blob/master/dcs/vehicles.py). This list is extended by all supported mods! | |
| unit_classes | (list unit classes) | No | Unit_classes of supported units. Defined in [UnitClass](/game/data/units.py) | |
| statics | (list static types) | No | Specific unit_types of statics. Complete list from pydcs: [Statics.py](https://github.com/pydcs/dcs/blob/master/dcs/statics.py) | |
Complete example of a generic template for AAA Groups:
```
name: AAA Site
description: A standard AAA template
generic: true
role: AntiAir
tasks:
- AAA
groups:
- name: AAA Site 0
group: 1
unit_count:
- 2
- 6
unit_classes:
- AAA
- name: AAA Site 1
optional: true
group: 1
unit_count:
- 1
- 2
unit_classes:
- Logistics
template_file: resources/templates/anti_air/AAA.miz
```
### Roles, Tasks and Classes
TODO Improve Naming? Same logic as with the Squadrons.. Also brainstorm if we should rename the UnitGroup which basicly is the equivalent of a "Package"
Role and Tasking
[GroupRole and GroupTask](/game/data/groups.py)
[UnitClass](/game/data/units.py)
## How to add / modify a template
template.miz (positioning / alignment) and template.yaml (Mapping)
Best practice:
- Copy existing Template and rename the files
- Adjust the .miz and change the group names accordingly
- Adjust the .yaml file to the needs and check for the correct group names
## Migration from Generators
- All generators removed and migrated to templates
- These templates will in the next step be generalized
TODO: Update the template_list.md with the changes in Role/Tasking
[List of supported templates](template_list.md)
### Updates for Factions
With the rework there were also some changes to the faction file definitions. Older faction files can not be loaded anymore and have to be adopted to the new changes.
During migration all default factions were automatically updated, so they will work out of the box.
What was changed:
- Removed the `ewrs` list. All EWRs are now defined in the list "air_defense_units".
- Added the `air_defense_units` list. All units with the Role AntiAir can be defined here as [GroundUnitType](/game/dcs/groundunittype.py). All possible units are defined in [/resources/units/ground_units](/resources/units/ground_units)
- Added `preset_groups`. This list allows to define Preset Groups (described above) like SAM Systems consisting of Launcher, SR, TR and so on instead of adding them each to "air_defense_units". The presets are defined in [/resources/units/unit_groups](/resources/units/unit_groups)
- Migrated `air_defenses` to air_defense_units and preset_sets.
- `Missiles` are migrated to GroundUnitTypes instead of Generator names (see air_defense_units for how to use)
- Removed `cruisers`, `destroyers` and `naval_generators`. Migrated them to naval_units and preset_groups
- added `naval_units` with the correct ship name found here [/resources/units/ships](/resources/units/ships)
- `aircraft_carrier` and `helicopter_carrier` were moved to `naval_units` as well.
Possible Preset Groups:
TODO generate list with old generator name
Possible EWRs:
| Name in Faction file |
|------------------------------------------------------|
| EWR 1L13 |
| EWR 55G6 |
| MCC-SR Sborka "Dog Ear" SR |
| SAM Roland EWR |
| SAM P19 "Flat Face" SR (SA-2/3) |
| SAM Patriot STR |
| SAM SA-10 S-300 "Grumble" Big Bird SR |
| SAM SA-11 Buk "Gadfly" Snow Drift SR |
| SAM SA-6 Kub "Straight Flush" STR |
| SAM Hawk SR (AN/MPQ-50) |
| SAM SA-5 S-200 ST-68U "Tin Shield" SR |
## Unit Groups
- Sum up groups of different units which are used together (like a sam site).
- UnitGroup allows to define this logical group and add this to the faction file.
- UnitGroups can have preferred templates
# Open Points
- [x] Rework SAM Systems to unit_groups: migrated all `air_defense`
- [ ] Review Naming of all classes and so on
- [X] Improve UI Display Name for the new ShipUniType
- [ ] Verify if the campaign will be generated the same as before
- [x] Fix the generation of buildings
- [ ] Verify the handling of buildings (ammo and factory for example work different.)
- [X] Correct Missiles and Coastal (Counts?)
- [X] Faction Group Count (Navy, Missile, Coastal).. used for?? For nothing! removed.
- [x] Navy Generators -> Destroyers, Cruisers und Preset_groups Migration
- [x] Fix & Generalize Navy Templates (wrong unit number)
- [X] Fix Bug: Enemy Navy PLanes spawn at blue Carrier.
- [x] Add Naming for all AircraftCarrier and HelicopterCarrier (whats with the SC updated ones?)
- [X] Verfiy SuperCarrier Upgrade
- [X] Special Handling for Carrier Strike Group 8 (was not even working before..) can now be added as preset group
- [X] Validate that all Waypoints and taskings are correct and working (some use the group.name)
- [ ] Verify that DEAD Flights are untouched from these changes.. They are missing a attack command
- [ ] Finish Documentation
- [ ] Naming of created groups -> It uses the template name currently which is not great
- [x] Fix the Faction overview site not showing the newly added preset_groups and AA Units
- [ ] Add missing classes to the units so that they can be used by the templates
- [x] Replace BuyUi implementation from Template to "Preset" by using the available UnitGroups
- [x] Fix Buy menu for Armor Groups.
- [x] Fix Buy menu not allowing to change the amount when only one unit_type is available.
- [x] Fix Group order is not correct (group2 is 0, group1 is 1 if dcs_group id for group2 is smaller)
- [ ] Add generalized Templates for Lorad and Merad
- [ ] Generalize all Templates