A.I. Modding Problem -1 reply

  • 1
  • 2

Please wait...

dEjavU'

____________________

50 XP

7th June 2008

0 Uploads

662 Posts

0 Threads

#1 10 years ago

Hello Everyone, Theres this mod I'm workin' on for future release in A2 files and I just can't seem to get the A2 stock A.I.(for all races) to get their ships to roam around the map in a more fleet-like manner, the ships are all spread out all over the map.Can anyone help me out here?




Freyr VIP Member

A2Files Staff

46,875 XP

6th February 2005

11 Uploads

4,275 Posts

0 Threads

#2 10 years ago

Yeah. If you include this line in your AIP:-

int min_attack_force = 8;

Then the AI will use fleets of at least 8 ships to attack with.




dEjavU'

____________________

50 XP

7th June 2008

0 Uploads

662 Posts

0 Threads

#3 10 years ago

Hello Freyr,did you mean to literally add this line to all the five files in question for each race(..endgame,..build list,..defensive list,..ofensive list,..instant_action_build_list)? or just to the "new default" file & "example" file? This is how I have my AI(new deault) set up right now,'preciate any help you or any one else out there can give me to get this mod up and running: // Load up the basic structures... #include "aipdef.h" // RELAXATION OF THREATS // Number of threat relax cycles. This becomes how far away a threat is // felt. int relaxation_cycles = 10; // Relaxation bleedover double relaxation_coefficient = 0.5; // This priority is multiplied by each enemy craft in a grid cell for // ATTACK and DEFEND goals this number is multiplied by -1 * the number of // enemy craft. // Increase positive values to make the AI more likely to attack and defend // places with many enemy ships. // Decrease negative values to make the AI less likely to attack and defend // places with many enemy ships. // For ATTACK_BASE goals this number is multiplied by -1 * the number of // enemy craft. // Increase positive values to make the AI more likely to attack undefended // bases. // Decrease negative values to make the AI more likely to attack defended // bases int attack_troops_priority = 9000; // Added for each friendly base in a grid cell for DEFEND goals. // Increase this value to make the AI more likely to defend bases. // Decrease to make the AI less likely to defend bases. // (valid values: -99999 to 99999) int defend_priority = 9000; // Added for each enemy base in a grid cell for ATTACK_BASE goals. // Increase this value to make the AI more likely to attack enemy bases, // or decrease to make the AI less likely to attack enemy bases. // (valid values: -99999 to 99999) int attack_enemy_base_priority = 500; // Added for each unit of intrinsic value in a grid cell for ATTACK // and ATTACK_BASE goals. // Increase this value to make the AI more likely to attack // valuable targets, or decrease to make the AI less likely to attack // valuable targets. (valid values: 0 to 99999) int intrinsic_value_bonus = 200; // Added to unexplored grid cell for EXPLORE goals. // Increase this value to make the AI more likely to explore unexplored // grid cells, or decrease to make the AI less likely to explore unexplored // grid cells. (valid values: -99999 to 99999) int exploration_priority = 500; // Added for each escorted ship in a grid cell for ESCORT goals. // Increase this value to make the AI more likely to escort escortable // ships, or decrease to make the AI less likely to escort escortable ships. // (valid values: -99999 to 99999) int escort_priority = 200; // Added for each moon in a grid cell for RESOURCE goals. // Increase this value to make the AI more likely to defend moons, or // decrease to make the AI less likely to defend moons. // (valid values: -99999 to 99999) int resource_priority = 2000; // The distance from the craft to the goal is multiplied by this term // for every legal goal and craft match. // The more negative the term, the more likely craft will be assigned to // nearby goals before goals that are far away. double distance_from_goal_match_modifier = -80; // A goal will only be executed if ships with enough force were committed to // the goal. The amount of force committed to a goal is the total shield // strength of each craft multipled by the attack_power of the craft. This // force amount must exceed the same computation of enemy ships in the cell // multiplied by the max_matching_force_ratio. // For example, if the ratio is set to 0.8, then only goals in which the // AI can match 80% of the enemy threat will be executed. // The min_matching_force_ratio is used similarly. double max_matching_force_ratio = 1.40; double min_matching_force_ratio = 0.95; // Minimum number of craft to use for each goal type. If this value is // set to 'n', then a minimum of 'n' ships will be used to escort // escortable craft even when they are unthreatened by nearby enemy craft. int min_escort_force = 1; // Maximum number of craft to use for each goal type. If this value is // set to 'n', then a maximum of 'n' ships will be used to escort // escortable craft even when they are unthreatened by nearby enemy craft. int max_escort_force = 5; // If this value is set to 'n', then a minimum of 'n' ships will be used // to defend bases even when they are unthreatened by nearby enemy craft. int min_defense_force = 20; // If this value is set to 'n', then a maximum of 'n' ships will be used // to defend bases even when they are unthreatened by nearby enemy craft. int max_defense_force = 30; // If this value is set to 'n', then a minimum of 'n' ships will be used // to explore an unexplored grid cell. int min_exploration_force = 15; // If this value is set to 'n', then a maximum of 'n' ships will be used // to explore an unexplored grid cell. int max_exploration_force = 48; // If this value is set to 'n', then a minimum of 'n' ships will be used to // attack bases and enemy ships regardless of the strength of enemy craft // defending it. int min_attack_force = 24; // If this value is set to 'n', then a maximum of 'n' ships will be used to // attack bases and enemy ships regardless of the strength of enemy craft // defending it. int max_attack_force = 58; // If this value is set to 'n', then a minimum of 'n' ships will be used to // defend grid cells with moons even when they are not threatened by // nearby enemy craft. int min_resource_force = 3; // If this value is set to 'n', then a maximum of 'n' ships will be used to // defend grid cells with moons even when they are not threatened by // nearby enemy craft. int max_resource_force = 10; // Minimum number of craft to use for each goal type. If this value is // set to 'n', then a minimum of 'n' ships will be used to patrol the perimeter // even when it is unthreatened by nearby enemy craft. int min_perimeter_force = 15; // Maximum number of craft to use for each goal type. If this value is // set to 'n', then a maximum of 'n' ships will be used to patrol the perimeter // even when it is unthreatened by nearby enemy craft. int max_perimeter_force = 30; // Parameters used to control how often strategic goals are // recomputed. // How long to wait before recomputing the strategy int recompute_strategy_period = 200; /////////////////////////////////////////////////////// // EVALUATED/EXECUTE GOAL COUNTS // Used to specify how many of each goal type to evaluate and how // many to execute. Small counts increase performance, but decrease // intelligence. // The MAX_EXEC numbers have positive values that should not exceed 1000; // You can 'turn off' goals by specifying a MAX_EXEC count of 0 // or limit the goals executed by specifying a smaller number. // ATTACK BASE goals // If this value is set to 1, only the highest priority enemy base will be // attacked at a given time. // If this value is set to 'n', at most the 'n' highest priority enemy bases // will be attacked at a given time. // If this value is set to 0, no enemy bases will be attacked. // If the maxes have positive values, they are multiplied by // number of bases owned by the team; negative numbers are absolute. // If both are positive, make sure the execute isnt bigger than the // evaluate. int MAX_EVAL_ATTACK_BASE = 100; int MAX_EXEC_ATTACK_BASE = 2; // ATTACK goals // If this value is set to 1, only the one highest priority grid // with enemy in it will be attacked at a time // If this value is set to 'n', at most the 'n' highest priority grids // with enemy will be attacked at a given time. // If this value is set to 0, no grids with enemy units will be attacked. int MAX_EVAL_ATTACK = 100; int MAX_EXEC_ATTACK = 5; // DEFEND goals // If this value is set to 1, only the highest priority base will be // defended at a time. // If this value is set to 'n', only the 'n' highest priority bases will be // defended at a given time. // NOTE: If this value is set to 0, none of your bases will be defended. int MAX_EVAL_DEFEND = 100; int MAX_EXEC_DEFEND = 5; // ESCORT goals // If this value is set to 1, only the one highest priority escortable ship // will be escorted at a time. // If this value is set to 'n', at most the 'n' highest priority escortable // ships will be defended at a given time. // If this value is set to 0, none of your ships will be escorted. int MAX_EVAL_ESCORT = 100; int MAX_EXEC_ESCORT = 10; // EXPLORE goals // If this value is set to 1, only the one highest priority unexplored grid // square will be explored at a time. // If this value is set to 'n', at most the 'n' highest priority unexplored // grid cells will be explored at a given time. // If this value is set to 0, no grid cells will be explored. int MAX_EVAL_EXPLORE = 1000; int MAX_EXEC_EXPLORE = 1000; // RESOURCE goals // If this value is set to 1, only the one highest priority grid cell with // moons will be defended at a time. // If this value is set to 'n', at most the 'n' highest priority grid cells // with mooons will be defended at a given time. // If this value is set to 0, none of your grid cells with moons will be // defended. int MAX_EVAL_RESOURCE = 100; int MAX_EXEC_RESOURCE = 10; //////////////////////////////////////////////////// // Positive for emphasis away from home, negative for emphasis near home int distance_from_home_priority_modifier = -1; // Positive for emphasis away from enemy, negative for emphasis near enemy int distance_from_enemy_priority_modifier = 1; // Positive for emphasis in region between home and enemy. int perimeter_priority = 10; // Positive to avoid places where we have lost more units than we have // killed... int avoid_danger_priority_modifier = 30000; // How much emphasis to pay to high threat regions int attack_region_priority = 5000; // Global value for scripted players. int scripted_priority = 1; //////////////////////////////////////////////////////// // RAW BID MODIFIERS (just a number that gets added to the others) int max_danger_raw_bonus = 10; int max_threat_raw_bonus = 10; int human_target_raw_bonus = 200; int max_misc_bid_bonus = 600; int persistence_modifier = 100; int threat_proximity_modifier = 10; // PATROL CONTROL int patrol_one_in_n = 10; // How much to reduce danger recorded in grid cell each cycle. double danger_diminishment = 1




