This idea is from a wiki attempt at Documenting the AI, and I want to try to use this forum post to document the AI, and what we discuss here can be ported to the wiki pages. I would like to start putting together a guide to AI modding, what each file and parameter and response does and how to use them. I suppose I will go through and make a note of everything I see in the AI files, but as I make this if anyone else wants to comment on more specifics or how something is used, it would be appreciated. I want to make this as much for myself as others, as this is a real ***-pain and knowing what we can add/remove to make AI use mods better can improve server mods, as most people play vs AI, and to test mods vs AI helps establish mod usability. Locations and Directories of AI files... [Stable|PTE|ServerMods]/[media|modname]/ui/main/game/new_game/js/ai.json [Stable|PTE|ServerMods]/[media|modname]/pa/ai/... ...ai_config.json ...ai_unit_map.json ...platoon_templates.json ...fabber_builds/commander_economy_builds.json ...fabber_builds/commander_misc_builds.json ...fabber_builds/fabber_air_builds.json ...fabber_builds/fabber_defense_builds.json ...fabber_builds/fabber_economy_builds.json ...fabber_builds/fabber_intel_builds.json ...fabber_builds/fabber_land_builds.json ...fabber_builds/fabber_misc_builds.json ...fabber_builds/fabber_naval_builds.json ...fabber_builds/fabber_offense_builds.json ...fabber_builds/fabber_orbital_builds.json ...factory_builds/factory_air_builds.json ...factory_builds/factory_land_builds.json ...factory_builds/factory_misc_builds.json ...factory_builds/factory_naval_builds.json ...factory_builds/factory_orbital_builds.json ...neural_networks/bomber_attack.json ...neural_networks/fighter_attack.json ...neural_networks/land_attack.json ...platoon_builds/platoon_air_builds.json ...platoon_builds/platoon_land_builds.json ...platoon_builds/platoon_misc_builds.json ...platoon_builds/platoon_naval_builds.json ...platoon_builds/platoon_orbital_builds.json *NOTE* ...neural_networks/... is not human-readable and hand-editable as of this post. new_game/js/ai.json Description: This dictates AI personality modifier. The following is it's structure and how it works: 'Normal': { //*This is the difficulty. By default, it lists normal, then hard, then relentless, then absurd. percent_vehicle: 0.45, //*This is the percent of economy to be invested in vehicle percent_bot: 0.25, //*same for bots percent_air: 0.2, //*and air percent_naval: 0.05, //*and naval, as of vanilla now percent_orbital: 0.05, //*and orbital, although you find in other AI files that they also build this based on priority need metal_drain_check: 1.12, //*UNSURE*this is how much metal the AI spends. energy_drain_check: 1.25, //*UNSURE*this is how much energy the AI spends metal_demand_check: 1.32, //*UNSURE*this is how much metal the AI will allow demand energy_demand_check: 1.40, //*UNSURE*this is how much energy the AI will allow demand micro_type: 0, //*MOSTLY SURE*this is the AI directly controlling units in combat, 0 means none, 1 means platoon, 2 means squad, the higher the number the more micro done on a more intimate level go_for_the_kill: false, //*This is if the enemy will attack a commander directly with a ball of units deemed sufficient for a kill. When false, they attack commanders like a normal unit. priority_scout_metal_spots: false, //*This makes AI smart enough to scout metal spots instead of empty space neural_data_mod: 1.3, //*This is some ratio the AI uses to adhere to neural network usage in unit command adv_eco_mod: 1.0, //*UNSURE*this may control how an AI uses eco-multiplyer if given one. adv_eco_mod_alone: 1.0 //*UNSURE*this may conrol how an AI uses eco-multiplyer if given one ---------------------------COMPARED TO-------------------------------------------------- 'Absurd': { percent_vehicle: 0.45, //*same as normal percent_bot: 0.25, //*same as normal percent_air: 0.2, //*same as normal percent_naval: 0.05, //*same as normal percent_orbital: 0.05, //*same as normal metal_drain_check: 0.52, //*this is lower than normal, possibly meaning less is "kept" and more is "spent" energy_drain_check: 0.65, //*same as metal drain check metal_demand_check: 0.72, //*same as drain checks energy_demand_check: 0.8, //*same as drain checks micro_type: 2, //*This is 2 meaning micro on a squad level, it will micro units down to the very small groups making a platoon more dangerous as they will be controlled on a intimate small-group level to spread out and swarm on multiple sides when engaging a target. go_for_the_kill: true, //*set to true, the enemy will rally all their units if an enemy commander is approached, swarming it with a killing force and ignoring other targets. priority_scout_metal_spots: true, //*set to true, air scouts and land scouts will scout metal cluster to metal cluster instead of randomly across empty space neural_data_mod: 1.0, //*when set lower, the neural data is used more agressively and less lightly, making decisions more pure and less half *** and watered down adv_eco_mod: 1.3, //*despite what it may or may not do, higher appears to be "better" adv_eco_mod_alone: 0.85 //*despite what it may or may not do, lower appears to be "better" ...ai_unit_map.json Description: This lists the name of a unit and where it's data is located at. Can be a specific unit or a category covering all of a unit type. Example entries follow: "unit_map":{ "Commander":{"unit_types":"Commander"}, //*any unit type of "commander" is controlled by AI in same way when referenced by this name "AnyBasicFactory":{"unit_types":"Factory & Basic"}, //*any unit type that is factory & basic, like air, land, naval, ect, is used or checked when this is referenced "BasicBotFabber":{"spec_id":"/pa/units/land/fabrication_bot/fabrication_bot.json"}, //*this one is referencing a specific unit, specifically the fabrication_bot.json, and most names reference specific units by spec_id this way "BasicArtilleryBot":{"spec_id":"/pa/units/land/bot_grenadier/bot_grenadier.json"}, //*like this, the grenadier is specifically mentioned by spec_id. To add new units to this, by spec_id, and then naming them, lets you use them by the name you gave them, when mentioning them anywhere you specify how they are built, used, grouped, ect. ...ai_config.json Description: These are basic ratios of how many fabbers per factory the AI uses and how many factories and fabbers per planet the AI uses. "fabber_to_factory_ratio_basic": 1, "fabber_to_factory_ratio_advanced": 1, "fabber_alone_on_planet_mod": 2, "basic_to_advanced_factory_ratio": 0, "factory_alone_on_planet_mod": 0.5, "min_basic_fabbers": 1, "max_basic_fabbers": 4, "min_advanced_fabbers": 3, "max_advanced_fabbers": 20 ...fabber_builds/[*].json Description: These are the things the fabrication units can build, and the circumstances they build them. I will try to run down all the possible entries in these files... ALL POSSIBLE PARAMETERS "name": //* Simply the name of the "task", examples such as "Basic Metal Extractor - Area" and "Basic Metal Extractor - Desire" and "Laser Defense - Extractor Perimeter" "to_build": //* The name of the unit via "ai_unit_map.json". Examples such as "BasicMetalExtractor" and "BasicLandDefenseSingle" and "NukeSilo". Note, not all tasks are to build something, some are simply a task type like "assist" or "giveup". "instance_count": //*UNSURE* How many of this task can be ongoing at the same time. "shared_instance_count": //*UNSURE* Other tasks that are considered "the same task" as this task, and as such share the same "instance_count" limit. "priority": //*I believe, if for any reason the AI considers 2 tasks possible at same time, it chooses by priority, highest priority wins. Often in the files, Eco tasks prioritize 250+ while factory prioritizes in 100's. "base_sort": //*UNSURE* It appears to categorize what sort of task is being done or what does it, not sure. "builders": //*the fabrication units caoable of building the unit. Examples are "BasicAirFabber" and "AnyBasicFabber" and "Commander" and "AdvancedBotFabber". "task_type": //*What type of task done. Default (when task type isn't mentioned at all and is absent from text file) appears to be regular single place "Build" but other choices are "AreaBuild" or even something other than builds like "GiveUp" or "TransportToPlanet" or "TeleportFabberToPlanet" or "BuilderAssist". "placement_rules": //* How the AI decides where to place the structure or not place it. "build_conditions": //* This is a list of often complex conditions that an AI checks for to build something. "placement_rules" Possible Parameters: "placement_type": //* what conditions deciding where the building is placed, examples include "FromMainBaseCenter" which appears to put it in closest empty space to base center and possibly also to fabber location. "threat": //* ensuring placement is not within range of a threat. "threat":{"influence_type": //* what layer the structure is in, what layer attacks it. A factory is on land, so it's influence type is "AntiSurface". "threat":{"compare_type": //* greater than or less than, "<" or ">", which means which the AI looks for in a threat, minimum range or maximum range of space away "threat":{"radius": //* How big a space around, that is "compared" against a "influence_type", to determine proximity to a threat "threat":{"value": //*UNSURE* the value of the threat, in damage or in cost (?)
Ah. It will basically be the same thing, except just listing all I can at first, and then making assumptions on actions after. That link does what I just did myself, but nothing more afaik. For instance, I don't see parameters on what the AI uses to decide to build. No unit ratios, enemy on planet, none of that stuff yet. At this point, he can add mine to his, and he can know I am not really looking at his at this point. I will go back and look at his after so far, and I will try to supplement and request permission from him and credit him and such.
I don't think it has what I am using atm. I am at this point advancing upon everything I was able to find at that wiki link. Afterwards, I may make wiki pages for what I enter or someone else can, but right now it is 1 wiki page with directory no?
I didn't see a list of "enemyonplanet" "unitratio" "unitcount" and all possible of those or how they work for instance. Also, it completely didn't mention what Wondible showed me about the main/game/newgame/js/ai.json
I see. I would like to help with documenting modding in general. Although I really don't know what's going on so I can to help their. I just haven't found the time to learn js and everything else that comes with modding PA. Now for the issue of not having Wondible show you. That is the problem of having everything in it's own thread or a post in a larger thread. I don't believe that this will scale in the long run. If everybody worked on a central repository of mod knowledge that could work. And we wouldn't have too deal with the abandonment of threads when there OP leaves for ever.
True. So this SHOULD be ported to the wiki that Quitch made pages on, as people contribute to answering what they know what means what. This thread is literally a short term project to answer everything, and then the answers go to the wiki. Speaking of which, I have my first questions. @wondible @stuart98 @squishypon3 @sorian @raevn @cola_colin , does anyone know in my OP what the metal_demand_check or adv_eco_modifier does for instance? I would assume, except metal demand check isn't a metal income number but a percent
As I move on, I find out from that Wiki, that I missed a chapter and didn't actually contribute anything new so far It does mention js/ai.json However, all the links to what I am currently doing, the /fabber_builds/... are all red links. So, not very much done yet. I am working on that now. I will try to find every used parameter and list them. Hopefully that will give myself a resource on what I can use to dictate how the AI chooses to build something or how to choose to not build something else. Because my current problem, is in my mod, the AI will build 4 factories, and no units, when it has the storage to build 1 factory and 50-100 units, and should wait for more metal to build another factory. So I need it to know to either build a factory if no combat units exist, or to build at least 100 combat units before building another factory. It will take a tricky amount of parameters for it to check for how many factories and if a factory exist to check for 100 combat units.