Tuesday, April 17, 2012

Neural networks in AI

Does anybody know whether it's possible to implement Neural networks as part of the AI in Supreme Commander?|||Possible. Yes.

Practical. No.|||The problem with learning AI is that it generally finds something that works very well and exploits it. And they take a very long time to adjust to changes.



This makes them unsuitable for most video games.



Something simpler with more concrete data is easier to debug and therefore a more viable system in a production environment. Using genetic algorithms that build decision trees could work for deciding what units to build in what situations.



But you're still screwed for where to send them at that point.|||Scathis|||Yare|||For a NN to make useful Sup-Com related decisions, it would need a huge amount of nodes/axons, which makes it terribly slow.

Seeing as you'd be implementing in in LUA, it would be even slower than usual :wink:



Perhaps they could work on a small scale though, like a small NN that simply learns and predicts the best unit for countering another unit.|||ActionMan|||What about, instead of a NN, make the ai work like an insect - each unit having a tiny ai brain that has a limited set of stimuli and programmed responses to these stimuli. You'd mix it with some more complex & probably an over-arching brain that focuses more on strategic options.|||Pawz|||Quote:|||Of course you steamroll an AI in the first few minutes - to give the AI a decent start (when variable are at their greatest) they work to a prescripted pattern. That pattern is very much based on getting the AI competitive for the whole game, which in turn means it does not respond to early extremes of tactics, for example the rush.



By rushing an AI you are essentially exploiting its main (and artificial) weakness.|||Well the point wasn t to boast about how fast I can defeat an AI but rather to state ,like you, that AI aren t efficient and cant be efficient at everything because of the 'prescribed' thingy you speak about,



hence my support to this neural network Ai thread, actually i d be very content with a neural network or any other 'living' AI, dealing with change even if it never reaches angry zealot level of play.



i am more intrested in AI in the general meaning of the term than in supcom bots mods, i just feel supcom is an ideal environment to create artificial life.|||Ajunta|||Scathis|||Well i have to agree with you onthis if i want a tough opponent for me i can just play a rated game or 2 and i should find somebody to hand my *** back to me within the firt 3 games.



my point is not to make the computer difficult , i could use a cheating Ai or team enough of them together.



I am just intrested in creating a 'live' AI that can learn and think by itself.|||A neural network AI would be just as vulnerable to early rushing (or at elast changes of tactics) as the current situation, with the difference being you'd have to spend a long time training it to be that bad, and it would require masses of memory.



You'd be better off scripting an AI specifically to deal with rush tactics (perhaps individual ai's for different amps to make it really competitive).|||well it is probably true , probably as true as the fact that most of us can play hours and hours and still be vulnerable to early rush or mercy strike.



the point is not to build an AI that is unbeatable whatsoever, such an Ai would be dull or merely a benchmark for human player.



i am intrested in creating a neural network Ai because i want to see a computer 'live' just like people enjoy watching robot beating each other to full decomission. I like to see Ai fight each other, i like to see how an Ai fights a human.



as far as i can see the AIs are at best very predictable and lose to very similar mistakes from game to game.



i dont want to build an Ai that can beat all other AI, i dont want to build/train an Ai that cannot be beaten by a human player, i want to create an Ai that is surprinsing to play against/with or to watch, an Ai that does not always perform the same.



as for scripting the problem is

if you script an Ai to deal with rush tactics then you will script the Ai to build

point defence

a few anti air

lots of engineer to rebuilt what is destroyed and expand

rush for tech 2

rince repeat

rush for tech 3

rince repeat

rush for tech 4 and finish the game....



well okay you 'may'catch a human player with its pants down but i doubt it.

anyway the next game the human player will rush tech 2 thenbeat the crap out of the AI with superior pathfinding,vectoring, baiting and ambushing...



okay so you build an Ai that rush to put rushing player under pressure and stall their economy at wich point the Ai should be able to get enough advance and tactical advantage to finish off the human.