Guest

I didn't make it!

0 XP

 
#4 10 years ago

Let's see if I can help out here.

The biggest problem with this AIP I see is you are trying to make it do everything all at once and as strongly as possible all at the same time. When all the goals and evaluations have exactly the same level of evaluation priority, the AIP will choose to do the simplest thing first and check back on how close it is to achieving the others. So it chooses to do nothing at all but build ships which wander aimlessly about the map. As singles. As to getting the AI ships to group in fleets and move in formations, the only current way is to decompile the EXE and change the scripts which are hardcoded, I believe. Such a mod would violate the A2 EULA and in doing so, would disqualify itself for hosting on A2Files.

It is possible to get the AI to sort of move ships about in fleets by changing up the order the ships are built in in the buildlist.

Simply put, you changed too many variables. Putting in a bigger value is not always the correct answer. The game algorithms sometimes use bigger numbers to represent negative values rather than positive ones. In any AIP file there is a place to set minimum and maximum fleet strengths for all aspects of what the AI units will do. The fleet minimum and maximum numbers work best when the values are multiples of 4 or 8. The MAX_EVAL values should not be changed at all unless you are redesigning the entire AIP from scratch. Even then, there is probably one already in the game which will do what you want.

The easier way to make an AIP do what you want is to make the changes one at time. It makes the changes you want to make easier to track and makes it easier to remove the changes you don't want. I've taken the liberty of copying below and readjusting the AIP you posted. The changes I made are highlighted in red. I hope this helps.

