From 03ccdaf9d355cd92b2924d76ec030b5e6c6d2a6c Mon Sep 17 00:00:00 2001 From: Druss99 <42724070+Druss99@users.noreply.github.com> Date: Sun, 23 Feb 2025 21:02:51 -0500 Subject: [PATCH] update to be more generic and give instructions for all modded unit types --- ...craft-Support.md => Modded-Unit-Support.md | 205 +++++++++++++----- 1 file changed, 156 insertions(+), 49 deletions(-) rename Modded-Aircraft-Support.md => Modded-Unit-Support.md (56%) diff --git a/Modded-Aircraft-Support.md b/Modded-Unit-Support.md similarity index 56% rename from Modded-Aircraft-Support.md rename to Modded-Unit-Support.md index cb5738e..5553daa 100644 --- a/Modded-Aircraft-Support.md +++ b/Modded-Unit-Support.md @@ -17,9 +17,9 @@ Here is how to do it: ## Step 1: Pydcs extensions injection: -Adding support for a modded aircraft is much more complicated than adding its name in a faction file. +Adding support for a modded unit is much more complicated than adding its name in a faction file. -In order for a modded aircraft to work with Retribution, we need to generate a data export for it to work with [pydcs](https://github.com/dcs-retribution/pydcs) +In order for a modded units to work with Retribution, we need to generate a data export for it to work with [pydcs](https://github.com/dcs-retribution/pydcs) Pydcs is the library we use to generate the .miz files, it is awesome, but it is not magical and can't support modded content natively if we don't tell it how do to do it. Its database also need to be updated every time DCS is updated. @@ -50,10 +50,11 @@ If you run it with mods installed, it generates a version of pydcs with support So to add support for modded aircrafts in Retribution, we then have to manually extract the new aircraft from the generated modded pydcs version, and create an extension (which is added to Retribution code) -Aircraft data will be found in the file aircraft.py generated by pydcs. Search your aircraft class in this file, and add it to a custom file. +Aircraft data will be found in the file aircraft.py, vehicles/infantry in vehicles.py, ships in ships.py, etc. generated by pydcs. Search your unit class in this file, and add it to a custom file. Your mod might have added new weapons, they'll be found in weapons.py, and you have to fetch them as well. Example of final file for the popular A-4E-C mod : https://github.com/dcs-retribution/dcs-retribution/blob/dev/pydcs_extensions/a4ec/a4ec.py +Example of final file for the CurrentHill USA Military assets pack: https://github.com/dcs-retribution/dcs-retribution/blob/dev/pydcs_extensions/usamilitaryassetspack/usamilitaryassetspack.py As you can see, extensions for mods are stored in this folder : https://github.com/dcs-retribution/dcs-retribution/blob/dev/pydcs_extensions @@ -70,12 +71,21 @@ class A_4E_C(PlaneType): ... ``` -Make sure your mod is imported in `pydcs_extensions/__init__.py`. +Any custom weapons with the mod should be included in the same file as the python class for the vehicle itself. After the weapons are defined, they must be injected into the `pydcs` weapons table. You do this by including the following line at the top of the file: +`from pydcs_extensions.weapon_injector import inject_weapons` + +and the following line after the weapons definition class: +`inject_weapons(CustomWeaponsClass)` where `CustomWeaponsClass` is the name of the weapons class you created. For the A4EC listed above, that name is `WeaponsA4EC`. + +See [A-4E-C.yaml](https://github.com/dcs-retribution/dcs-retribution/blob/dev/pydcs_extensions/a4ec/a4ec.py) for reference. + +Make sure your mod is imported in `pydcs_extensions/__init__.py` and in `pydcs_extensions//__init__.py` ## Step 2 : Campaign start setup -For campaign start setup and mod settings support, add your plane to the files [start_generator.py](https://github.com/dcs-retribution/dcs-retribution/blob/dev/game/theater/start_generator.py), [faction.py](https://github.com/dcs-retribution/dcs-retribution/blob/dev/game/factions/faction.py) and [QNewGameWizard.py](https://github.com/dcs-retribution/dcs-retribution/blob/dev/qt_ui/windows/newgame/QNewGameWizard.py) +For campaign start setup and mod settings support, add your plane to the files [start_generator.py](https://github.com/dcs-retribution/dcs-retribution/blob/dev/game/theater/start_generator.py), [faction.py](https://github.com/dcs-retribution/dcs-retribution/blob/dev/game/factions/faction.py), [QNewGameWizard.py](https://github.com/dcs-retribution/dcs-retribution/blob/dev/qt_ui/windows/newgame/QNewGameWizard.py), and [QGeneratorSettings.py](https://github.com/dcs-retribution/dcs-retribution/blob/dev/qt_ui/windows/newgame/WizardPages/QGeneratorSettings.py) +[start_generator.py](https://github.com/dcs-retribution/dcs-retribution/blob/aaa47191af8e18860c5ee33996aa635b730e3017/game/theater/start_generator.py#L68): ```python a4_skyhawk: bool = False f22_raptor: bool = False @@ -84,7 +94,7 @@ For campaign start setup and mod settings support, add your plane to the files [ su57_felon: bool = False frenchpack: bool = False ``` - +[faction.py](https://github.com/dcs-retribution/dcs-retribution/blob/aaa47191af8e18860c5ee33996aa635b730e3017/game/factions/faction.py#L383): ```python # aircraft if not mod_settings.a4_skyhawk: @@ -99,7 +109,7 @@ For campaign start setup and mod settings support, add your plane to the files [ if not mod_settings.su57_felon: self.remove_aircraft("Su-57") ``` - +[QNewGameWizard.py](https://github.com/dcs-retribution/dcs-retribution/blob/aaa47191af8e18860c5ee33996aa635b730e3017/qt_ui/windows/newgame/QNewGameWizard.py#L90): ```python mod_settings = ModSettings( a4_skyhawk=self.field("a4_skyhawk"), @@ -110,38 +120,27 @@ For campaign start setup and mod settings support, add your plane to the files [ su57_felon=self.field("su57_felon"), frenchpack=self.field("frenchpack"), ``` - +[QGeneratorSettings.py snippet](https://github.com/dcs-retribution/dcs-retribution/blob/aaa47191af8e18860c5ee33996aa635b730e3017/qt_ui/windows/newgame/WizardPages/QGeneratorSettings.py#L91): ```python - modSettingsGroup = QtWidgets.QGroupBox("Mod Settings") - a4_skyhawk = QtWidgets.QCheckBox() - self.registerField("a4_skyhawk", a4_skyhawk) - hercules = QtWidgets.QCheckBox() - self.registerField("hercules", hercules) - f22_raptor = QtWidgets.QCheckBox() - self.registerField("f22_raptor", f22_raptor) - jas39_gripen = QtWidgets.QCheckBox() - self.registerField("jas39_gripen", jas39_gripen) - su57_felon = QtWidgets.QCheckBox() - self.registerField("su57_felon", su57_felon) + self.a4_skyhawk = QtWidgets.QCheckBox() + self.registerField("a4_skyhawk", self.a4_skyhawk) + self.a6a_intruder = QtWidgets.QCheckBox() + self.registerField("a6a_intruder", self.a6a_intruder) + self.a7e_corsair2 = QtWidgets.QCheckBox() + self.registerField("a7e_corsair2", self.a7e_corsair2) + self.ea6b_prowler = QtWidgets.QCheckBox() + self.registerField("ea6b_prowler", self.ea6b_prowler) +``` +[QGeneratorSettings.py snippet](https://github.com/dcs-retribution/dcs-retribution/blob/aaa47191af8e18860c5ee33996aa635b730e3017/qt_ui/windows/newgame/WizardPages/QGeneratorSettings.py#L183): +```python + ("A-4E Skyhawk (v2.2.0)", self.a4_skyhawk), + ("A-6A Intruder (v2.7.5.01)", self.a6a_intruder), + ("A-7E Corsair II", self.a7e_corsair2), + ("C-130J-30 Super Hercules (v6.8.2)", self.hercules), + ("Cold War Assets mod (v1.0)", self.coldwarassets), ``` -```python - modLayout = QtWidgets.QGridLayout() - modLayout.addWidget(QtWidgets.QLabel("A-4E Skyhawk"), 1, 0) - modLayout.addWidget(a4_skyhawk, 1, 1) - modLayout.addWidget(QtWidgets.QLabel("F-22A Raptor"), 2, 0) - modLayout.addWidget(f22_raptor, 2, 1) - modLayout.addWidget(QtWidgets.QLabel("C-130J-30 Super Hercules"), 3, 0) - modLayout.addWidget(hercules, 3, 1) - modLayout.addWidget(QtWidgets.QLabel("JAS 39 Gripen"), 4, 0) - modLayout.addWidget(jas39_gripen, 4, 1) - modLayout.addWidget(QtWidgets.QLabel("Su-57 Felon"), 5, 0) - modLayout.addWidget(su57_felon, 5, 1) - modLayout.addWidget(QtWidgets.QLabel("Frenchpack"), 6, 0) - modLayout.addWidget(frenchpack, 6, 1) -``` - -## Step 3 : Retribution flight planner database setup: +## Step 3 : Retribution unit file setup: ### DCS Retribution @@ -190,6 +189,25 @@ Aircraft can have identical weights for a task. When multiple aircraft have the For an overview of all tasks and weights in Retribution, run `dcs-retribution.exe dump-task-priorities` (from the command line). That will dump `Retribution/Debug/priorities.yaml` to your DCS Saved Games directory. +See [A-4E-C.yaml](https://github.com/dcs-retribution/dcs-retribution/blob/dev/resources/units/aircraft/A-4E-C.yaml) for reference. + +Similarly for ground units, each unit has a yaml file in `resources/units/ground_units/*.yaml`. This file determines what type of unit it is, the price, and the name of available variants. It is important to note that the ID of the vehicle from the pydcs export must match the name of the unit yaml file. Example: + +```yaml +# From CH_KrAZ6322.yaml +class: Logistics +description: "The KrAZ-6322 is a Ukrainian off-road six-wheel drive truck intended for extreme + conditions. It has been produced since 1994 and is manufactured at the KrAZ factory in Kremenchuk, + Ukraine. It was first presented at the 1994 defence industry trade show in Kyiv." +introduced: 1994 +manufacturer: KrAZ +origin: Ukraine +price: 3 +role: Tactical Transport Vehicle +variants: + "[CH] KrAZ-6322 Truck": {} +``` + ### DCS Liberation 6 (info retained for archival purposes only) Please note, that this is no longer required in DCS Retribution, as the capability list has been replaced by the task weights, detailed above. These instructions are only retained for DCS Liberation version 6 reference purposes. @@ -214,35 +232,124 @@ CAP_CAPABLE = [ See [Custom Loadouts](Custom-Loadouts) Create default loadouts for the new plane. -Any custom weapons with the mod should be included in the same file as the python class for the vehicle itself. After the weapons are defined, they must be injected into the `pydcs` weapons table. You do this by including the following line at the top of the file: -`from pydcs_extensions.weapon_injector import inject_weapons` - -and the following line after the weapons definition class: -`inject_weapons(CustomWeaponsClass)` where `CustomWeaponsClass` is the name of the weapons class you created. For the A4EC listed above, that name is `WeaponsA4EC`. - ## Step 5: Factions See [Custom Factions](Custom-Factions) and add the mods to the appropriate factions. If there are no appropriate factions, create a new one, but you don't need to worry about breaking existing factions by "requiring" the mod; Retribution will filter out mods that the player doesn't use. -## Step 6: Resource files for aircraft +## Step 6: Layouts and groups -Add new yaml files for your aircraft in resources/units/aircraft/ +If you're implementing a mod pack with SAM or AntiShip site units, you may want to create a new group so they can be used for LORAD/MERAD/SHORAD. Example from MIM-104 Patriot: -See [A-4E-C.yaml](https://github.com/dcs-retribution/dcs-retribution/blob/dev/resources/units/aircraft/A-4E-C.yaml) for reference. +```yaml +name: MIM-104 Patriot (Mobile) +tasks: + - LORAD +units: + - "[CH] MIM-104 AN/MPQ-65 STR (HEMTT)" + - "[CH] MIM-104 AN/MPQ-65A STR (HEMTT)" + - "[CH] MIM-104 LTAMDS STR (HEMTT)" + - "[CH] MIM-104 ECS (HEMTT)" + - "[CH] MIM-104 EPP (HEMTT)" + - "[CH] MIM-104 M903 PAC-2 GEM/T LN (HEMTT)" + - "[CH] MIM-104 M903 PAC-3 MSE LN (HEMTT)" + - "[CH] Oshkosh HEMTT M977" +layouts: + - MIM-104 Patriot Battery +``` +As you can see, each group has a layout. If possible, you should attempt to reuse existing layouts like `6 Launcher Circle`. Sometimes these sites do require their own layout like the MIM-104. In the layout file you can specify the unit class or unit type you want to use if you need to be more specific. Example: -## Step 7: Add icons for the UI (Optional) +```yaml +name: MIM-104 Patriot Battery +tasks: + - LORAD +groups: + - Patriot: + - name: Patriot Battery 0 + unit_count: + - 2 + unit_classes: + - SearchTrackRadar + - name: Patriot Battery 1 + unit_count: + - 1 + unit_classes: + - Logistics + - name: Patriot Battery 2 + unit_count: + - 1 + unit_types: + - MIM104_ECS + - name: Patriot Battery 3 + unit_count: + - 1 + unit_classes: + - Logistics + - name: Patriot Battery 4 + unit_count: + - 1 + unit_types: + - MIM104_EPP + - name: Patriot Battery 5 + unit_count: + - 8 + unit_classes: + - Launcher + - PD: + - name: Patriot Battery 7 + optional: true + sub_task: PointDefense + unit_count: + - 1 + - 2 + unit_classes: + - SHORAD + - name: Patriot Battery 6 + sub_task: AAA + optional: true + unit_count: + - 1 + - 2 + unit_classes: + - AAA +layout_file: resources/layouts/anti_air/Patriot_Battery.miz +``` +This layout file points to the Patriot_Battery.miz file which the normal patriot site is using. Since the patriot site layout was very similar but a little too specific, the contributor chose to create a new layout file instead. + +Note: In the groups file you use the variant name of the unit while in the layout file you use the ID of the unit. + +## Step 7: Update radar db: + +Like before, if you implemented a SAM site or a ship that has a radar, you want to include it in the radar db. Example: + +```python +from pydcs_extensions import usamilitaryassetspack as usamap +``` +[TELARS/Track Radars/Launcher Tracker Pairs/Units with Radar](https://github.com/dcs-retribution/dcs-retribution/blob/aaa47191af8e18860c5ee33996aa635b730e3017/game/data/radar_db.py#L34): +```python + usamap.MIM104_ANMPQ65, + usamap.MIM104_ANMPQ65A, + usamap.MIM104_ANMPQ65_HEMTT, + usamap.MIM104_ANMPQ65A_HEMTT, + usamap.MIM104_LTAMDS, + usamap.MIM104_LTAMDS_HEMTT, + usamap.CH_THAAD_ANTPY2, +``` + +## Step 8: Add icons for the UI (Optional) Add icons for the new plane there: https://github.com/dcs-retribution/dcs-retribution/tree/dev/resources/ui/units/aircrafts/icons And a banner, there: https://github.com/dcs-retribution/dcs-retribution/tree/dev/resources/ui/units/aircrafts/banners -## Step 8: Playtest +Icons should be 91x24 and banners are 720x360 pixels both in jpeg format. + +## Step 9: Playtest Play a few missions with the plane, test as much cases as you can. -## Step 9: Release +## Step 10: Release -## Step 10: Maintenance +## Step 11: Maintenance Redo the data export thing (Step 1), every time said mod is updated, if needed create new loadouts and account for new capabilities in db.