so you may catch a human player with his pants down once.



and then the next game the human starts turtling and prepare a counterstrike or a tech rush and overpowers the AI.



basically my point is that

IF you SCRIPT the behaviour of an AI the the game is won by the human once he has chosen the AI, the name of the AI is the answer to the question 'how am i going to best the AI'



if it is a horde AI turtle

if it is a turtle AI you tech

if it is a tech Ai you rush.... okay paper rock scissor how dull....



'random' woot neat okay send a scout figure out what the opposite AI is doing, back to square one end of surprise.



now correct me if i am wrong but there is only 2 way to introduce enough random to keep the game intresting:

1 you figure out a VERY COMPLEX, script and you hardcode it and debug it, which in my opinion is beyond the reach of human brain during the while of its life time even for a game like chess.

2 you code a ai that can learn through others and through mistakes and that will with the passing of time and the gathering of feedback end up performing like a very complex and unpredictable function,adapt to changes without you touching code again but will make mistakes.



i ll go for 2....|||This game has an AI based on a neural network... and at the highest difficulty... I could not beat it.



http://www.arenawars.net/English.aspx|||You are assuming that a neural network will make an AI behave like a person - it won't. The neural network approach will simply make the ai very good at beating a tactic it comes up against often. The problem is that the vast number of variables in SupCom (terrain, position of buildings, type and number of units, scale of maps, balance changes with subsequent patches) would make it such that a neural network type approach is utterly impractical (at least at the level of a game to be played on a home PC).



What you actually want - and which I agree with - is an AI which does things differently each time - which may take several different approaches to a particular map or situation.



These things are much much easier to build into a scripted AI than to try and design a neural network for.



For example - we already have various AI's (both GPG and user written) which behave differently to situations. Many also change their approach according to situation (for example, a JAWS AI designed for naval combat will become an incredibly efficient strat-bomber stiking AI if its access to water is restricted).



So now all you need to do is hand over a trigger to apss the AI from one script to another (or, different parts of the same script). How you do that will obviously depend on what you want this AI to do, and what you set the trigger points to be. You could something as arbitrary as switching AI control every 10 minutes, or use event controls - for example if T3 artillery is detected as being built, or if your base comes under fire from battleships.



What the AI switches to could be controlled or randomised - it could therefore be randomised within a group of possible response scripts. in this way you generate a very unpredictable AI.



Now this is an order of magnitude more complexity in the AI scripting, but still far far more simple - and importantly more likely to give you a good AI - than trying to use neural networks.|||well i can see our opinions converging now.



of course a neural network designed for supcom would never be a person.... there would be so many things to be embedded in the neural network that would eventually make it reach the point of a baby animal with everything to learn. And i dont see anyone having the patience of training even such a neural network as they have the patience to train an animal or a kid.

Since training is everything.....the neural network would be very burdened by its broad complexity in terms of ressources needs and yet never achieve the simplest Script results in terms of game efficiency.



On the other hand i dont exactly want an AI that just does different things each time.



one could just use random to achieve this but random is .. random and sometimes it can performs extremely good out of blunt 'luck' and sometimes it can perform outstandingly poor out of blunt 'misfortune'.



As far as my understanding of the AI in supcom goes



there is a scripted prioritised build list, tuned by build conditions.



the built stuff is then labeled a platoon and handled to a behaviour engine that makes that platoon perform a fairly thourough scripted behaviour procedure. until the platoon is either destroyed or disbanded into raw material for other platoons.



as i stated in another post there are plenty of things that are stisfactorily handled by a procedural and extremely accurate function, like evaluating dps/hps ratio, kill time build time, range exploit, mass need ,expansion speed, tech speed, etc... and honestly i dont see the point including that stuff into the neural network.

though we human use our neural network to emulate these procedural functions in a very approximative fashion i dont see why a computer would have to go against its natural abilities and use 100 time its computing power to reach a worse level of accuracy after , mind we, days of training.