//Load up the basic structures... #include "aipdef.h" // RELAXATION OF THREATS // Number of threat relax cycles. This becomes how far away a threat is // felt. int relaxation_cycles = 10; // Relaxation bleedover double relaxation_coefficient = 0.5; // This priority is multiplied by each enemy craft in a grid cell for // ATTACK and DEFEND goals this number is multiplied by -1 * the number of // enemy craft. // Increase positive values to make the AI more likely to attack and defend // places with many enemy ships. // Decrease negative values to make the AI less likely to attack and defend // places with many enemy ships. // For ATTACK_BASE goals this number is multiplied by -1 * the number of // enemy craft. // Increase positive values to make the AI more likely to attack undefended // bases. // Decrease negative values to make the AI more likely to attack defended // bases int attack_troops_priority = 9000; // Added for each friendly base in a grid cell for DEFEND goals. // Increase this value to make the AI more likely to defend bases. // Decrease to make the AI less likely to defend bases. // (valid values: -99999 to 99999) int defend_priority = 9000; // Added for each enemy base in a grid cell for ATTACK_BASE goals. // Increase this value to make the AI more likely to attack enemy bases, // or decrease to make the AI less likely to attack enemy bases. // (valid values: -99999 to 99999) int attack_enemy_base_priority = 500; // Added for each unit of intrinsic value in a grid cell for ATTACK // and ATTACK_BASE goals. // Increase this value to make the AI more likely to attack // valuable targets, or decrease to make the AI less likely to attack // valuable targets. (valid values: 0 to 99999) int intrinsic_value_bonus = 200; // Added to unexplored grid cell for EXPLORE goals. // Increase this value to make the AI more likely to explore unexplored // grid cells, or decrease to make the AI less likely to explore unexplored // grid cells. (valid values: -99999 to 99999) int exploration_priority = 500; // Added for each escorted ship in a grid cell for ESCORT goals. // Increase this value to make the AI more likely to escort escortable // ships, or decrease to make the AI less likely to escort escortable ships. // (valid values: -99999 to 99999) int escort_priority = 200; // Added for each moon in a grid cell for RESOURCE goals. // Increase this value to make the AI more likely to defend moons, or // decrease to make the AI less likely to defend moons. // (valid values: -99999 to 99999) int resource_priority = 2000; // The distance from the craft to the goal is multiplied by this term // for every legal goal and craft match. // The more negative the term, the more likely craft will be assigned to // nearby goals before goals that are far away. double distance_from_goal_match_modifier = -80; // A goal will only be executed if ships with enough force were committed to // the goal. The amount of force committed to a goal is the total shield // strength of each craft multipled by the attack_power of the craft. This // force amount must exceed the same computation of enemy ships in the cell // multiplied by the max_matching_force_ratio. // For example, if the ratio is set to 0.8, then only goals in which the // AI can match 80% of the enemy threat will be executed. // The min_matching_force_ratio is used similarly. double max_matching_force_ratio = 1.40; double min_matching_force_ratio = 0.95; // Minimum number of craft to use for each goal type. If this value is // set to 'n', then a minimum of 'n' ships will be used to escort // escortable craft even when they are unthreatened by nearby enemy craft. int min_escort_force = 1; // Maximum number of craft to use for each goal type. If this value is // set to 'n', then a maximum of 'n' ships will be used to escort // escortable craft even when they are unthreatened by nearby enemy craft. [COLOR=Red] int max_escort_force = 2;[/COLOR] // If this value is set to 'n', then a minimum of 'n' ships will be used // to defend bases even when they are unthreatened by nearby enemy craft. [COLOR=Red] int min_defense_force = 12;[/COLOR] // If this value is set to 'n', then a maximum of 'n' ships will be used // to defend bases even when they are unthreatened by nearby enemy craft. [COLOR=Red] int max_defense_force = 24;[/COLOR] // If this value is set to 'n', then a minimum of 'n' ships will be used // to explore an unexplored grid cell. [COLOR=Red] int min_exploration_force = 8;[/COLOR] // If this value is set to 'n', then a maximum of 'n' ships will be used // to explore an unexplored grid cell. [COLOR=Red] int max_exploration_force = 24;[/COLOR] // If this value is set to 'n', then a minimum of 'n' ships will be used to // attack bases and enemy ships regardless of the strength of enemy craft // defending it. [COLOR=Red] int min_attack_force = 12;[/COLOR] // If this value is set to 'n', then a maximum of 'n' ships will be used to // attack bases and enemy ships regardless of the strength of enemy craft // defending it. [COLOR=Red] int max_attack_force = 48;[/COLOR] // If this value is set to 'n', then a minimum of 'n' ships will be used to // defend grid cells with moons even when they are not threatened by // nearby enemy craft. [COLOR=Red] int min_resource_force = 4;[/COLOR] // If this value is set to 'n', then a maximum of 'n' ships will be used to // defend grid cells with moons even when they are not threatened by // nearby enemy craft. [COLOR=Red] int max_resource_force = 12;[/COLOR] // Minimum number of craft to use for each goal type. If this value is // set to 'n', then a minimum of 'n' ships will be used to patrol the perimeter // even when it is unthreatened by nearby enemy craft. [COLOR=Red] int min_perimeter_force = 16;[/COLOR] // Maximum number of craft to use for each goal type. If this value is // set to 'n', then a maximum of 'n' ships will be used to patrol the perimeter // even when it is unthreatened by nearby enemy craft. [COLOR=Red] int max_perimeter_force = 32;[/COLOR] // Parameters used to control how often strategic goals are // recomputed. // How long to wait before recomputing the strategy [COLOR=Red] int recompute_strategy_period = 400;[/COLOR] /////////////////////////////////////////////////////// // EVALUATED/EXECUTE GOAL COUNTS // Used to specify how many of each goal type to evaluate and how // many to execute. Small counts increase performance, but decrease // intelligence. // The MAX_EXEC numbers have positive values that should not exceed 1000; // You can 'turn off' goals by specifying a MAX_EXEC count of 0 // or limit the goals executed by specifying a smaller number. // ATTACK BASE goals // If this value is set to 1, only the highest priority enemy base will be // attacked at a given time. // If this value is set to 'n', at most the 'n' highest priority enemy bases // will be attacked at a given time. // If this value is set to 0, no enemy bases will be attacked. // If the maxes have positive values, they are multiplied by // number of bases owned by the team; negative numbers are absolute. // If both are positive, make sure the execute isnt bigger than the // evaluate. [COLOR=Red]int MAX_EVAL_ATTACK_BASE = 10;[/COLOR] [COLOR=Red] int MAX_EXEC_ATTACK_BASE = 3;[/COLOR] // ATTACK goals // If this value is set to 1, only the one highest priority grid // with enemy in it will be attacked at a time // If this value is set to 'n', at most the 'n' highest priority grids // with enemy will be attacked at a given time. // If this value is set to 0, no grids with enemy units will be attacked. [COLOR=Red] int MAX_EVAL_ATTACK = 100;[/COLOR] [COLOR=Red] int MAX_EXEC_ATTACK = 3;[/COLOR] // DEFEND goals // If this value is set to 1, only the highest priority base will be // defended at a time. // If this value is set to 'n', only the 'n' highest priority bases will be // defended at a given time. // NOTE: If this value is set to 0, none of your bases will be defended. [COLOR=Red]int MAX_EVAL_DEFEND = 0; int MAX_EXEC_DEFEND = 1;[/COLOR] // ESCORT goals // If this value is set to 1, only the one highest priority escortable ship // will be escorted at a time. // If this value is set to 'n', at most the 'n' highest priority escortable // ships will be defended at a given time. // If this value is set to 0, none of your ships will be escorted. [COLOR=Red]int MAX_EVAL_ESCORT = 0; int MAX_EXEC_ESCORT = 1;[/COLOR] // EXPLORE goals // If this value is set to 1, only the one highest priority unexplored grid // square will be explored at a time. // If this value is set to 'n', at most the 'n' highest priority unexplored // grid cells will be explored at a given time. // If this value is set to 0, no grid cells will be explored. [COLOR=Red]int MAX_EVAL_EXPLORE = 4; int MAX_EXEC_EXPLORE = 4;[/COLOR] // RESOURCE goals // If this value is set to 1, only the one highest priority grid cell with // moons will be defended at a time. // If this value is set to 'n', at most the 'n' highest priority grid cells // with mooons will be defended at a given time. // If this value is set to 0, none of your grid cells with moons will be // defended. [COLOR=Red]int MAX_EVAL_RESOURCE = 0; int MAX_EXEC_RESOURCE = 2;[/COLOR] //////////////////////////////////////////////////// // Positive for emphasis away from home, negative for emphasis near home int distance_from_home_priority_modifier = -1; // Positive for emphasis away from enemy, negative for emphasis near enemy int distance_from_enemy_priority_modifier = 1; // Positive for emphasis in region between home and enemy. int perimeter_priority = 10; // Positive to avoid places where we have lost more units than we have // killed... int avoid_danger_priority_modifier = 30000; // How much emphasis to pay to high threat regions int attack_region_priority = 5000; // Global value for scripted players. int scripted_priority = 1; //////////////////////////////////////////////////////// // RAW BID MODIFIERS (just a number that gets added to the others) int max_danger_raw_bonus = 10; int max_threat_raw_bonus = 10; int human_target_raw_bonus = 200; int max_misc_bid_bonus = 600; int persistence_modifier = 100; int threat_proximity_modifier = 10; // PATROL CONTROL int patrol_one_in_n = 10; // How much to reduce danger recorded in grid cell each cycle. double danger_diminishment = 1 Nothing at all wrong with trying to get the AIPs to react in a much more bold and forthright manner. It just takes a little patience and lots of play testing. We've been working on ImpSPCam for months now because we want to make sure the AIPs do what want them to. We've changed quite a few variables in the AIPs. But we did them one or two at a time and we made sure we knew what they did before we changed another.




