OpenNaja / cobra-tools

A suite of GUI tools for extracting and modifying OVL and OVS archives, as well as editing the associated in-house file formats. Also includes a model plugin for Blender. For downloads, guides, and FAQs visit:
https://opennaja.github.io/cobra-tools/
GNU General Public License v3.0
103 stars 28 forks source link

Step by Step process to automate the creation of a habitat animal #383

Open ilodev opened 7 months ago

ilodev commented 7 months ago

Process and steps so we can all correct/contribute if there is anything missing here. This will be heavily modified during the script creation so please use comments or discord to address any changes/suggestions to want to see happening.

Concept To automate the creation of mods for games, where the input can stay at a high level (e.g. a Habitat Animal, or a Plant for Planet Zoo, etc.).

Process

Step 1 (prepopulate with known species) will later be not required, but for now it is the easiest way to start.

Inputs To create the mod the tool will need some input data. This is the expected input tree to populate the JSON file

Mod details

    "ContentPack": {
        "Name" : "TestMod",
        "Author" : "My Self",
        "Description" : "Empty description",
        "ID" : null, 
        "Requirements": {
            "ContentPacks" : [ "PZPlus", "Aoudad" ],
            "DLCFlags" : 256,
            "api" : {
                "acse" : 0.715,
            }
        },

Note: just because a mod is installed it doesn't mean it is enabled. Combination of all requirements are possible, for example to enable one mod only if PZPlus and Audad are installed, if the DLC8 is owned and ACSE version is >= 0.715. If any of these conditions is missing the mod will not be enabled. Note: if the mod provides content that is DLC locked through the fdb that should be enough in terms of DLC requirements.

Educational Content Mods can provide educational content unrelated to animals.

  "Content": {
    "Education" : {
        "ExampleExhibitSpecies01": {
            "Category": "Exhibit"
        },
        "ExampleHabitatSpecies02": {
            "Category": "Habitat"
        },
        "ExampleExhibitCustomContent": {
            "Name": "Name of content (goes as loc string)",
            "Description": "Test that goes as loc string",
            "Category": "Conservation"
        }        
    }
  }

TODO: Document the names generated automatically With this JSON setup we can rebuild the education.fdb

education.fdb EducationalContentType: from [ContentName], [Category], [Animal|EducationalContentType][ContentName] EducationResearchPacks [ContentName], [ContentName]Education[Level] (1 to 3) or empty row InfoboardMaterials: [ContentName], [InfoboardMaterial] (or "ED[TYPE]_[CONTENTNAME]_Mat" if missing)

Zoopedia

  "Content": {
    "Zoopedia" : {
        "ExampleExhibitSpecies01": {
            "ContentPack": "BaseGame",
            "EnclosureType": "LargeExhibit",
            "Description": "Description",

            "Class": "MyCustomClass",
            "Order": "MyCustomOrder",
            "Family": "Camelidae",
            "Genus": "Vicugna",
            "ScientificName": "ScientificName",
            "Continents": "Continents",
            "Countries" : "Countries",
            "ConservationStatus": "Domesticated",
            "WildPopulation": "WildPopulation",

            "SocialNeedsDescription": "SocialNeedsDescription",
            "AverageLifeExpectancy": ["Male life expectancy", "Female life expectancy"],
            "AverageSize": ["Male Size", "Female Size"],
            "AverageWeight": ["Male Weight", "Female Weight"],

            "Dominance": "Dominance",
            "MatingType": "is this from an enum",
            "ReproductionDescription": "ReproductionDescription",
            "ReproductionInCaptivity": "ReproductionInCaptivity",
            "SexualMaturityAge": "SexualMaturityAge",
            "SexualSterilityAge": "SexualSterilityAge",

            "ExhibitFood" : "This type of food",
            "FunFacts": [
                "This is the fun fact 1",
                "This is the fun fact 2",
                "This is the fun fact 3",
                "This is the fun fact 4",
                "This is the fun fact 5"
            ]
        }
    }

However, the smallest json definition required for a zoopedia page looks like this:

  "Content": {
    "Zoopedia" : {
        "ExampleExhibitSpecies01": {
            "ContentPack": "BaseGame",
            "EnclosureType": "LargeExhibit"
        }
    }

The missing zoopedia attributes will be prepopulated with default strings. EnclosureType and ContentPack must be withing the expected Zoopedia column options.

This is used to generate all zoopedia loc files and zoopedia images (SpeciesImageZoopedia and ZoopediaMap)

Research

This json is enough to generate both the .animalunlockresearchsettings and the fdb data, however; it assumes default education/breeding/zoopedia/enrichment research pack names:

    "Research": {
        "ExampleHabitatSpecies": {
            "AnimalType" : "Habitat",
            "HoursToComplete": 30,
            "UnlockSettings": [
                ["EN_Block_of_Ice", "EN_Dog_Ball_Feeder", "*ZoopediaL1"],
                ["EN_Large_Ball", "EN_Large_Ball_Snow", "*EducationL1", "*BreedingL1"],
                ["EN_Chew_Toy", "*ZoopediaL2", "DLC11_EN_PumpkinBall", "EN_Small_Ball", "EN_Small_Ball_Ice", "EN_Small_Ball_SouthAmerica", "*SupplementL1"],
                ["EN_Bamboo_Feeder", "*EducationL2", "EN_Cardboard_Box", "EN_Present"],
                ["EN_Blood_Trail", "*ZoopediaL3", "*SupplementL2"],
                ["EN_Pinata_Pronghorn", "EN_Sprinkler", "EN_Pinata", "*ZoopediaL4"],
                ["EN_Rotation_Line_Feeder", "EN_Rubber_Duck", "ArcticWolfBreedingL2"],
                ["EN_Prey_Scented_Sack", "*EducationL3", "*ZoopediaL5"]
            ],
            "BoostData":{
                "Breeding" : [0.15, 0.30],
                "Education": [0.5, 0.33, 0.25]
            }
        }
    }

Animals One of the main differences between exhibit and habitat animals definition comes from the prefab, only habitat animals need to define nagivation setup in their Game prefab.

After going through all the animal game prefabs, they all can basically be reduced to:

[Habitat_Species_Game] = {
    Components = {
        AnimalBrain = {
            NavigationAreaCostsFilterName = 'Default', -- Default filter cost
            NavigationModeFilterName = 'Walk',  -- Default mode name
        }
    },
    Properties = {
        PrefabName = {
            Default = '[Habitat_Species_Game] '
        },
        AnimalSpecies = {
            Default = '[HabitatSpecies]'
        }
    },
    Prefab = 'AnimalBase_Game'
},

However, AnimalBase_Game has a few more variables that could be exposed for the tool, (including VisualsMotionType)

and

[Habitat_Species_Male_Visuals] = {
    Properties = {
        ModelName = {
            Default = 'CUSTOM_Model_Name'
        },
        HitcheckModel = {
            Default = 'CUSTOM_Model_Name'
        },
        AssetPackages = {
            Default = {
                'CUSTOM_Ovl',
                __inheritance = 'Append'
            }
        },
    },
    Prefab = 'AnimalBase_Male_Visuals'
},

Same case as for the game, there are other variables that could be interesting to export for the tool in the visuals prefab.

Finally, Prefabs will be separated to individual files, loaded from ACSEData.lua.

From mod files to JSON TBD

From JSON to mod files

Main mod tasks

Creating content

Tool configuration

Current Script steps

Per Species (both exhibit and habitat)

ModularScenery Adding species tag to scenery items (still needs some more work)

Blueprint (built-in) Adding species tag to blueprints

Education (Species or Conservation)

Zoopedia (Habitat/Exhibits)

Research Item (Animal/Mechanical)

ContentPack wrap up

ACSE wrap up

Finishing TODO