How the AoE2 AI Thinks (ft. Promi)
Вставка
- Опубліковано 13 лип 2024
- How do you make a computer so that it competes with an experienced human player? Let's look at the AI script and ask the person who programmed the AI to begin with.
AI script: gist.github.com/Andygmb/1e3a6...
Patreon: / spiritofthelaw
Full intro song: • Spirit of the Law Chan...
Background music from Epidemic Sound: www.epidemicsound.com
Game: Age of Empires 2 HD with Forgotten Empires, African Kingdoms, and Rise the Rajas expansions - Ігри
A video I didn't know I wanted until now
How I feel about every SotL video that's not a Civ Overview
I agree Samuel quite interesting...
As someone who knows code this is both fun and cool. I could have watched a 40 minute video.
Truer words have never been said
Seconded. A good idea.
Six minutes in:
"My sheep perished when my folk sought to use it as food. No wonder thou wert victorious. I shalt abdicate"
This gave me an laughattack, thanks for that friend! :D :D
😂😂😂
"My peasants used pig's bladders to catch their seed! No wonder thou wert victorious. I shalt abdicate."
I couldst not replace the berries.
"Thou art human, with soul and wit. I am naught but clockwork!"
*resigns even before my first barracks*
_Enemy scout passes by AI's base_
Help! The enemy is in my town!
At once, sire.
Send me your spare ressources
Wood please
@@VandalGaming-gw6bt it's not wise to attack while in the dark age sire!!!
30 secs later
Attack an Enemy NOOOOW!!!
AI FOoOoDplzWwwooooooooodplzGoooooldddplzStoooooooneplzz
me you have 30000 food 30000 gold 30000 stone and 30000 wood
We need an updated version of this video for the definitive version. Please make it happen😃
*THEM DEVS CAN'T MAKE AN AI SMARTER THAN LA HIRE*
The blood on La Hire sword is almost dry!
😂 Haha
La Hire weeshes to keeel somesing
But they did make a "high definition" AI, lol.
You created that account just to say that
Fun fact about Promi: He may be the only human in existence ever to have read the rule book for the Age of Mythology board game. Unfortunately we got "board" and stopped playing by the time he finished understanding it...
When I was 8 I learned building a wall around my settlement (especially on forest maps) with an opening and towers behind the walls made the AI attack from that gap 100% of the time.
all i wanted to know is why the AI has an obsession with hoarding its army around a building and doing nothing the entire match XD
meme machine standard difficulty. The AI is hell aggressive on anything higher than standard.
I captured a screenshot once of an AI ally, whos army was surrounding its lumbercamp and the lumberjacks couldn't get to it so they just stood around doing nothing. Meanwhile I was being attacked, asking for help, and this guy was asking for resources with his army doing nothing but blocking his own resources.
@@Tariousgaming even on hardest keep doing that shit, you are getting destroyed by the enemy and your allie ai doesnt come to help you after 2 hrs of match
@@Tariousgaming it happens in Hard
@@Goabnb94 The king probably was watching for his X-mass tree and there was his bodyguards around to secure him while he found his tree. And villagers was not allowed to work, because they might chop and make tree usable (99/100 if you understand what I mean :D), yeah and while king on his duties and there is no income, that's why allies is needed for.
ps. damn that would be nice view.
@spirit of the law
This is by and far the most interesting video you have posted! And I’m not just throwing out that term lightly. I really mean that! I think it’s safe to say we ALL have played somewhere between 50 and 50,000 hours against the AI and ALL wonder how he thinks and works. This video had us go from a view through a keyhole to a view through a big window. Thanks a lot!
I like the AI but wish it didn't have bullshit archer/anti mangonel micro. No human can individually micro 40 archers and it causes players to shy away from mangonels or infantry.
I like the micro, but the single player campaigns can be really frustrating cause of this, especially Joan of Arc's against English Longbow spam. You have to micro each mangonel to attack ground in a matrix. It would be nice if there was target scatter or area bombard like Company of Heroes cause all projectiles landing in the same spot is usually pointless against a moving target.
I compensate it with the power of Pause and give several orders at the same time. It doesn't work when using infantry, but at least you can keep your economy going while your army is getting ravaged ;)
You obviously don't watch t90 streams of best players
That's probably my biggest complaint about AoE2, from release to this day. Even now I've got a stigma against mangonels and ESPECIALLY bombard cannons from my years of fighting the AI.
This is AOE2HD issue not an original AOE2 AI one, the original AI wad more broken and useless but at least didn't do god like micro
This exclusive footage will show you what the ai says to its villagers:
WOOD PLEASE FOOD PLEASE GOLD PLEASE WOLOLO WOLOLO
How you consistently produce this volume of great content limited to a single game never ceases to amaze me.
this is miles better quality content, you have improved a lot. i'd never guessed you would find the actual dev... this is pornography
10/10 better than PornHub
But pornography is bad for you and this video is educative
@joaquin Sotl interviewed him again for de check that out
I wish you had asked why the AI hates walls so much?
I don't think he meant that with the comment, but the fact that the AI deletes it's own walls usually at some point in imp.
Javier Mora the original AI is able to build walls
Yeah the original AI used to love walls
walls in general are only an early-warning thing because of mangonels, rams and petards. They dont protect you from shit. The AI sees everything at once, so it doesnt need a warning systems like that, as it knows when its being attacked.
I think they remove walls in HD AI, because they was unable to solve that bug with blocked troops when you can beat 1 vs 7 Hardest AI. (especially on closed maps).
What I hate about the AI is that they never be useful when they are the ally in the campaign. They cannot even protect themselves and ask you for resource
HD AI breaks the campaigns and was never designed for it, original AI makes campaigns better
Hey Spirit, about the AI theme, do you have any experience with the Barbarian AI? Is a well know new AI coded by The Max, a famous Finnish player, and in the hardest level is comparable to a 1700-1800 Voobly rated player. The Viper took 3 tries to win a 2v1 in that setting.
Absolutely Barbaric!
And 5 of this AI gave a nice battle to TheViper+Daut(Rip in KotD2)+Tatoh
i looked exactly for this? i mean how can you talk about aoe2 ai without even mentioning barbarian if u dont get your boars it will lame you^^
It's too bad it never got properly ported to HD or DE
Here's my question.
When the hell are they gonna make AIs build walls again.
The new DE ai builds walls out of monasteries in all my games lmao
@@danielrobertson2154 Just finished a game Aztects vs Inka and the AI build walls out of castles lmao
I play on Hard and they make walls of castles but only on the side facing you, so you can always just flank them and get into the heart of their base lol
Interesting episode. Can you do another one with TheMax? He is a top aoe player and created the barbarian AI the strongest AI available. It would be interesting to see how he made his AI so strong.
No Barbarian on Steam, so chances of doing that would be very slim.
Also, sotl has a weird habit of avoiding the pro scene wherever possible. The only reason he brought TaToH was because he was popular on HD.
Best video so far! Really insightful into the back-end process of the game, on an extremely important aspect no less!
Whenever I have an ally AI, it always works like that:
IF (No market is built)
THEN Build a market
IF (There's space around the market)
THEN Build anything around the market.
THEN Clutter armies around the market.
Yay for trading with the AI!.
Why does the AI build in such a messy way? It's always a clutter of buildings with small spaces between them like it wants to build a maze.
No, no, no. Its:
IF (human ally)
THEN (don't build a market for 30 minutes)
IF (don't have market)
THEN (pester human for resources)
IF (human ally being attacked)
THEN (don't help or send resources)
IF (human enemy)
THEN (rush market to begin trading)
@@Goabnb94 hahaha, Yeah, they also do that! :D
The video states that it the AI cannot choose where to build their buildings, to the tile, but can only give a set of rough instructions as it where it can't build.
Don't place mill within 8 tiles of another mill.
Place mining camp within 3 tile radius of gold.
Only build dock if water area is bigger than Y tiles.
I am no scripter but it doesn't sound too complicated to issue an instruction like:
Don't build any building within 6 tiles around your market.
Don't send units within 6 tiles around your market unless attacked.
It wouldn't solve cluttered trade routes between two AI's but it would definitely help a lot.
Btw, AI that is able to select individual units to attack individual targets would be STRONG. I would love to see that.
@@tomscorpion6288
Good thing you mentionned you are no scripter, because you input THAT code into your AI...
... And next thing you know, it tries to build dock 3 tiles from shores...
I have a question, whyy your alie IA is more stupid than your enemy IA?
That's a good one...
Can you repeat that in english?
can you hear me?
@@MultiTwentyseven ok, tell me how it will be.
IA? What? WTF?
One of your best videos in my opinion, Spirit. Informative, concise but not rushed, and the enthusiasm from both of you shines through. This is why I'm subscribed. Thank you.
The Hardest AI's monk rush with its micro haunts me to this day.
Each of them will target an individual unit thus not only ruining my raid but also making me retreat to my base with the haunted tension that I'll be seeing my Mangudais again soon...
Promi and SotL, such a good combo to explain stuff.
What I like about the Custom Campaigns is how neat and good ideas are people coming for their AIs.
Some are even specifically set to counter you and use counter attacks, which I am always intrigued to see.
Quality content as always! Thx so much Spirit ❤️! Much love from Chile
Great interview! Would love to see more!
It has quite amazing AI for its kind of game. RTS in general have dumb AI because its just complex... and AOE is even harder to make an AI for. By giving the AI some tricks like the good micro it already puts it above its competitors.
Speaking of unique AI's...
Company of Heroes 2 AI is also somewhat unique in its genre as it has full functionality that it actually takes humans as possible teammates and works around them. In most other RTS games the AI will simply ignore you when its teamed up with you as if you werent there. In COH 2 on other hand....
For those unfamiliar with Company of Heroes, its a RTS serie set in WW2, more tactical and about map control than something like a Command and Conquer.
- Relocates its troops when its needed, it wont try to go the same path as your troops unless its through a choke point. So you go to the left, AI to the right.
- Amasses troops when it detects that you are trying to make a breakthrough through defence. In maps where there are some choke points death traps. The AI will station its troops outside around your own troops and they are idle till you commence an attack. Then they will join in.
- It actively repairs your structures and tanks and it actually expects you to repair theirs too. If a tank is beated to shit it will start reversing towards your closest repair capable units and it will stop once you start repairing it. This thing is so human and so smart for a computer and i dont think such thing is present in any other RTS game. Unlike other games where AI will try to rush the tank to its death or across the whole map. If your tank is getting beaten to shit it will start repairing it even in middle of combat.
- On normal and easy, AI actually has map vision like the player, not like in other games where it sees everything. This means if your units spot enemy blobs it will start shelling them with its artillery. So if you would have an invisible spotter (lets say a sniper with restricted fire) and simply sneak in to the enemy fortress, watch how the howitzers will pummel the area till there is nothing left.
- AI builds chokepoints or reinforces yours with things like machinegun nests.
- AI utilizes what you make, if you make an reinforcement outpost, the AI will retreat their infantry to them to reinforce to full number (instead of like retreating to their base). If its a hospital, its the same. It will make a full use of it. If it has a halftrack it will move it to your wounded troops so YOU can reinforce and it will seek YOUR halftracks with its infantry so they can reinforce to full strength.
Too bad that although these behaviours are really amazing, the normal AI (the last AI that doesnt cheat) is weak against a human...
Damn, Spirit, you are the man! To find a dev and come up with so many right questions is quite a task and you performed beautifully!
Great video SotL. Very informative.
Such an interesting topic, love it! And a german developer, as I hear (greetings from Germany) :D
@GloriousTapeworm he has the typical german accent, nothing arabic here, i think i dont get your comment XD
@@mrwasgehtsiedasan3278 it's a meme with non Germans that German sounds similar to Arabic (Sharp consonants and such)
I love his hard german accent, so I know I'm not the only one who butchers the english language :D
@@ObviusRetard I thought it was a joke about how Germany is flooded with Muslims.
@@lizardemperorkorbac4281 In any case, most Muslims are not speakers of Arabic.
That interview is actually...
Cool. Just as always. Thanks to both!
Oh god the script for the IA is available online ? I didn't knew that ! Thanks you Spirit and Promi !!!!
IF
I am about to get wrek
THEN
Deploy the cars
I love your analysis and voice so much. You are great 😁
Easily one of the most interesting and also informative videos I've found the fact that you posted up pseudo code for me to look at rather than pointlessly talk about the theory like so many other videos was especially helpful, I had no idea for example the AOE2 AI actually compared distances when placing buildings. In hindsight it's obvious but it just shows you how many factors you need to take into account when developing AI generally to make it convincing.
pls make a video about barbarian AI
Not possible, don't think there has been a video with SotL playing AoE2 with UP :p
I have been watching you videos for a year and a half love your videos
For people who don't know, if you look at the code (click the git hub link in the description) it tells you all the hidden in game commands you can ask/tell the AI:
"100 - Forbids the AI to resign."
"231-238 - Chat 230+[enemy player number] to make the AI target this enemy for 10 minutes."
"250 - Chats information about the current strategy."
Great video by the way. I enjoy your clear explanations. When I play against the ResonanceBot AI, on slow mode, using the F3 'pause' button regularly (I am a new player who can't multitask very well), I find that the AI doesn't fight against my strategy -- which is what strategy is all about -- instead the AI is rules-focused with, as you point out, it's 'if-then' logic using conditions and such. So it is only a matter of time until a human player can learn how the AI 'thinks' and beat it. What would be REALLY COOL is if an AI can be developed which really 'thinks', that is, it learns from its mistakes, and it guesses about what will happen in the future (will my town center be attacked? will villagers be raided? with what? when? etc) and then actively take steps to guard against it. My sense is that, in time, this will happen, and yes, it will only be a matter of time until a thinking and advanced AI can beat any possible human or combination of humans.
Great idea thanks for making this SotL! More like this please!!!
Someone in the Total War franchise needs to hire this guy they've never had an AI that could think its way out of a paper bag
Please make more of these technical videos. They are awesome.
This was really interesting! Thank you. :)
This is a great video. So so interesting and questions I haven’t even considered
Very interesting video, so glad you made it!
Very insightful video thanks!
This is a fucking brilliant interview. Great work all around
it's a good ai. But it simply cannot deal with half of the maps in the mappool at all. especially water maps, Islands, TeamIslands, start on a small island, expand to the bigger one. It. Just. Dies.
That's running up against the limits of the AI engine itself. Even Barbarian struggles on Islands.
It's not gonna put Villagers in Transports. That's the only handicap. In fact,no AI can be scripted to do that. The game engine prohibits it.
And well Promi did acknowledge that it could have trouble with water maps in this very video
Its funny, because a water map, like Costal or Mediterranean, it doesn't need a navy but will invest heavily in it. But Islands, it rarely ventures from its island, other than with small, single transport ship pokes.
@@satyakisil4289 I always wondered why the AI never transported Villagers. I had no idea that it was a limitation of the engine.
You'd figure after 20 years they would have found a way to code it in 11
Really nice interview and video
This video has everything I like!! AI and AoE please do a follow up if there’s more info out there about this topic
Wonderful topic with great questions, it gets me interested in building my own ai one day.
i love your vids man keep it up !
So cool that you got in contact with one of the actual creators. I've come to believe that there are no AOE2 without a Spirit of the law
Thank you both so much!
Really interesting and next level to invite developer of the game
Excellent questions!
I'm amazed at how hard work went into a game this old, it seems like a true labor of love. My dad and his friends would probably be amazed that the game they used to play on LAN parties is still going!
This is really interesting. I've created a (very basic) Starcraft AI, and it's interesting seeing how the approach compares between different games.
A lot of if-then statements seems to be something in common.
best video you did so far
When will patch 5.9 released? Make the karambit great again.
#MAGA (make arambai great again)
Better fix match making, elo, desyncs, ...
Super Video! Thx
this is really fascinating!
2:46 the guitar intro automatically plays in my head
AI Tournaments are regularly hosted in forums.aiscripters.com ! Actually the DAVIS CUP season IV is running. You can follow the streams related to our tournament games here :
www.twitch.tv/aiscripters
And check the brackets there : docs.google.com/spreadsheets/d/1l5ZKiofQnaT3VClKCijyq5NbIcsDiVGnNR9WV2vYUjQ/edit#gid=0
Can you do a video about tree hp?
Actually yes please
It will be about 3 minutes long. 2:30 of which are spent on the intro and SotL talking about his social medias and to like, share and subscribe.
Thauã Aguirre how would it be 3 mins. He could test if lumbercamp upgrades effect how fast the tree is cut down. He could go into death about siege that cuts trees. He could talk about the expansions trees and there weird hp.
Don't forget Sappers tech that makes vills one-shot trees
@@HaBBiSiFy Wait, what? Is this really true??
Fantastic video. You should interview the creator of Barbarian AI next 😊
Cool video! Interesting to see how the AI is programmed.
I loved this always amazing to learn about AI.
Hi Spirit, I would love to see you do a video on monk conversion times. The pros use monks a lot to great effect in early castle age, so it would be great to see some numbers on them!
SO COOL!!! i've never seen a video with the one who developed the game. Awesome! btw it is true - the jump to moderate is huge! i can barely keep up with the AI. i am casual player and never engage in multiplayer fights. so, the AI games are my jam. i am deeply demoralized how they manage to destroy me with such ease :D
Awesome video
18:38 There already is an AI for DOTA 2 that consistenly beats any pro player 1v1 midlane and that players today use to train. It still needs improvement because DOTA is not played 1v1 and the AI only knows one or a few champions in a mirror matchup, but it's still impressive. If today there were as much interest in AoE2 as it is in DOTA 2 there would totally be an AI beating top human players consistenly in AOE2 at some point.
For that to happen, AI mechanics should be updated. It will never happen with "if then" statements. Deep learning should be applied here.
TheViper had problems with Barbarian AI but in 1v2 2v4 and 3v5
Also pretty sure it is vastly more complicated to make a RTS AI than an DOTA AI, there are so many more things to consider in an RTS
Champions instead of heroes triggers me. Agree with you though
That's fairly old news.
A few months ago the same AI easily won 5v5s against progamers.
Very interessting video!
Flipin' heck, this is phenomenal
I haven't played AoE in 9 years, but I love your videos!
I'm afraid it's been 9 Years
TRY NOT TO PANIC
Awesome video! Time for an update for the definitive edition AI. Where do you get your sound track? I love that funky thing!
I have a newfound respect for the original AOE2 team back then, and the Forgotten Team for the heavy scripting done with such simple conditions such as only using "ifs", and people like TheMax who is not only a top player but also has time to program such a competent AI like Barbarian by himself. Thanks SOTL!
What the AI still never does is:
-Transporting villagers by transport ships (which makes it impossible to play migration maps against AI).
-builds fish traps nor use existing ones like in scenario editor or campaign.
Builds palisade walls or palisade gates.
Builds outpost.
Playing tower rush.
Just what i remember atm.
Yeah, i would aoe devs make a special ai for migration maps
And outpost,but walls cant
Man can we get an updated video for DE this is so interesting. I love it
I actually had a go at making an ai (with prior no experience) over christmas
I'm both pleased and embarrassed that it plays better than I do. It was fun to do and didn't take all that long to get started so I'd recommend it!
@Kvothe Windrunner going through the game files is hardly a deal-breaker, most of the files are pretty helpfully named, and there are some good guides out there for beginners and most of the lines are just the same thing copy/pasted but with a unit id or a number changed.
I should say my ai only does 1v1 arabia (or similar land maps) as knight civs but for a first attempt I am happy with it.
Hopefully yt doesn't mind links; here it is if you want to see:
pastebin.com/qA0Z13aC
p.s. when I say it didn't take too long, it was a few nights of doing it but not as long as I expected it to be considering I've not coded anything for 4 years and am p bad at aoe
Now I want a video of spirit vrs the barbarian
great job well done
Good content!
plz do another live com they are my favorite from you
Clearly# the best quality video from u so for , man , congz , and also we want from u to analyse the BARBARİAN AI!!
very interesting video, especially since it highlights the changes in ai development. Though i get that AOE2 is your specialty i would have been interested in a little bit more of a zoomed out view as well, so if you could get promi to do a follow up that would be very interesting. I mention this specifically because he refers to the ai from shooter games, which have evolved from all matters of clunkiness, to smart, but non-existant. Plus after your question about developing ai that could beat any human player he mentions machine learning which is what google and Blizzard are using with their ai that is learning starcraft 2. Using the proper channels i don't see why the same could not be developed in any other RTS.
I would also really like to know if the standard AOE2 ai differs from the ai's of aoe1 and 3 in a fundamental way, or not.
This guy says that the AI doesn't one what units you produce, without scouting them... but I swear on DE it does know. It counters what I build without even knowing or seeing lol
Yah.. that's a big cheating. To know the composition & number of opponent's army or even entire population.
THANK YOU SO MUCH!!!
This really was a topic I'm very interested in.
I might end up buying the game again because of this video.
Is there a AI tournament held by anyone?
Perfect Video *-*
I thought you were going to talk about both AIs (old and new), still really liked the video.
I've started playing AoE:TC again and now that i can observe things more clearly than when i was younger it's impressive how cheaty the AI is in that game and the weird decisions that it makes:
-It will most of the times target the player with the highest score, so if you let your score be low enough you can basically just stall until they run out of resources while attacking eachother
-When it decides to attack you it targets your trebuchets or cannons as the highest priority, it knows where they are even if it has no line of sight, so you can lure the armies to a location you desire just by placing a trebuchet there
-It knows where every single resource is, no matter if it has never explored that area
-It knows where your villagers are, if you run out of resources in your base and have to send villagers far away to gather resources they will always get attacked at some point or another
-It is so reactive to damage that even has problems with things attacking it through walls, sometimes they don't register that they have to attack the wall blocking it from the enemy (and they never retreat, except with villagers). One time i walled a tower next to a relic i palisaded and all the melee military that it send that way just got stuck in the walls trying to attack the tower while the tower kept shooting them and it would always send monks to try to get the relic and wouldn't retreat when it couldn't reach it and the tower was attacking them.
-I know i should have said this sooner but yeah...it knows where everything is basically
-At one point of a game that has lasted too long almost all villagers stop working even if they have wood and food still available and do not continue attacking or they do it at way bigger intervals of time
-The build spacing is so badly made that they build all their buildings ,apart from houses and farms, in random places that are incredibly away from their base (this was noticeable even as a kid)
-No matter if the enemy that it intends to attack needs to be reached by going through enemy territory, it will do it and lose all army if necessary....or just have it stuck forever because it is being blocked from all sides by other enemy's walls
And the list goes on and on
Very interesting video and interview. Thanks. Got any content about why AI in recent games seems less sophisticated, as many years ago?
Would you do a video that digs deeper with the scripting?
Omg !!
I think other games need an analysis of the AI in a similar way
This seems to be an AoE channel, but I would really like to see a video like this dissecting the AI behaviors in Command and Conquer 3, I've noticed a few strange behaviors from the Brutal AI but I don't have the know-how to dig around in its brain myself.
Love this
This may be off topic but oh well. I started playing this game again after i discovered you on youtube and i couldnt believe what this game has become and how big of a fan base it has got over the years. People are playing this game nowadays in ways I could not imagine back when I played it as a kid. It's a timeless game, the graphics as well and I want to like it but for me the biggest killer of this game is that you're not really enjoying it or at least thats the way I see it. We're all rushing to do this do that sometimes feudal or castle flies right beside you and you haven't even engaged with your units. I would have loved this game if it was a bit slower, one of the things I would have loved is to play in one age only like a game option.
I think all this math and how to and why are nice and fun to know it's just, it's killing all the magic a game should have It's like missing the point.
> 150K Subs... 8-O
Congrats!
I find the AI of AoE2 HD the best I've ever seen in any Strategy games, even including 4x's and the like.
Anyone disagrees? (Genuinely curious)
Super interesting video btw, great interview!
I wish you made videos for Age of Empires III as well. I really could use some of your maths there.
That's why I often like to see an Ai only battle and to rewatch my own against AI as well. I really have learned to make more troops early in the game when you go against moderate or above. Or sometimes you go lucky to not get attacked 😅