i also have nothing against a script.



what i am not satisfied with are mainly 2 things.



1 - at the point we reached



The scripts though good at what they are doing and slightly adaptative are not complex enough in their adaptability to consistently surprise a human, or surprise him to the point the human loses track of the actual 'archetype' 'or tactical 'cliche' the Ai is using against him or preparing for the next stage of the game.





As an example i ll use the one you pointed out

Jaws Ai may be changing its global behaviour , it is still not surprising a player, once a player has has the upper hand on jaws then jaws will turn into a strat bomber operator, well then the player might get caught with its pants down the first time and gets its fleet annihilited,

then the next time it will gain naval superiority and, as soon as naval warfare goes good for him, start to build AA naval stuff, and intys, and then jaws will be caught into a economical hell and basically ruined.



basically if jaws Ai had more cards in its hand to choose between it would reach a point where the human player cant accurately figure out and anticipate jaws next decision, that would force him to constantly spy on jaws. and again random only will not do the trick since a player does not want after 60 minutes of intresting playing against jaws, suddenly notice that jaws has chosen out of random to clutter its island with tech 3 siege bots.....



this would be a very unsatisfactory feeling for the player to have to hope for good dice rolls so that the AI keeps being competitive dont you think ?

And this is a very insatisfactory feeling for a modder to make an AI that happens doing this kind of obviously unconsistent and purposeless moves.



2 - scripts complex enough to be humanly unpredictable without being complete random, need excessive time to be hardcoded, debuged and eventually updated.



Sorian team and other modders have been working a fairly large amount of time on an already quite complex set of scripts.

And yet we are not even half way of issuing an AI that is not 100% predictable after a few games neither at global level nor unit level .

now imagine that we reach the point where we ve done it, who is going to update such a scirpt when the game datas or the game engines are changed with a patch...



such scripts reach a point where readability, and work time are discouraging when update times come.



Neural networks dont, if they are complex enough but we are not going to use such a NN that is patch proof because it would have to be implemented at least in the environement 'windows for most of us' and for other reasons developped in this thread.

But if they only have the shallow compelxity i have in mind they might still need version updating and a few tuning here and there but they will never reach the point where the whole memory bank they gathered is completely obsolete and needs to be reworked at hand from A to Z.And they will never reach the point where a developper wont be able to 'fix' the scripted part or the architecture of the neural network. only the said memory bank will become unreadable with time.



i just point this out because FA is about to launch....and i can see someone revamping a bunch of AI the size of sorian's, but i dont see any body revamping 1 scripts 50 times the size of sorian's with build conditions so intricated that even the human that coded it in the first place has lost memory of how it has been designed.



hence my idea.



As we agree A neural network complex enough to be adaptative, accurate, efficient, patchproof is irrealistic for several reasons that we 've been through during the course of that discussion and i do agree with whats been stated about them regarding emulation computing power, memory greed, diskspace problems training time problems and such.



I hope we agree that scripts are facing the problems we know now,

though they are are doing OK so far and still improve.

But that eventually they will as the former problem fades reach a point where the problem of their impossible adaptativity and updating arises.



so the idea would be to run



fairly shallow neural networks to handle decision making and be called through build conditions. which would go a long way in making the AI taking more accurate decisions in that particul field.



another bunch of fairly shallow neural networks to handle unit decision making aka NN piloted behaviours/behaviours change.



and last but not least a global strategy neural network maybe not that shallow but complex enough to



pilot the building,



keep consistent over time aka not change an air superioty strategy to suddenly go for all out land siege.

or not build a nuke launcher AND a tech3 artillery on parallel....

while able to change strategie out of pure purpose of deceiving the ennemy or in reaction to intel gathered on ennemy[ies]



sensitive to map

sensitive to ennemy strengh

sensitive to inbuilt 'personna'

sensitive to intel|||I think your expectations of an AI are way way too high - you're expecting it to play better than 80% of the playerbase that I've seen - most of whom will happily sit back and spam the same tactic game after game after game.