dEjavU'

____________________

50 XP

7th June 2008

0 Uploads

662 Posts

0 Threads

#5 10 years ago

Thanks allot thunderfoot006, really really 'preciate you taking a bit of your time to help me out here.I'll implement these changes you've made right away....on a side note,just want to congratulate you and the starfleetkid on the success of you guy's physics mod.great job!!




Freyr VIP Member

A2Files Staff

46,875 XP

6th February 2005

11 Uploads

4,275 Posts

0 Threads

#6 10 years ago

Freyr;4377392Yeah. If you include this line in your AIP:-

Then the AI will use fleets of at least 8 ships to attack with.[/quote]

[quote=dEjavU001;4378283]Hello Freyr,did you mean to literally add this line to all the five files in question for each race(..endgame,..build list,..defensive list,..ofensive list,..instant_action_build_list)? or just to the "new default" file & "example" file? This is how I have my AI(new deault) set up right now,'preciate any help you or any one else out there can give me to get this mod up and running:

You already have it in there, however you do have the AI set to use a minimum of 8 and a maximum of 24 ships for scouting. I usually lock it down to having a maximum of 4 ships scouting which prevents it from wandering around aimlessly with its entire fleet, which means its more likely to use ships for other things. I usually decrease everything other than the attack force down to small figures, which means the only use the AI has for its ships is an attack force. After all, a good defence is a strong offence, if someone is getting hammered into a hole they probably aren't worrying to much about attacking.




