Well im looking closely at the function CpuManager:LoadStrategyInfo() and i think i see a way of doing it.
That function calls the difficulty level files which is great because you might now want a smart AI on easy difficulty. You may want it to get smart at hard or over only.
So lets take a look some files now.
Advanced AIstrategyinfo file.
This can be used to tweak an AIs willingness to fight to the last man. Extra entries in the CPU manage function would be all thats needed for all of the following ideas.
--ADVANCED
AttackStrategyInfo =
{
eldar_race =
{
 --my prorate against yours before I stop attacking you and retreat
 stop_attack_rating = -200,
 min_units = 2,
},
chaos_marine_race =
{
 --my prorate against yours before I stop attacking you and retreat
 stop_attack_rating = -200,
 min_units = 2,
},
ork_race =
{
 --my prorate against yours before I stop attacking you and retreat
 stop_attack_rating = -200,
 min_units = 2,
},
space_marine_race =
{
 --my prorate against yours before I stop attacking you and retreat
 stop_attack_rating = -200,
 min_units = 2,
},
}
Advanced BuildBaseStrategyInfo
I wont quote the entire file, just a few areas of interest here. Again we could add an extra entry to the CPU manager and since this file controls the army list and research list its probably one of the most important files to edit.
Aside from all the stuff at the top that has a big effect on how the AI behaves generally which i wont go into because you know it from our previous chats, theres these sections.
ResearchOrder =
 {
 "eldar_research_infantryhealth_1",
 "eldar_research_infantryaccuracy_1",
 "eldar_farseer_ability_research_3",
 "eldar_plasma_grenade_research",
 "eldar_requisition_research_1",
 "eldar_power_research_1",
 "eldar_research_infantryhealth_2",
 "eldar_research_infantryaccuracy_2",
 "eldar_haywire_bomb_research",
 "eldar_requisition_research_2",
 "eldar_power_research_2",
 "eldar_research_farseerhealth_1",
 "eldar_research_farseerhealth_2",
 },
Tweaking the research queue will definately have an effect on the AIs game and will do so right away. It is perhaps the one area suitable for normal difficulty tweating too. You can enable or limit an AI from here very easily and this will have an effect on tactics.
Then we have the army lists.
 SquadLimits =
 {
 fire_vypers =
 {
  eldar_squad_farseer =1,
  eldar_squad_bonesinger = 0,
  eldar_guardian_squad = 3,
  eldar_squad_banshees = 2,
  eldar_squad_dark_reapers = 4,
  eldar_squad_falcon_grav_tank = 2,
  eldar_squad_fire_prism = 4,
  eldar_squad_grav_platform = 3,
  eldar_squad_grav_platform_brightlance = 3,
  eldar_squad_rangers = 2,
  eldar_squad_seer_council = 1,
  eldar_squad_vypers = 3,
  eldar_squad_warp_spider = 3,
  eldar_squad_wraithlord = 0,
 },
Â
 fire_wraith =
 {
  eldar_squad_farseer =1,
  eldar_squad_bonesinger = 0,
  eldar_guardian_squad = 3,
  eldar_squad_banshees = 2,
  eldar_squad_dark_reapers = 4,
  eldar_squad_falcon_grav_tank = 2,
  eldar_squad_fire_prism = 4,
  eldar_squad_grav_platform = 3,
  eldar_squad_grav_platform_brightlance = 3,
  eldar_squad_rangers = 2,
  eldar_squad_seer_council = 1,
  eldar_squad_vypers = 0,
  eldar_squad_warp_spider = 3,
  eldar_squad_wraithlord = 2,
 },
Â
 fire_wraith_no_banshees =
 {
  eldar_squad_farseer =1,
  eldar_squad_bonesinger = 0,
  eldar_guardian_squad = 3,
  eldar_squad_banshees = 0,
  eldar_squad_dark_reapers = 4,
  eldar_squad_falcon_grav_tank = 2,
  eldar_squad_fire_prism = 4,
  eldar_squad_grav_platform = 3,
  eldar_squad_grav_platform_brightlance = 3,
  eldar_squad_rangers = 2,
  eldar_squad_seer_council = 1,
  eldar_squad_vypers = 0,
  eldar_squad_warp_spider = 3,
  eldar_squad_wraithlord = 2,
 },
Â
 wraith_vypers =
 {
  eldar_squad_farseer =1,
  eldar_squad_bonesinger = 0,
  eldar_guardian_squad = 3,
  eldar_squad_banshees = 2,
  eldar_squad_dark_reapers = 4,
  eldar_squad_falcon_grav_tank = 2,
  eldar_squad_fire_prism = 1,
  eldar_squad_grav_platform = 3,
  eldar_squad_grav_platform_brightlance = 3,
  eldar_squad_rangers = 2,
  eldar_squad_seer_council = 1,
  eldar_squad_vypers = 3,
  eldar_squad_warp_spider = 3,
  eldar_squad_wraithlord = 4,
 }
 },
},
Instead of having all possible army lists in one file, if our AI was a tank freak we may have several Army lists that are biased towards vehicles in this one and cut back on the infantry a bit. On the other hand, we may want fewer vehicles and more troops. Its an easy thing to do here.
It should be noted that the AI usually builds more than the figures listed here, i think its a ratio rather than an actual limit.
Next we have buildorderstrategyinfo.
This file controls what the AI builds initially and thus whats available at the start of the game.
BuildOrderStrategyInfo =
{
space_marine_race =
{
 { "flag_capture" }, { "post_builder" },
 { "flag_capture" }, { "post_builder" },
 { "squad", "space_marine_squad_scout" },
 { "squad", "space_marine_squad_scout" },
 { "squad", "space_marine_squad_servitor" },
 { "building", "space_marine_barracks", true },
 { "squad", "space_marine_squad_force_commander", true },
 { "squad", "space_marine_squad_tactical" },
 { "squad", "space_marine_squad_tactical", true },
},
ork_race =
{
 { "building", "ork_waagh_banner" },
 { "squad", "ork_squad_grot" },
 { "flag_capture" }, { "post_builder" },
 { "flag_capture" }, { "post_builder" },
 { "squad", "ork_squad_slugga" },
 { "building", "ork_boy_hut", true },
 { "building", "ork_waagh_banner" },
 { "squad", "ork_squad_mek_boy", true },
 { "building", "ork_mek_shop" },
},
chaos_marine_race =
{
 { "flag_capture" }, { "post_builder" },
 { "flag_capture" }, { "post_builder" },
 { "squad", "chaos_squad_cultist" },
 { "squad", "chaos_squad_cultist" },
 { "squad", "chaos_squad_slave" },
 { "building", "chaos_temple", true },
 { "squad", "chaos_squad_lord", true },
 { "squad", "chaos_marine_squad" },
 { "squad", "chaos_marine_squad", true },
},
eldar_race =
{
 { "flag_capture" }, { "post_builder" },
 { "flag_capture" }, { "post_builder" },
 { "squad", "eldar_guardian_squad" },
 { "squad", "eldar_guardian_squad" },
 { "squad", "eldar_squad_bonesinger" },
 { "building", "eldar_aspect_portal", true },
 { "squad", "eldar_squad_farseer", true },
}
}
Adding an extra post builder could make our AI a resource freak early on, perhaps a good plan for a rusher AI or even a serious base builder AI. We may not want a farseer right away so we remove it and add howlinbanshees. This makes the AI's starting forces a lot tougher than the basic troop types we see for the first few minutes of the game. Adding a turret in here forces it to build 1 turret in its base right away, which is good for a base builder type of AI or a defensive AI.
From here we need to link the initial script choices with the update section of the strategies buildbasestrategy.ai so the choices made above are reflected in the updates it can do.
This may be as simple as adding a var to each of the difficulty level files setting the tactic and then doing an if tactic = in the update section of the cpu manager file mentioned above and listing what updates its allowed to make with that armylist and initial build queue.
The updates are configured in each races own build files, so you just copy and paste an entry a few times, change it to suit the tactic being used and then add a function in the cpu manager to call it and add that to the update section.
Assuming the global var idea works this should also work.
Giskard
Edited by giskard, 18 February 2005 - 07:40 PM.