I have no problem with high expectations, but I think realistic expectations are the key thing here.|||I have to admit you are right Xenoc, both on the playerbase and on the expectations....



but admitting i give that up would be just like admitting that what i can code will be nothing but myself in an automated fashion, with the advantages on thouroughness and the lack of creativity that it comes with.



that would be very realistic and yet a lot of hard work already, Sorian's AI are a good example of how much work can be put into even such a realistic project. And i do appreciate sorian's approach of the job :

do something simple and reliable,

launch it

and then put as much effort as you can, tuning it up.



rather than going for something to big and finally never coming to the launch point.



But i just want to do things differently and i dont feel really exhiliarated about doing an automated 'me'. so i ll try as best as i can to do something else.|||If you want good AI you have to start studying replays of the top players in my opinion, and most of all the problem with many AI's is that many strategies are MAP DEPENDENT, so ideally you'd be wanting to customize certain aspects of the AI for each map if you have the time.



Which brings me back to one of my first points:



Saving player data en mass and using statistics to analyze replays, etc, and then use this data to build rules for an AI.|||I think i would not lie if i state that it has been done by most AI modders these past months.



but i think that being a top player is not just about being able to do something with maestria every single game depending solely on the map. But rather be able to do a lot of things with maestria and switch between these tactics considering the map the opponnents behaviours and exploit opportunities, most of the time opponents unperfection at what they do, or risk opponnents have been taking.



As Xenoc said before we can if we work long enough script these behaviours and end up with probably very efficient AI doing optimised stuff in a very neat and thourough fashion.



up to now i am not happy with the platoon behaviours, though i am not even close of having had a glimpse of all of them.

And i am not happy about the much too rigid way the prioritised build list are handled.



a lot of things that have to do with the AI are very 'middle groundish',i mean fairly good at a lot of things but really efficient at none , though once

again i have not thouroughly spied on them all.



my example here would be the horde AIs wether it is sorian's or a normal one, on a small map it will not even come close to swarm anyone with anything really dangerous for its commander, neither will i be able to deal with civilians most of the time. on the other hand it is no so slow at teching

mainly it is aggressive , expanding fast and trying to control the map but



1 - it is not agressive enough to put real pressure on any ennemy base before tech II

2 - it is not defensive enough to prevent destruction of its assets.

3 - it is not teching fast enough to be able to compete with someone who has been past the first 20 minutes.



lets aside the NN aspect that we spoke about till now; my approach would be in favor of much simpler and straight forward global strategies that might look 'cliche' or obvious but that would be switched between one another given the map, the intel gathered on opponent, the number of opponents well basically environments.



In time we could lead the AI to take a middle groundish approach ponctually should the game provide the opportunity to do so, but with going heqd on into the jack of all trade attitude we basically doom the AI at lacking consitency from the beginning which is a real crippling move.|||AI is a really interesting topic... I know only a tidbit about it, but... It kinda seems that any talk to stubbornly implement ai in the game is really only inadvertant, nublike epeen. =D



lol, anyway:



The issues and complications with AI in the game aggregate around the idea of building a nueral network. Who does that, and what inputs and outputs do they use? When new strategies arise from human players, when does the nueral net get updated? How long does the training take place? Who decides what human strategies to include in the nueral net training?



AI isn't very practical given today's limitations in parallel processing and other technologies. Of course science still continues to explore the field, but it just isn't practical for vastly complex, dynamic, parrallel decision making. Nevertheless, it's actually quite practical for things such as voice recognition, and optical character recognition. That's actually because the neural net can be programmed against a static environment; i.e., letters, numbers, and waveforms.



SupCom doesn't posses very many static attributes. The effort involved for training a NN would be vastly more intensive then the effort involved in pragmatically hard coding human-conceived decision making algorithms and state machines.



gg I-Robot, but i pwn you.

No comments:

Post a Comment