dEjavU'

____________________

50 XP

7th June 2008

0 Uploads

662 Posts

0 Threads

#7 10 years ago

I understand,I'll try it out.Thanks Freyr.I got another question of a different matter if you don't mind me askin'.Seeing as how your a staff member and all,I was wondering how I might be able to add these screenshots I took of this map I put out for download roughly a week ago in A2 files? I could'nt include it along with the download becuase at the time I did'nt know how to take screenshots.How do I include it in the download page in A2?




dEjavU'

____________________

50 XP

7th June 2008

0 Uploads

662 Posts

0 Threads

#8 10 years ago

YYYEEEEEEAAAAHHHH!!!!That did it!! That definitely did it!!!I got the A.I. to not roam around filling up the map with single ships!!! I got fleets after fleets of enemy ships which just keeps on coming at me!!!! Beautiful!!!Freyr your the best!!you too thunderfoot006 for improving on the AI thinking efficiency!!thats brilliant man,but Freyr you solved my "ships wondering around the map" problem.Yeah!!Thanks You guys!!




Freyr VIP Member

A2Files Staff

46,875 XP

6th February 2005

11 Uploads

4,275 Posts

0 Threads

#9 10 years ago

dEjavU001;4378844I understand,I'll try it out.Thanks Freyr.I got another question of a different matter if you don't mind me askin'.Seeing as how your a staff member and all,I was wondering how I might be able to add these screenshots I took of this map I put out for download roughly a week ago in A2 files? I could'nt include it along with the download becuase at the time I did'nt know how to take screenshots.How do I include it in the download page in A2?[/quote]

You can't add the screenshots yourself, however if you email them in to us along with the URL of the page then we can get them up ASAP.

[quote=dEjavU001;4378952]YYYEEEEEEAAAAHHHH!!!!That did it!! That definitely did it!!!I got the A.I. to not roam around filling up the map with single ships!!! I got fleets after fleets of enemy ships which just keeps on coming at me!!!! Beautiful!!!Freyr your the best!!you too thunderfoot006 for improving on the AI thinking efficiency!!thats brilliant man,but Freyr you solved my "ships wondering around the map" problem.Yeah!!Thanks You guys!!

No problem.




Guest

I didn't make it!

0 XP

 
#10 10 years ago

Glad we could help. Now hurry up and finish this so the rest of us can play it. Go on, stop dawdling. You've officially run out of excuses for being more than five meters from your 'puter until it is done. I want an advance copy, with autograph, too. :p




  • 1
  • 2