• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Amightypie

Colonel
86 Badges
Mar 20, 2014
833
1.976
  • Hearts of Iron 4: Arms Against Tyranny
  • Hearts of Iron IV: No Step Back
  • Europa Universalis IV: Rights of Man
  • Island Bound
  • Stellaris: Nemesis
  • Hearts of Iron IV: By Blood Alone
  • Victoria 3 Sign Up
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Cities: Skylines - Snowfall
  • Surviving Mars
  • Age of Wonders III
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II
  • Stellaris: Humanoids Species Pack
  • Hearts of Iron IV: Expansion Pass
  • Cities: Skylines - Green Cities
  • Hearts of Iron IV: Death or Dishonor
  • Cities: Skylines - After Dark
  • Crusader Kings II: Jade Dragon
  • Steel Division: Normand 44 Sign-up
  • Stellaris: Apocalypse
  • Stellaris: Leviathans Story Pack
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Mass Transit
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Third Rome
  • Hearts of Iron IV: La Resistance
  • Cities: Skylines - Natural Disasters
  • Crusader Kings II: Holy Fury
  • Stellaris: Necroids
  • Battle for Bosporus
  • Stellaris: Distant Stars Pre-Order
  • Crusader Kings III
  • Stellaris: Federations
  • Prison Architect: Psych Ward
  • Stellaris: Lithoids
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Sons of Abraham
  • Imperator: Rome Sign Up
  • Surviving Mars: First Colony Edition
  • Prison Architect
  • Steel Division: Normandy 44
  • Surviving Mars: First Colony Edition
  • Europa Universalis IV: Dharma
  • Stellaris: Distant Stars
ok so im literally clueless into what im meant to doing and even trying to follow the wiki walkthrough has lost me slighty.

i have gone to the launch press create mod and named it 'SmartAi' with directory 'smartai' i have then found the mod folder and the smartai file but there was no subfolder and its at this point where im lost.

1 - can i please have the next 5 steps in simple man terms
2- the aim was to test an idea about changing the denfensive ai stance, i found the file in the game files but wanted to create a more permenant verson aka mod.
3 - the extension was then to see if i could try and change the way sector ai's work into doing something useful ( at this rate never gonna happen but gotta have goals)

so yea any help would be appreciated or you can tell me that im in over my head :p im just strating and am finding the whole process a little daunting.
 
Your mod folder is essentially the Stellaris folder for when the game is looking for files. When the game needs names from name lists it goes to Stellaris/common/name_lists if your mod is enabled it will also look through SmartAI/common/name_lists and take anything it finds there as well. The mods are loaded last so anything in a mod folder will overwrite anything in the game folder. Note that you do not need to name files the same. So, to change the defensive ai stance do the following:

1. Create the folder Common and in it the sub folder ship_behaviors
2. Create a txt file in ship_behaviors, name it whatever you want, but preferably something that will be unique, for example smartai_amightypie.txt
3. Open the standard_ship_behaviors.txt back in Stellaris/common/ship_behaviors and find the code you want to edit, in this case it should be:
Code:
ship_behavior = {
    name = "defensive"
    preferred_attack_range = max
    formation_distance = 2
    return_to_formation_distance = 3
    collision_awareness = 0.25
    attack_move_pattern = none
    passive_move_pattern = follow
   
    desc = "DEFENSIVE_BEHAVIOR_DESC"
   
    targeting = {
        keep_previous_target_bonus        = 100        #flat bonus for keeping previous target
        damage_value                    = 5            #score += estimated damage dealt ( including damage to shields ) * <damage_value>
        low_health_bonus                = 50        #flat bonus if estimated damage will kill the target in a few shots
        shield_focus_value                = 5            #score += estimated shield damage dealt * shield damage bonus * <shield_focus_value>
        armor_focus_value                = 5            #score += enemy armor * shield penetration value * <armor_focus_value>
        already_incoming_damage_penalty = 200        #score -= ( fleet total estimated damage to enemy / enemy max HP ) * <already_incoming_damage_penalty>.
        distance_to_fleet_penalty        = 20        #score -= distance between enemy and fleet * <distance_to_fleet_penalty>
        size_difference_penalty            = 1000        #score -= Abs( ship size - enemy ship size ) * <size_difference_penalty>. "Pick a fight with someone your own size!"
        civilian_target_penalty            = 100000    #if( target is civilian ) score -= <civilian_target_penalty>
    }
}
4. Open your smartai_amightypie.txt and paste the code into it.
5. Edit whatever parameters that you want.


Sector AI is a bit trickier, as a lot of it is hardcoded, but you can find various variables that the AI (including sector AI) use for its calculations in common/defines/defines.lua
 
Your mod folder is essentially the Stellaris folder for when the game is looking for files. When the game needs names from name lists it goes to Stellaris/common/name_lists if your mod is enabled it will also look through SmartAI/common/name_lists and take anything it finds there as well. The mods are loaded last so anything in a mod folder will overwrite anything in the game folder. Note that you do not need to name files the same. So, to change the defensive ai stance do the following:

1. Create the folder Common and in it the sub folder ship_behaviors
2. Create a txt file in ship_behaviors, name it whatever you want, but preferably something that will be unique, for example smartai_amightypie.txt
3. Open the standard_ship_behaviors.txt back in Stellaris/common/ship_behaviors and find the code you want to edit, in this case it should be:
Code:
ship_behavior = {
    name = "defensive"
    preferred_attack_range = max
    formation_distance = 2
    return_to_formation_distance = 3
    collision_awareness = 0.25
    attack_move_pattern = none
    passive_move_pattern = follow
 
    desc = "DEFENSIVE_BEHAVIOR_DESC"
 
    targeting = {
        keep_previous_target_bonus        = 100        #flat bonus for keeping previous target
        damage_value                    = 5            #score += estimated damage dealt ( including damage to shields ) * <damage_value>
        low_health_bonus                = 50        #flat bonus if estimated damage will kill the target in a few shots
        shield_focus_value                = 5            #score += estimated shield damage dealt * shield damage bonus * <shield_focus_value>
        armor_focus_value                = 5            #score += enemy armor * shield penetration value * <armor_focus_value>
        already_incoming_damage_penalty = 200        #score -= ( fleet total estimated damage to enemy / enemy max HP ) * <already_incoming_damage_penalty>.
        distance_to_fleet_penalty        = 20        #score -= distance between enemy and fleet * <distance_to_fleet_penalty>
        size_difference_penalty            = 1000        #score -= Abs( ship size - enemy ship size ) * <size_difference_penalty>. "Pick a fight with someone your own size!"
        civilian_target_penalty            = 100000    #if( target is civilian ) score -= <civilian_target_penalty>
    }
}
4. Open your smartai_amightypie.txt and paste the code into it.
5. Edit whatever parameters that you want.


Sector AI is a bit trickier, as a lot of it is hardcoded, but you can find various variables that the AI (including sector AI) use for its calculations in common/defines/defines.lua
ok so mod/smartai/common/ship_behaviors/*behaviorfile* and in that i change the values around. thanks for the help i was just a litle confused because it made the plain .mod file but not the folder i needed (i think)

Edit: alright it works! now i have to set them to engage and remain at just enough range for everything to fire
 
Last edited: