Sorian AI - isn't it supposed to be better ?
-
Sorian is most important historically for one simple reason - he demonstrated that much more was possible within the existing framework. This didn't happen overnight, and honestly, he moved on long before he achieved any kind of nirvana, but he raised the bar, and inspired others (myself included) to push on.
Having said that, the version of Sorian that is included with FAF has been edited six ways from tomorrow, not only to adapt to the gameplay changes introduced by FAF (like overcharge), but by well meaning types that, frankly, had little clue about what they were doing. It's only been over the last 3+ years that any serious attempt to move beyond Sorian, or fix some of the long standing issues with Sorian, has been addressed - and that's, at last, something to look forward to.
-
@goblinsly
I did the most updates for GPG and sorian AI the last 3 years;
These are my patch logs:
AI Patch V1:
https://github.com/FAForever/fa/pull/2468
AI Patch V2:
https://github.com/FAForever/fa/pull/2566
AI Patch V3:
https://github.com/FAForever/fa/pull/2660
AI Patch V4:
https://github.com/FAForever/fa/pull/2734
AI Patch V5:
https://github.com/FAForever/fa/pull/2802
AI Patch V6: (AI pathfinding "A*(Star) search algorithm".)
https://github.com/FAForever/fa/pull/2915
Fix for AI Base templates
https://github.com/FAForever/fa/pull/2918
AI Patch V8:
https://github.com/FAForever/fa/pull/3114 -
A* search algorithm ? I had that in college, artificial inteligence basics course. I loved it and other algorithms. I didn't know you can change pathfinding of AI here also, in AOE1 we were only able to change some basic things.
I am hooked. Sprouto, you said Sorian is important because he showed that much more is possible within the existing framework. Can you tell me what exactly you mean by that ? I played a 2v2v2 game with 4 AIs, me and my friend. 2 AIs were sorian, 2 AIs were vaniila AI. Now, the first thing i noticed was that Sorian was much more efficient at gathering resources and using them. For instance, vanilla AI got into electricity shortage all the time, losing mass from mass extractors and holding him back, while sorian always had enough power and using all the mass he had. But other than that, the attacks and everything else seemed quiete basic.
I will give you an example of things that boggle my mind. Ok, enemy keeps sending small amount of units to the same spot on map, which is in range of T2 PD. Units get obliterated without doing any damage. Yet the AI keeps doing it. There should be some kind of check, an "if" if u will: if .. the first 100.000 units sent to this location did 0 damage to enemy units .. go to plan B. And second ... i attack with T3 units, slaughtering the enenys base. What does he do ? He bring the unupgraded commander and attacks units, not using overcharge or anything, i mean, surely an if is to be had .. if enemy units in visible range will slaughter me .. run in the opposite direction. It might not change the final outcome but at least it will give you an idea that AI wants to live. Like, have him try to run to the water, have him try to transport himself away with transporter ..
Ofcourse, its easy for me to say, without actualy seeing the manner in which AI is being programmed. Could i see some small snippets of code to get an idea ? Also, what are some of the more interesting things being worked on regarding this Uveso AI. Can i expect moments in game when i will say, woow, wth is that ? I didnt see THAT coming ?
Btw i read they are thinking of including AI in tournaments. I strongly support that. Also it would be great to see AI tournament, where the various custom AIs battle between themselves and the best AI will win If this tournament ever is a reality, all i ask is for it to be named after me ^_^
-
Patchnotes from my AI, maybe the show some some surprising changes:
- New: Added advanced ACU fight function. Microing, threat management, proper overcharge targets.
- Opt: Air Suicide Platoons no longer attack none game ender buildings.
- New: Added option for AIx Overwhelm for variable start time and cheat increase (thanks to bergzand)
- New: Added strategy for NukeSub defense.
- Opt: Added ACU sniper platoon (13-15 fighterbomber -> directattack ACU)
- New: Added a compleatly new AI Ecomanager that can now also pause/disable mobile units. Including stealth, cloak and jammer.
- New: New attack function "AttackHug". Units will move as close as possible to the target and execute suicide.
- New: AI is now able to micro-move units inside a platoon.
- New: AI works now with No-Rush game mode.
- New: Markergenerator is now able to create land expansions incl mass count.
- New: Added debug option for endless games (game restarts on gameend)
- Opt: AI will now sourround TECH2 mass extractors with storage before TECH3 upgrade (4 base mexes)
- New: Added a function to the targetmanager to get high threat areas for nuke/arty fire
- New: SCU enhance function can now also remove already installed enhancements.
- New: Added presetcategory to all preset SCUs. (Blueprint.lua)
- Fix: SCU teleporter platoon is now able to use preset enhanced SCUs
- New: Timebased debug print to the log every 30 seconds with memory and task data.
- Opt: Factories will be placed with more space between each factory.
- New: Added builder+former for amphibious units. incl Nomads. (water maps)
- New: You can now set an AI unit cap independently from players unit cap.
- New: New Unit-Categories. Blueprint.lua is now adding categories for 2 new unitgroups: 'AMPHIBIOUS' and 'HOVER'. (works with mods)
- New: Added new AI function to search teleporter targets. (Now respecting antiteleport towers).
My AI has alos several debug options for better AI programming.
If you want to have a basic AI mod to start with, go to the vault and search for the "Micro AI"
Its just a basic AI with only 1-2 bilders. perfect for learning. -
@goblinsly Sorian took what was really a poor effort (vanilla) and not only made it more efficient, in gathering, in production and in combat - but he demonstrated the leading edge of ideas that would become the underpinnings of other work.
I won't go into any detail about the multiple facets that make the AI do (or not do) what it does, suffice to say that the most difficult thing in developing this AI is understanding that computers don't see the game like you and I. They don't have the kind of memory to recall what they saw just seconds ago, so great effort has to expended to develop the data metrics that can inform the AI in this way - and make it understand what is happening. That, in turn, requires massive amounts of observation, repetition and then revising those assumptions. I've been at it since before Sorian left and GPG went dark (I have the dubious distinction of being the owner of the final post on the old GPG forums) and I can tell you that it's a LOT of work - and in many many areas aside from just theoretical AI behavior. To understand this AI and make something more of it, requires knowledge of mapping, units, LUA - above the other skills.
-
Thank you for the answers, and god, am i hooked. I do not plan to work on my own AI, but i would love to have some discussion about it sometime, throw some ideas on the table. I am a computer science engineer by degree and most of my college was about this kind of stuff, just sadly not in such a nice package (otherwise my average would be better xD).
That list of changes is amazing and i can't wait to try it out with my friend. And i swear if we get killed by a suicide squad of fighters/bombers or something like that, we are going to yell into the microphone in the middle of the night. Even talking about it gives me the goosebumps. I love this things, even more than playing it. For instance, i used to watch gyle's recordings of fights because it was awesome to analyse it, i actualy prefered it to playing. And now i will test your AI to other AIs and observe what is going on.
Awesome. I was reluctant should i even make a post, as i expected people will say to grow a pair and play against real oponents. I had no idea the custom AI community was so alive after all this time !
-
It's been long ignored - for sure - and it's still the red-headed stepchild in the FAF community, but - finally - after a long time of stumbling around in the wilderness, there is finally some company, someone to discuss issues with that understands the many degrees between point A and point B.
The best place to take part is on the AI discords, of which there a few - FAF, AI only, and LOUD -
https://discord.gg/cpNjaYcw -- FAF
https://discord.gg/28pKVTFJ -- AI General
https://discord.gg/TGWDRcF6 -- The LOUD Project -
And yeah, just to build, I have been working on SCTA AI for last few months and 'newest' AI Developer. And its been a process in more ways than one. Sometimes because he created entirely functions new SCTA functions such as TA pathfinding (i.e. getting Ai to recognize walking kbots, the fact I have 4 different engineer types), and more. But one of things as Sprouto has said, I've been working on or frying the fish as I would call it. Has been working on BuilderTypes for specific managers which is not a thing in the base game FA AI.
But its absolutely fascinating because there is a lot of small things as player you don't recognize or realize how things work or why things work the way they do. And many ways as an AI developer, I have come to appreciate the nuance of factional variances than I have ever done as a player. Sprouto can vouch how often I've asked him on a somewhat even core level questions "How does the AI do the thing".
Like the easiest thing as a Modder I did not even consider really was creating TA unique categories. Such as LEVEL1 to LEVEL3 which are basically the same thing as TECH1 to TECH3 (there are some nominal differences but that getting pedantic). But one of the things I did was removing much of those unique categories. Also the assigning and meaning of threat values, like I will talk about how existence of stuff like threat and imaps are incredibly important that is often overlooked. And originally the TA mod had 0 threat assignments for units.
So I had to assign such assessments for TA units. And while many cases I looked at Supcom equivalents and assigned the threat value, but its also made be better understand the threats and what they mean. Also why the AI has weird choices for its aggression (hello 1k threat mexes). And alot of Sorian has been integrated into FAF itself. Notably engineer auxillary functions (reclaim structures, reclaim units, assisting unfinished buildings etc) which as an AI developer or even player we don't even cognitively think about.
-
Alright, i tested the UVESO AI. I played 2v2 on fields of isis, enemies was 1x SORIAN adaptive and 1x UVESO adaptive. UVESO was flying over all of us, score wise. It upgraded mexes in the mid to T2 while Sorian kept them at T1. IN post game score, UVESO was king. Sadly it didnt win in the end, but this game took considerably longer than the last game that was versus 2x sorian.
So .. me and my friend tried to hold mid, me at bottom, him at top. He failed miserably so we had to move back into the mid near our bases. We held it, though had some problems with units streaming. But pretty soon T2 pds and shields were masacring enemy and i used all that waste mass. I built Megalith and nuke defence, friend built 3 spiders and some air. Both enemies failed to do anything special to harm us, though they were pretty annoying attacking the only mex that wasnt under a shield. Actualy took me 5 minutes to get enough engies and antiair there to build a shield.
Both enemies were throwing low tier units at out shields and t2 pds. I saw the uveso building a spider and a nuke but the nuke was far from done. My friend attacked with 2 spiders, ran into serians base, killed him, then went to uveso base and killed him also. I missed better response from uveso. He did attack with t3 gunships and t2 cybran bomber/fighters but only took 1 spider down. He knew spiders were coming like 5 minutes in advance, because he had his t1 units running by spiders. It would be good in this case if he noticed that and prepared his base. Like mass T2 pds, shields and stop building nuke and finish the spider. It also wasted tons of mass, because it collected probably more than all other 3 players combined, yet had nothing to show, because all the units he was building got killed. 1 thing that i noticed and i was impressed with ... they got a T2 rocket spider into my base. And it was attacking some of my units. Then suddenly i see it moving into the corner and i didnt know wth is happening cause there is a corner, nothing built there. Then i figured, its probably detecting that it vastly outranges my units ... and is better to move out of their range and just bombard them. This was nice.
But, i can say it is considerably better than sorian and mind u, this was small map. I left the markers on default, which means it will only add markers on maps that dont have them. Should i maybe force markers on all maps and that would help ? Next time me and my friend will play 2v2 vs 2x uveso on same map and see how it goes. Oh btw, i used Uveso adaptive, should i use some other AI ? I kind of have difficulty picking the right one for the map.
-
Uveso is the most mature AI in the FAF fold these days, with the most well-rounded behavior. As for maps, they play a huge role in the effectiveness of the AI, depending primarily upon the depth and quality of the marking which allows the AI to understand them. Uveso includes an option that will put a default grid onto any map, and give you a satisfactory result.
There are some other well developed AI that have come about recently, RNG and Swarm, to name but two - and there are others as well, some in a more or less incomplete state.
-
I just watched a game of Sorian adaptive vs Uveso adaptive, on 4 corners. I was an observer. I wanted to just see like first 5-10 minutes to see the differences but the game drew me into it and i watched like 50 minutes of it at +4 speed. Fantastic, fantastic. Kept markers on default, so i dont think it changed them. But sorian played considerably better than i remember anyway. It started strong, and took control of both islands, so more mass and also air superiority. Sadly, barely did any navy, which is insane considering both were cybran and this is sea map. Anyway, sorian also did some bomber runs. It wasnt looking good for uveso and i started thinking if maybe i set something wrong. But .. uveso was smart ... building eco. Then it started mass building navy factories, probably like 8 of them and spamming frigates and it was extremely good with them, i was following them ... that micromanagement ... wow. It was bad with transports, most got shot down. Looked like it doesn't have a clear plan by starting spider and nuke launcher at once. But sorian didnt do much either so looked like sorian will win with spider or nuke. Then it changed. Uveso built some subs, but sorian also, and was pushing. Both were bad with amphibian T2 tanks .. transporting them and getting shot down. Then uveso added bricks and that micromanagement was even better. I never saw an unit coming out of water, sniped some units, then when commander attacked it, it flew into water. This was just amazing to see. Anyway, uveso killed units and buildings on both islands, even though sorian did a good job of making a base there, with factories, pds, etc. But in time, it was destroyed. Also it was amazing how calm the bricks were. I thought it will easily get pulled inside the base and get killed, but no, it used range and very slowly adding bricks on the shore and killing building by building, until they reached commander and killed him. It was funny to see them spamming frigates and subs but not making any destroyers, which are like, really good. Then suddenly i see they made T3 ship but not using them, but then also build a destroyer and sent it to attack.
Oh, and the last part ... this is really funny. They actualy upped cloak and laser on their commander. Now that would be a nasty surprise if i attacked him with my gun upgraded commander only to find out they got laser. I look forward to playing more and seeing how much else it got in stock. I am guessing it can do many different things ? The only thing i would kind of note is that until minute 10 i think they didnt have even 1 unit capable of attacking. Nor any point defence. I did notice it was very smart detecting enemy bombers and started spamming T1 antiair units. Sorian was dumb, making tons of units and trying to walk on water with them .. which doesnt work. But i am wondering how it would end if there was land between them ? Commander would prolly take care of them, collect mass and use it to build its own units i guess.
-
@goblinsly:
I want to suggest that you set the option "AI Map Marker generator" to "Autogenerate Always".
There are some maps like maps from the author svenni_badbwoi that have better AI markers.
But its mostly better to let them autogenerate than using the original map markers.Also when you test other AIs, have my mod activated in the background and all other AIs will use
the generated waypont markers. Also Sorian and GPG AI will use them.Btw, thanks for your great feedback. It's very appreciated!
-
I just played another game with forced AI markers, but it prolly made no difference cause 4 corners doesn't have its own ai markers, so uveso made them in an earlier game too. This game was a bit different. Started the same, sorian took all islands and uveso was denied navy. But it adapted so well, it was nuts. It started making T2 amphibious tanks, then added bricks in the mix. A few of them. Like .. 110 of them and probably 200 amphibious tanks. It was just sitting outside the enemies base, cleared most of his navy, missed few factories on the left. It probably spent 20-30 mins sitting in the water, outside his base, it had plenty enough to kill him, not to mention laser on commander, spider in the base, etc. I thought it was bugged but then suddenly it decided to push and well, as u can imagine, it was brutal. It also had like 3 T3 battleships but only used them to clear some units and mexes on the beach. It looked to me like this AI was very conservative with attacks and planned to just cut off the enemy and over eco him to death. At the beginning, Sorian always ecos faster, prolly takes mexes around islands faster, but then all of the sudden, bam, uveso is like 3-4x higher in mass income than sorian. There really should be a AI tournament, because this is just soo much fun to watch. Im gonna try now an uveso vs two sorian AIs. I am not so interested in who will win, i am interested in how it will adapt to more pressure.
The only thing so far that im wondering, well, two things .. why is the AI so laid back, conservative ? I mean, 110 bricks, nothing can stop that A monkeylord sitting in the base doing nothing, battleships barely attacking, often completely skipping T2 navy and using only T1 and then going for T3 even though destroyed + cruiser combo would help ? Im guessing it detects battleship will be better utilised and keeps monkeylord for defence. And .. well, this one completely boggles me. Commander goes cloak + laser pretty fast, it seems it could use eco elsewhere. But im guessing its purely for defence - makes killing a comander very very tough.
Will let you know how other battles go, i plan to test it a lot, its more fun then playing to be honest ^^
-
@goblinsly said in Sorian AI - isn't it supposed to be better ?:
The only thing so far that im wondering, well, two things .. why is the AI so laid back, conservative
Well, i am a turtle player.
I also play with some unit mods like Total Mayhem.
And shame on me, i trained the AI to play with modsSo the adaptive sub AI is a turtle AI and meant to attack players turtle bases after 30-40 minutes.
If you want an AI that is stronger in the beginning, then use the Rush sub AI.
It has the same builder than the adaptive, but its eco is balanced to build units, not to eco up. It will only upgrade one extractor at a time and try to build many units.The Rush variant is still a turtle AI and does upgrade and build the base while spaming units.
If you want a really spaming and agressive play from the beginning then try Relentors RNG AI or Dalli AI. Almost all new AIs are harder in the beginning then all uveso variants. -
I tried also the rush variant and it is indeed more vicious early. I tried uveso vs 2 sorians and just now, uveso adaptive vs sorian adaptive, sorian air and sorian navy. Took some pics and videos also. Uveso obviously won all the games, but was getting hammered quite well early on, mostly by sorian air, which actualy did very good bomber runs (though never built a T2 airplane in like 90 minute game), doing lots of damage and also upped to T2 navy and did really lots of damage with destroyers. Uveso didnt react that well in this game, i expected T2 arty or/and T2 tacs. In previous game, it did wonders with a single T2 artilery, i thought to myself, there is an MVP unit. At moments i got pretty nervous when the commander got into the water next to like 10 T1 enemy subs, but it got out in time. Though experienced player would go for the snipe.
Ok, then it somehow took out the air player, which was the only player actualy doing something of worth. Then the "navy" player who didnt get to T2 navy in 80 minutes of the game. And then the sorian adaptive who didnt do anything at all, except building the biggest T1 land spam i ever saw and just sat on his island, sending a transport every 10 minutes or soo. Had T1 mass extractors by minute 60 and by the end of the game, actualy upped some to T2. But it seemed like uveso had the most problems with this player. It sat tons of units in the water by the beach, occasionaly trying to rush with about 10 amphibious tanks, but getting slaughtered by about 150 mantises. Didnt use the experimental. It really should have used T2 navy to bombard the beach. It took a looooooong time for him to send a nuke, missing the commander that was sitting by the beach, but the second nuke got him. I wrote down some things that got into my mind as i was watching the game. Keep in mind that while i think as a programmer, i have no idea how the AI programming is actualy done in this game, its just pseudo thinking. Might be impossible to implement, might not even be smart to implement.
-
sending transports from A to B, to the same point, over and over, no unit survives the landing. Between points A and B are stationary antiair, enough to drop everything. Would be cool if there was a way to assess a path and avoid it if it detects to much AA to actualy land
-
Units, mostly in water, getting torpedoed, not sending torpedoes back (out of range) but not moving away either. A lot of T3 mailboxes got shot this way.
-
As i already said, detect when arty/tacs and navy are needed
-
maybe a plan who to kill in 1v more enemies ... instead of sending few transports to 1 enemy, then the next, etc.
-
maybe defend expansion bases a bit ? If not with buildings, at least few units. It made like T2/T3 mexes on empty islands, only to be lost to enemy engies seconds later
-
-
Oh, just another thing to add ... the way your AI is using commander is amazing. It got like 70 kills in a game and really responded well to attacks. At the start, i saw barely any direct damage units and i felt that was extremely risky, but i forgot that commander is an absolute power house at the beginning and it really did respond amazing to all enemy incursions and the more enemy attacked, the better it was since all they did was give mass.
Commander going into water near many subs got me worried but then i noticed its trying to build navyyard near, so it was actualy tanking some torpedoes. Killed some T1 ships also. I missed it reclaiming enemy subs sometimes, when it was only 1 sub there - it walked under it but then went onto the land. But still, awesome play. Then it built T2 PDs, like 5 of them, but not a single T2 AA. It got me worried but then i realised ... enemy didnt use any T2 air, and T1 AA units from factories are amazing, it had plenty of those and they cleared the sky awesome. See, if i was playing, i would surely build T2 AA as soon as i sighted a single enemy T1 bomber, and i would waste mass this way. -
-
The flightpath is already calculated with the threat of AA.
The AI uses the way with the least threat, this can still be to hight to flight over.
(I will look into it and maybe increase the threat value of AAs) -
Units don't know how long the weapon range from the enemy unit is.
We can't access this data without using mechanics that are not avilable for players.
Everything not available for players is considered as cheating, so we don't implement this to our AIs.
(Maybe i can use the OnDamage event to issue at least an evade movement when getting damaged) -
Well, navy is one of the weaknesses of my AI. I don't play navy and have almost no clue how to make it.
(I will compensate this in the 2 next updates but i can't promise much here.) -
Different from Sorian and GPG AI my AI don't has an picked enemy.
It is attacking the closest enemy unit to its base. No matter what player it is.
Transporter flight paths are tricky. I can't just unload units earlier on hight AA threat
because of the landshape on some maps. If i unload the units and they can't reach the target then its also wasted. -
Psst secret I work on a platoon that is moving to defensless mass extractors and add defenses around it.
Building defenses while building the massextractor is not easy. i can only check the eco before i send the engineer to build
the massextractor. If i add an defense to the buildplan and the eco goes down while the engineer is still moving to the
buildplace then i have maybe not the eco when the engineer starts to build the defense.
Thanks for the compliment.
Yes the ACU function is brand new and surprising good. Can't wait to release it
Did you see the small video i made to show how the ACU is getting targets and attack ?
https://youtu.be/LvLNFyNk3kgIt still needs some work, but i am satisfied how good it is already at the moment.
-
-
I just checked the vid and its very interesting. I am guessing it is constantly calculating whether it should attack units in its vicinity or go home .. and it is using many parameters, such as its own health, strength of ally/enemy units, distance from home, time of game, etc. Am i assuming correct ? Similar with overcharge, calculate mass of adjacent units, decide if worth the energy cost of overcharge ?
I am very impressed with the AI, like i said, it won against 3 sorian enemies. I am looking forward to seeing how it improves further. There is so many things .. for instance, sure, u can have a generic commander, same for every game. But, what if u spice it up, make a few personalities and at start of each game its randomly choosen ? So, in the last game, you saw an uveso enemy commander defending its base very well, then the next game, the enemy commander suddenly pops in the middle of your base, almost on a suicide run. I can almost hear my friend on skype, saying, what the f... and laughing if it happened to him. Sadly, im not a good player to give any tips on navy or anything.
1 thing i noticed, there seems to be certain markers on each map, you can even see them for a few seconds after the game starts. And then everyone builds navy bases on those markers (uveso sometimes even tries to build navy factory near enemy island, which is a neat trick, human enemies do it all the time). But, isnt the fact that those build markers even exist, kind of making the build thing almost scripted ? I was thinking about it earlier and if u set all the water as potential build site, you would probably have big problems preventing AI trying to build it in some insane places. But, speaking for 4 corners, i would add more navy build spaces, add different weight to them to make sure they more often then not pick the more optimal one, then just use a rand function to pick spot. I hope i didnt completely miss the point of how its done.
There is so much more i would like to say but i will keep it short just by 1 last comment. You said, units don't know how long the weapon range is from the enemy unit. But in a way, we do. Let's say we have radar coverage but no sight coverage, so we dont know which unit is shooting at our unit. But we do see that a) our unit is getting hit by something and in the case of torpedos, we do know its a torpedo, b) we know our unit isnt shooting back since we can see that visualy. And lastly, c) we can see that the unit is out of range, since we can visualy see that the enemy icon is out of the red circle that shows range of our attack. Now, it is true that we cant just by looking say exactly how many meters the unit is away, but we can approximate. We dont even have to know the distance itself, we just say ... if(gettingHit/taking damage && noUnitInWeaponsRange) doSomething (like move away, move closer, anything). Btw, is there any default unit response for what the unit will do when its getting hit ? In most strategy games, if u start shooting unit from afar, it will come to you and attack. Is that different in SC ?
Looking forward to your next AI update
-
Default response to getting hit is taking damage !
There is no micromanagement of units inside a platoon in the default game.
Only our custom AIs are microing units.
And doing so is tricky. Not only the CPU power but also the network traffic.
In case the AI is microing 800 or more units its the same traffic than 5+ players .So we need to be carefull what we want to add.
-
New Update (v93) is out.
You can download it from the vault or from here:
https://forum.faforever.com/topic/350/