Hi,
I've gone back to an old map I made years ago and am attempting to improve the AI system
It is a game a little like castle fight where you build structures, then each round units are created based on the structures you have.
I'm not intending for the AI to absolutely incredible just smart enough to be fun to play against/with
I've generalised all the unit types into their armor types, and what their damage types are strong against. So a Rifleman counts as Medium armor but shows as strong versus Air, Light, and Unarmored (with different values for each)
It all works OK at the moment but I wanted to add another level to their decision making. At the moment the below variable AI_PriorityVS decides what the strongest armor type the enemy has, then I have a seperate buying trigger that uses this to build the relevant structure/unit.
One of the issues is that a Human AI will counter Heavy armor with a Footman, this is because I don't want them saving up gold for ages to build a flying unit or magic unit etc. However this means that they just mass Footman against eachother until they happen to have enough gold to buy something different (such as a Priest or Mortar Team)
What I want to do is have the AI also look at what the enemy DOESN'T have. So if they have lots of verus Heavy they might buy a Light armor unit instead. That's what the 2nd part of the trigger is trying to do. However I'm just getting very confused with myself and can't work out the right formulas!
So to clarify the premise I'm after - rather than the AI mass what they need to counter the enemy, also build units that the enemy can't counter very well. (For example build an Air unit if the enemy has less Air attacking units)
I'm not sure if I have the complete wrong approach for this but I'm playing around with it to see if I can make it a bit more intuative!
I've gone back to an old map I made years ago and am attempting to improve the AI system
It is a game a little like castle fight where you build structures, then each round units are created based on the structures you have.
I'm not intending for the AI to absolutely incredible just smart enough to be fun to play against/with
I've generalised all the unit types into their armor types, and what their damage types are strong against. So a Rifleman counts as Medium armor but shows as strong versus Air, Light, and Unarmored (with different values for each)
It all works OK at the moment but I wanted to add another level to their decision making. At the moment the below variable AI_PriorityVS decides what the strongest armor type the enemy has, then I have a seperate buying trigger that uses this to build the relevant structure/unit.
One of the issues is that a Human AI will counter Heavy armor with a Footman, this is because I don't want them saving up gold for ages to build a flying unit or magic unit etc. However this means that they just mass Footman against eachother until they happen to have enough gold to buy something different (such as a Priest or Mortar Team)
What I want to do is have the AI also look at what the enemy DOESN'T have. So if they have lots of verus Heavy they might buy a Light armor unit instead. That's what the 2nd part of the trigger is trying to do. However I'm just getting very confused with myself and can't work out the right formulas!
So to clarify the premise I'm after - rather than the AI mass what they need to counter the enemy, also build units that the enemy can't counter very well. (For example build an Air unit if the enemy has less Air attacking units)
I'm not sure if I have the complete wrong approach for this but I'm playing around with it to see if I can make it a bit more intuative!
-
Team 1 Priority
- Events
- Conditions
-
Actions
- -------- Enemy has lots of this armor type --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Team1VsAir - Team2ArmorAir) Less than or equal to (Team1VsHeavy - Team2ArmorHeavy)
- (Team1VsAir - Team2ArmorAir) Less than or equal to (Team1VsLight - Team2ArmorLight)
- (Team1VsAir - Team2ArmorAir) Less than or equal to (Team1VsMedium - Team2ArmorMedium)
- (Team1VsAir - Team2ArmorAir) Less than or equal to (Team1VsUnarmored - Team2ArmorUnarmored)
-
Then - Actions
- Set VariableSet AI_PriorityVS = Air
- Set VariableSet AI_PriorityVS_Real = (Team1VsAir - Team2ArmorAir)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Team1VsHeavy - Team2ArmorHeavy) Less than or equal to (Team1VsAir - Team2ArmorAir)
- (Team1VsHeavy - Team2ArmorHeavy) Less than or equal to (Team1VsLight - Team2ArmorLight)
- (Team1VsHeavy - Team2ArmorHeavy) Less than or equal to (Team1VsMedium - Team2ArmorMedium)
- (Team1VsHeavy - Team2ArmorHeavy) Less than or equal to (Team1VsUnarmored - Team2ArmorUnarmored)
-
Then - Actions
- Set VariableSet AI_PriorityVS = Heavy
- Set VariableSet AI_PriorityVS_Real = (Team1VsHeavy - Team2ArmorHeavy)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Team1VsLight - Team2ArmorLight) Less than or equal to (Team1VsAir - Team2ArmorAir)
- (Team1VsLight - Team2ArmorLight) Less than or equal to (Team1VsHeavy - Team2ArmorHeavy)
- (Team1VsLight - Team2ArmorLight) Less than or equal to (Team1VsMedium - Team2ArmorMedium)
- (Team1VsLight - Team2ArmorLight) Less than or equal to (Team1VsUnarmored - Team2ArmorUnarmored)
-
Then - Actions
- Set VariableSet AI_PriorityVS = Light
- Set VariableSet AI_PriorityVS_Real = (Team1VsLight - Team2ArmorLight)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Team1VsMedium - Team2ArmorMedium) Less than or equal to (Team1VsAir - Team2ArmorAir)
- (Team1VsMedium - Team2ArmorMedium) Less than or equal to (Team1VsHeavy - Team2ArmorHeavy)
- (Team1VsMedium - Team2ArmorMedium) Less than or equal to (Team1VsLight - Team2ArmorLight)
- (Team1VsMedium - Team2ArmorMedium) Less than or equal to (Team1VsUnarmored - Team2ArmorUnarmored)
-
Then - Actions
- Set VariableSet AI_PriorityVS = Medium
- Set VariableSet AI_PriorityVS_Real = (Team1VsMedium - Team2ArmorMedium)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Team1VsUnarmored - Team2ArmorUnarmored) Less than or equal to (Team1VsAir - Team2ArmorAir)
- (Team1VsUnarmored - Team2ArmorUnarmored) Less than or equal to (Team1VsHeavy - Team2ArmorHeavy)
- (Team1VsUnarmored - Team2ArmorUnarmored) Less than or equal to (Team1VsLight - Team2ArmorLight)
- (Team1VsUnarmored - Team2ArmorUnarmored) Less than or equal to (Team1VsMedium - Team2ArmorMedium)
-
Then - Actions
- Set VariableSet AI_PriorityVS = Unarmored
- Set VariableSet AI_PriorityVS_Real = (Team1VsUnarmored - Team2ArmorUnarmored)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- -------- Enemy does not have much versus this armor type --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Team2VsAir - Team1ArmorAir) Less than or equal to (Team2VsHeavy - Team1ArmorHeavy)
- (Team2VsAir - Team1ArmorAir) Less than or equal to (Team2VsLight - Team1ArmorLight)
- (Team2VsAir - Team1ArmorAir) Less than or equal to (Team2VsMedium - Team1ArmorMedium)
- (Team2VsAir - Team1ArmorAir) Less than or equal to (Team2VsUnarmored - Team1ArmorUnarmored)
-
Then - Actions
- Set VariableSet AI_PriorityDef = Air
- Set VariableSet AI_PriorityDef_Real = (Team2VsAir - Team1ArmorAir)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Team2VsHeavy - Team1ArmorHeavy) Less than or equal to (Team2VsAir - Team1ArmorAir)
- (Team2VsHeavy - Team1ArmorHeavy) Less than or equal to (Team2VsLight - Team1ArmorLight)
- (Team2VsHeavy - Team1ArmorHeavy) Less than or equal to (Team2VsMedium - Team1ArmorMedium)
- (Team2VsHeavy - Team1ArmorHeavy) Less than or equal to (Team2VsUnarmored - Team1ArmorUnarmored)
-
Then - Actions
- Set VariableSet AI_PriorityDef = Heavy
- Set VariableSet AI_PriorityDef_Real = (Team2VsHeavy - Team1ArmorHeavy)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Team2VsLight - Team1ArmorLight) Less than or equal to (Team2VsAir - Team1ArmorAir)
- (Team2VsLight - Team1ArmorLight) Less than or equal to (Team2VsHeavy - Team1ArmorHeavy)
- (Team2VsLight - Team1ArmorLight) Less than or equal to (Team2VsMedium - Team1ArmorMedium)
- (Team2VsLight - Team1ArmorLight) Less than or equal to (Team2VsUnarmored - Team1ArmorUnarmored)
-
Then - Actions
- Set VariableSet AI_PriorityDef = Light
- Set VariableSet AI_PriorityDef_Real = (Team2VsLight - Team1ArmorLight)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Team2VsMedium - Team1ArmorMedium) Less than or equal to (Team2VsAir - Team1ArmorAir)
- (Team2VsMedium - Team1ArmorMedium) Less than or equal to (Team2VsHeavy - Team1ArmorHeavy)
- (Team2VsMedium - Team1ArmorMedium) Less than or equal to (Team2VsLight - Team1ArmorLight)
- (Team2VsMedium - Team1ArmorMedium) Less than or equal to (Team2VsUnarmored - Team1ArmorUnarmored)
-
Then - Actions
- Set VariableSet AI_PriorityDef = Medium
- Set VariableSet AI_PriorityDef_Real = (Team2VsMedium - Team1ArmorMedium)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Team2VsUnarmored - Team1ArmorUnarmored) Less than or equal to (Team2VsAir - Team1ArmorAir)
- (Team2VsUnarmored - Team1ArmorUnarmored) Less than or equal to (Team2VsHeavy - Team1ArmorHeavy)
- (Team2VsUnarmored - Team1ArmorUnarmored) Less than or equal to (Team2VsLight - Team1ArmorLight)
- (Team2VsUnarmored - Team1ArmorUnarmored) Less than or equal to (Team2VsMedium - Team1ArmorMedium)
-
Then - Actions
- Set VariableSet AI_PriorityDef = Unarmored
- Set VariableSet AI_PriorityDef_Real = (Team2VsUnarmored - Team1ArmorUnarmored)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Game - Display to (All players) the text: ((Name of (Player((Integer A)))) + ( vs priority : + AI_PriorityVS))
- Game - Display to (All players) the text: (String(AI_PriorityVS_Real))
- Game - Display to (All players) the text: ((Name of (Player((Integer A)))) + ( def priority : + AI_PriorityDef))
- Game - Display to (All players) the text: (String(AI_PriorityDef_Real))