I am looking to create a few really well made hero AI's for my project. I am a noob at galaxy scripting, so looking at the hots AI didn't get me very far. Having never made an AI, I am pretty lost on where to even start; so that is what I am looking for. How do I start making a basic hero AI? The game is multiplayer, so system resources are important. For abilities, should i trigger their execution, or use data? For their general behavior, do I use a periodic with a switch function, to sort through a list of possible actions?
I know that AI is very much map specific; I am just trying to plan out a starting point, before I dive into it and have to delete half of my work due to complications. Important things I should keep in mind.
The general concept of the game is, "2 teams of heroes, running around killing packs of monsters to get stronger; and occasionally killing each other." Stuff like knowing when to chase a player, and when you cant catch them. When to run and heal, how to cast an AoE so it will hit the most targets"
I'm in the triggers camp for the AI, as well. You'll probably end up making a lot of custom conditions and functions to get it all working. I don't think I have anything I can share right now though, sorry.
With the bosses in my map, I used all data. They are confined to smallish regions though, so they can't cause much trouble. Getting my heroes to fight other heroes in the arena stage doesn't seem difficult, but the general "roaming around, killing monster, not getting ganked, trying to gank" part is where I'm thrown a bit. I would assume something like ordering an attack move to a region based on whether an ally is already there, returning to base if HP is low, stuff like that. But there is a line between an ai that moves, and an ai that can beat a player.
With your triggered ai, do you have many a is running at once? Do you use a periodic trigger to check its actions and compare choices it should make? Any lag related problems I may encounter?
For both of you, was there any specific thing that was difficult to overcome while making your ai's?
Okay, so not many people use hero ai it would seem. Let me ask another question then. If I were to make a triggered ai system for anyone to use and modify, what should it include? I would want it to be able to handle survivals, defences, arenas, mobas, ect.
Would anyone be interested in using such a thing? I would put the extra effort into making it organized and stand alone if people would use it.
Sooo, I made a hero AI! It is pretty good. I used an extensive combination of validators for abilities, and had to trigger the rest. Almost everything in my game is trigger-driven, and dialog UI controls a lot of it. This allowed me to just run my action definitions for various dialog button clicks, for things like skill leveling, item purchasing, skill customizing, and stat allocation/buying. Then I used some general "run around here if this stuff is true" "head to base if this is true" with a list of various conditions for each.
I still need to get a bit more technical with it; telling it when it should go kill a boss, or follow a player into a boss area to assist/gank. Telling it when it should peruse an enemy player it thinks it can beat.
Overall, the AI is better than an average player, and makes a good sparring partner. I have a system set up for the whole thing, so I can add more heroes as I go. The first one was a melee tank with low energy requirements. I think it will get a lot trickier to get the conditions right when I move on to a ranged DPS or caster ><. We'll see!
i d very much "like" an ai for my map and i get how to do it sloppily (trigger and as much data as possible, which would be nonexistent for me right now) ..
.. so call me very interested :)
i think the periodic validation system bit (which i know of but have not put to use yet) is the worst part .. and the detection / analyzing enemy units is beyond (beyond me right now and beyond awesome) :D
i do think ai s are very much missing from the arcade
<3
ps: i'd very much like for my map to be able to be played out (as an option) via this reasoning
(you make your hero through data and triggers able to do the scenario of the map .. without even the necessity to make it a step by step and allow it to happen more "organically" (than a step by step of triggers would) .. so as to capture it on screen as an observer)
and i am (who's not?) working on making my heroes themselves be more interactive in standard ingame play
and/but i feel that is the same thing.. having an ai dictate how the unit responds "in all situations" is a grail in fact!
Once I get it all worked out, I will share with you how I accomplished various things. My only trigger is a periodic (1 second) with an average MS of .1 per run. If lag were to become an issue, I think I could lower it to 3 seconds per run, without sacrificing much. Ive had it run with 8 AI bots (my own character was controlled by AI as well, so I could watch all of the various interactions) without any lag caused at all.
For abilities, I use a lot of validator sets/combines (thanks to Eric/Arcane for teaching me). I typically use 1 set for killing ceeps, and another for bosses/heroes. Enumerate area is what is used as a "Search" for the validator. So I can search if 1 enemy hero is nearby, or if 3 creeps are nearby, or if an ally is nearby. Then I can check other things as well, such as life. If an ally is nearby and weak, cast a heal on them. In terms of team play, there is still a bit of an issue. Target sorts can cause a spell to target the weakest unit, but the first cast usually goes to the first enemy to enter the search area, for something like a non-target ability.
Give me another weekend or two to work on my other 2 AI heroes (I have the framework all set-up, so adding new AI will take a fraction of the time). The 1 hero I have is the more simple of the 3; though he also beats me 2 outta 3 games. In creating the other 2; I think I will make the AI itself more responsive to changes in gameplay; as they are softer, more aggressive builds; which would require more micro.
i use simple data autocast abilities sometimes with certain autocast validators.
you can check at least 2 of my data bosses in maps i posted on this site (Warhound and Alarak)
The reasons against triggers at least for me:
1) i used to data
2) my setup oriented on a single player, so i have less various conditions to check.
3) I HATE action/movement telegraphing which become a standard lately. I think it is dumb and basicaly implies player being idiot.
4) my bosses have 5 abils max (in my actual map terran bosses have 3 abils, zerg - 4 abils, protoss - 5 abils)
5) i dont have time to write scripts for complex behavior because most of my editing time i'm working with data. I prefer good visual look instead of over-complicated gameplay mechanics with ugly/boring visuals.
Alright, my triggered part of the system seems to be working quite well for all of the heroes (3 heroes now). Here is the general setup of the bots, in 3 stages:
Set a list of variables:
Stat point investments at lower levels
Which level to start investing into 2nd stat point list
2nd list of stat point investments
Skill leveling priorities at lower levels
Level to switch skill leveling priorities
2nd list of skill leveling priorities
skill "customizations" to unlock as skills are leveled for each skill
Items to buy at each item tier, for each item slot
Reasoning:
Early game often has a different focus in my map, with skills, the focus on on leveling fast, stat investments are more geared towards vitals early, and shift towards offense later. I wanted my bots to be as human and possible, and follow the same trends.
I am a little upset that I cannot cause my bots to pick skill perks depending on their situation. Perks are often used as minor tweaks to better suit your surroundings. Items are the same, static. I've had to gear all of them defensively, to make them stout. A good player would gear offensively when in the lead, to push the lead. Being static, players can learn to play to the AI's weakness.
Ability Validators: (For autocast)
Set a validator which combines all of my validaors into an "or"
Set a list of validators to use while fighting creeps, into an "and"
Set a list of validators to use while fighting heroes, into an "and"
Set a list of general validators for the ability
Set a list of "low life" or "low energy" validators, if the skill is applicable
Reasoning:
A real player can often make a smart choice to save an AoE cast to hit more creeps if possible. However, if the player is in pvp, you will still want to cast an AoE if you have only 1 enemy. If you are on low energy, you may not want to cast an ability, and save your energy for a better one. Far from perfect, but it allows the AI to be much smarter in its castings, to have so many validators.
Triggering:
Set a list of conditions to return to base and heal
- If very low life and enemy is near
- If low life
- If medium life and low energy
- If very close to base and low energy
- If reasonably close to base and medium life and energy
Order unit to attack-move to a creep spawn
- If there is no ally there
- If there is more than 1 creep currently there
- Else move to random creep spawn
Orders a unit to attack enemy heroes, and not attempt to heal during an arena competition
Order unit to purchase stuff,
- Items, if they have the gold for it
- Stats, if they have double the price of stats
- Stats right before an arena match, if no other spending conditions are met
Orders a unit to Level his skills and perks accordingly when skill points are obtained
Gives the AI bonus gold periodically, based on difficulty
Reasoning:
The biggest thing I feel obligated to explain is the gold; which is a pure hax. In my game, you often skip item slots and tiers, and invest far less into stat points as my AI will. Stats have an ever increasing price. Items sell at a reduced return. Rather than trying to compare and contrast item tiers and sell values, and making the AI super smart in its market research, I just made it dumb, and buy/sell everything, rather than pinch pennies. Compared to a normal player, the AI wastes a lot of gold to obtain the same outcome. The other "hack" is that I do not make the AI return to base to buy and sell items, which players must do. I may alter the AI to do this; as it often returns to base to heal. Another of those things that would hardly alter game-play for the bot, since the bot would be doing it instantly anyway.
Final Plans:
I want to set "behaviors" for the AI, to play aggressively or passively. Right now, they are always passive. That is, they dont leave their side of the map, and dont take good opportunities to kill an opposing player while out in the field. They will however kill any players that come to them.
I also plan to make them help allies being attacked, and allow players to issue commands to the AI. Not sure if I want a team captain with a UI, or simple text commands any player can use, (help me), ect.
Anyone who would like to try to game out, it is on the arcade in all regions. The map is Custom Hero Arena! AI is set once the game begins; a mode selection menu pops up, and there is a large button for adding AI. I enjoy playing 2v2 matches against the AI. I will say that so far, I have a 1-9 win/loss ratio against the AI. I am gonna have to dumb the AI down; because the AI is far better than a player, and players HATE to lose to AI. Mostly, it is because I created very strong, defensive builds for the AI; the weakest AI is a caster hero.
I am looking to create a few really well made hero AI's for my project. I am a noob at galaxy scripting, so looking at the hots AI didn't get me very far. Having never made an AI, I am pretty lost on where to even start; so that is what I am looking for. How do I start making a basic hero AI? The game is multiplayer, so system resources are important. For abilities, should i trigger their execution, or use data? For their general behavior, do I use a periodic with a switch function, to sort through a list of possible actions?
I know that AI is very much map specific; I am just trying to plan out a starting point, before I dive into it and have to delete half of my work due to complications. Important things I should keep in mind.
The general concept of the game is, "2 teams of heroes, running around killing packs of monsters to get stronger; and occasionally killing each other." Stuff like knowing when to chase a player, and when you cant catch them. When to run and heal, how to cast an AoE so it will hit the most targets"
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
@GlornII: Go
I create all of my enemy boss AI using triggers that fire at random intervals. Data works for some people but I find triggers faster and more visual.
<Click Here> To See My Epic Single Player Campaign (LifeForceCampaign.com)
I'm in the triggers camp for the AI, as well. You'll probably end up making a lot of custom conditions and functions to get it all working. I don't think I have anything I can share right now though, sorry.
With the bosses in my map, I used all data. They are confined to smallish regions though, so they can't cause much trouble. Getting my heroes to fight other heroes in the arena stage doesn't seem difficult, but the general "roaming around, killing monster, not getting ganked, trying to gank" part is where I'm thrown a bit. I would assume something like ordering an attack move to a region based on whether an ally is already there, returning to base if HP is low, stuff like that. But there is a line between an ai that moves, and an ai that can beat a player.
With your triggered ai, do you have many a is running at once? Do you use a periodic trigger to check its actions and compare choices it should make? Any lag related problems I may encounter?
For both of you, was there any specific thing that was difficult to overcome while making your ai's?
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
Okay, so not many people use hero ai it would seem. Let me ask another question then. If I were to make a triggered ai system for anyone to use and modify, what should it include? I would want it to be able to handle survivals, defences, arenas, mobas, ect.
Would anyone be interested in using such a thing? I would put the extra effort into making it organized and stand alone if people would use it.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
Sooo, I made a hero AI! It is pretty good. I used an extensive combination of validators for abilities, and had to trigger the rest. Almost everything in my game is trigger-driven, and dialog UI controls a lot of it. This allowed me to just run my action definitions for various dialog button clicks, for things like skill leveling, item purchasing, skill customizing, and stat allocation/buying. Then I used some general "run around here if this stuff is true" "head to base if this is true" with a list of various conditions for each.
I still need to get a bit more technical with it; telling it when it should go kill a boss, or follow a player into a boss area to assist/gank. Telling it when it should peruse an enemy player it thinks it can beat.
Overall, the AI is better than an average player, and makes a good sparring partner. I have a system set up for the whole thing, so I can add more heroes as I go. The first one was a melee tank with low energy requirements. I think it will get a lot trickier to get the conditions right when I move on to a ranged DPS or caster ><. We'll see!
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
i d very much "like" an ai for my map and i get how to do it sloppily (trigger and as much data as possible, which would be nonexistent for me right now) ..
.. so call me very interested :)
i think the periodic validation system bit (which i know of but have not put to use yet) is the worst part .. and the detection / analyzing enemy units is beyond (beyond me right now and beyond awesome) :D
i do think ai s are very much missing from the arcade
<3
ps: i'd very much like for my map to be able to be played out (as an option) via this reasoning
(you make your hero through data and triggers able to do the scenario of the map .. without even the necessity to make it a step by step and allow it to happen more "organically" (than a step by step of triggers would) .. so as to capture it on screen as an observer)
and i am (who's not?) working on making my heroes themselves be more interactive in standard ingame play and/but i feel that is the same thing.. having an ai dictate how the unit responds "in all situations" is a grail in fact!
again, color me fiddy shades of very interested!
Once I get it all worked out, I will share with you how I accomplished various things. My only trigger is a periodic (1 second) with an average MS of .1 per run. If lag were to become an issue, I think I could lower it to 3 seconds per run, without sacrificing much. Ive had it run with 8 AI bots (my own character was controlled by AI as well, so I could watch all of the various interactions) without any lag caused at all.
For abilities, I use a lot of validator sets/combines (thanks to Eric/Arcane for teaching me). I typically use 1 set for killing ceeps, and another for bosses/heroes. Enumerate area is what is used as a "Search" for the validator. So I can search if 1 enemy hero is nearby, or if 3 creeps are nearby, or if an ally is nearby. Then I can check other things as well, such as life. If an ally is nearby and weak, cast a heal on them. In terms of team play, there is still a bit of an issue. Target sorts can cause a spell to target the weakest unit, but the first cast usually goes to the first enemy to enter the search area, for something like a non-target ability.
Give me another weekend or two to work on my other 2 AI heroes (I have the framework all set-up, so adding new AI will take a fraction of the time). The 1 hero I have is the more simple of the 3; though he also beats me 2 outta 3 games. In creating the other 2; I think I will make the AI itself more responsive to changes in gameplay; as they are softer, more aggressive builds; which would require more micro.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
i use simple data autocast abilities sometimes with certain autocast validators.
you can check at least 2 of my data bosses in maps i posted on this site (Warhound and Alarak)
The reasons against triggers at least for me:
1) i used to data
2) my setup oriented on a single player, so i have less various conditions to check.
3) I HATE action/movement telegraphing which become a standard lately. I think it is dumb and basicaly implies player being idiot.
4) my bosses have 5 abils max (in my actual map terran bosses have 3 abils, zerg - 4 abils, protoss - 5 abils)
5) i dont have time to write scripts for complex behavior because most of my editing time i'm working with data. I prefer good visual look instead of over-complicated gameplay mechanics with ugly/boring visuals.
Alright, my triggered part of the system seems to be working quite well for all of the heroes (3 heroes now). Here is the general setup of the bots, in 3 stages:
Set a list of variables:
Stat point investments at lower levels
Which level to start investing into 2nd stat point list
2nd list of stat point investments
Skill leveling priorities at lower levels
Level to switch skill leveling priorities
2nd list of skill leveling priorities
skill "customizations" to unlock as skills are leveled for each skill
Items to buy at each item tier, for each item slot
Reasoning:
Early game often has a different focus in my map, with skills, the focus on on leveling fast, stat investments are more geared towards vitals early, and shift towards offense later. I wanted my bots to be as human and possible, and follow the same trends.
I am a little upset that I cannot cause my bots to pick skill perks depending on their situation. Perks are often used as minor tweaks to better suit your surroundings. Items are the same, static. I've had to gear all of them defensively, to make them stout. A good player would gear offensively when in the lead, to push the lead. Being static, players can learn to play to the AI's weakness.
Ability Validators: (For autocast)
Set a validator which combines all of my validaors into an "or"
Set a list of validators to use while fighting creeps, into an "and"
Set a list of validators to use while fighting heroes, into an "and"
Set a list of general validators for the ability
Set a list of "low life" or "low energy" validators, if the skill is applicable
Reasoning:
A real player can often make a smart choice to save an AoE cast to hit more creeps if possible. However, if the player is in pvp, you will still want to cast an AoE if you have only 1 enemy. If you are on low energy, you may not want to cast an ability, and save your energy for a better one. Far from perfect, but it allows the AI to be much smarter in its castings, to have so many validators.
Triggering:
Set a list of conditions to return to base and heal
- If very low life and enemy is near
- If low life
- If medium life and low energy
- If very close to base and low energy
- If reasonably close to base and medium life and energy
Order unit to attack-move to a creep spawn
- If there is no ally there
- If there is more than 1 creep currently there
- Else move to random creep spawn
Orders a unit to attack enemy heroes, and not attempt to heal during an arena competition
Order unit to purchase stuff,
- Items, if they have the gold for it
- Stats, if they have double the price of stats
- Stats right before an arena match, if no other spending conditions are met
Orders a unit to Level his skills and perks accordingly when skill points are obtained
Gives the AI bonus gold periodically, based on difficulty
Reasoning:
The biggest thing I feel obligated to explain is the gold; which is a pure hax. In my game, you often skip item slots and tiers, and invest far less into stat points as my AI will. Stats have an ever increasing price. Items sell at a reduced return. Rather than trying to compare and contrast item tiers and sell values, and making the AI super smart in its market research, I just made it dumb, and buy/sell everything, rather than pinch pennies. Compared to a normal player, the AI wastes a lot of gold to obtain the same outcome. The other "hack" is that I do not make the AI return to base to buy and sell items, which players must do. I may alter the AI to do this; as it often returns to base to heal. Another of those things that would hardly alter game-play for the bot, since the bot would be doing it instantly anyway.
Final Plans:
I want to set "behaviors" for the AI, to play aggressively or passively. Right now, they are always passive. That is, they dont leave their side of the map, and dont take good opportunities to kill an opposing player while out in the field. They will however kill any players that come to them.
I also plan to make them help allies being attacked, and allow players to issue commands to the AI. Not sure if I want a team captain with a UI, or simple text commands any player can use, (help me), ect.
After-Thoughts
http://peeeq.de/gui.php?id=3909
Not sure how long that will stay active for; it is a copy of the trigger.
Anyone who would like to try to game out, it is on the arcade in all regions. The map is Custom Hero Arena! AI is set once the game begins; a mode selection menu pops up, and there is a large button for adding AI. I enjoy playing 2v2 matches against the AI. I will say that so far, I have a 1-9 win/loss ratio against the AI. I am gonna have to dumb the AI down; because the AI is far better than a player, and players HATE to lose to AI. Mostly, it is because I created very strong, defensive builds for the AI; the weakest AI is a caster hero.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418