 |
|  |
 |
|
Natalinasmpf
|
|
I've been thinking about the concept recently.
I think eventually this will be a direction of the artifical intelligence of future games, at least to make the artifical intelligence really smart. Basically, the concept is, the artificial intelligence, at first its really stupid - or uses predefined rules, like today. (Simple commands like, walk and shoot.)
Then it will gain experience, and adapt. For example, it will realise the concept of investment - take for example an energy bank in SMAC. It supposed to enhance your economy, but the AI doesn't feel like hurrying it since it would defeat the purpose of gaining credits, right? Then he realises, that after a few turns, it will pay for itself. That you spend a bit, you gain a bit more.
Then it learns that placing it in a well developed base is a good idea. It writes this to its rulebook. From now on, it will realise this fact. It will then also realise that sacrificing a bit of growth to divert to minerals for that tree farm, will eventually lead to more nutrients from forests - more growth. Then it finds that for example, the right and wrong time to do this, and adjusts accordingly.
After a while, you have decent AI. Not just programming hundreds of rules which some tactics you might miss out, it learns. Then it learns how to attack in flanks. How to attack in surprise. How to do other things.
Then also another possibility: you agreed, the rules are distributed to some central server, and shared. You also receive rules for the AI from somewhere else, enhancing it further. Then it might get really personal - it realises your playing style. "From how you move your mind worms, my algorithms say you must be Player So and So. You always liked the Weather Paradigm over the HGP - that building of the HGP is a decoy!"
Perhaps first it will appear in chess games, ie. how to beat certain openings, especially in Fischer random chess.
Or, the best is making it integrated. It will realise principles in one game, and apply to the other. This can be helped with one standard protocol: one game will use the same AI protocol as another, perhaps. Just as we all probably use TCP/IP to surf the internet. Of course, this is another big step. How to realise that (and discern) that the game you just played has different keys, and that (say its an FPS) that since you are immune as a tank, to bullets - you should slaughter all non anti-tank infantry, and either take out ASAP (or avoid) anti-tank stuff, like mines and whatnot.
Then you switch to a RTS style game. Your heavy cavalry are virtually immune to standard infantry, save for some counter-unit. Same principle, different scenario. The trick is getting the AI to recognise it, and know how to apply it. (It will not help it when its a tank and searches for pikemen!) Discernment, again...
I think it will be more of a program running in the background which does all this polymorphic computation, while the games just feed it back info and asks what should it do. (As well as asking your keyboard whether someone typed A and therefore the character should move left).
Of course, making such an effort open source will have distinct advantages, rather than if it was proprietary...although I'm not sure how many people have this idea, but if it does, it will probably appear under the GPL.
Well all this is speculation of course. But perhaps we'll see it in ten or fifteen years or so. Actually I had an idea to do it now, because I was writing a Weiqi style game (but with hexagons and four players, complete with diplomacy - if enemy pieces, even of different colours, surround all six sides of one piece, that piece is gone. Of course, one might declare he's temporarily friendly and therefore will not cut off "life support" ) and because I thought if I was going to write an AI from scratch, I might as well try now.
|
|
|  |
 |
|  |
 |
|
LDiCesare
|
|
La Ferté sous Jouarre France
Jan 2001 time: 05:20
|
|
I'm afraid what you say is far too vague to be helpful.
AI learning works and has been working for a long time. Things like neural nets can learn things, automatically or under supervision, for instance.
The problem with games is you have to recognize things. For instance:
quote: Then it learns that placing it in a well developed base is a good idea. It writes this to its rulebook. From now on, it will realise this fact. |
How does it recognize what a base is? What a developped base is? Is it really a good idea to remember it? Sometimes you have to forget everything in order to get a better strategy.
The biggest problem with learning things is you have to avoid learning by heart. For instance, if you learn that building knights is good and someone mods the knight unit, then you're left with a bad rule, and the system will have to re-learn everything. But on the other hand, if instead of learning 'knights are good' you learn 'units with move of 2 and big attack are good'.
In order to learn, you need to react to percieved situations with choices. This means you have to see things. If you can't recognize it, you can't play against it. This will not change with an adaptive learning algorithm or anything like that. Reactions are usually available.
But then you have different levels for the ai. Strategic vs. tactical for instance, and you'd have to teach both levels, or choose a number of levels. If you pick a single level, that's a choice. If you pick two that's another one. If you let the ai learn how many levels are good, that's a possibility, but it's unlikely you'll ever have the time to process everything and think of all inputs to yield a good ai.
I think a goal-oriented ai is much better than either rules and is the strong point in a good ai rather than some kind of learning algorithm. I can't see how saying 'let it learn' makes a good ai if you don't tell it correctly what it must learn (how to win being far too vague in any game more complex than chess - and even in chess there are lots of evaluation functions for a given position).
|
|
|  |
 |
|
Natalinasmpf
|
|
quote: Sometimes you have to forget everything in order to get a better strategy. |
Exactly. Just as sometimes even the greatest mathematicians forget the basic operators and go question the very aspect of a number. From this they logically moved on to the fact that imagnary numbers exist.
Well anyway, it is vague, because all learning has to be general.
quote: I think a goal-oriented ai is much better than either rules and is the strong point in a good ai rather than some kind of learning algorithm. I can't see how saying 'let it learn' makes a good ai if you don't tell it correctly what it must learn |
The AI suffers at first, and we will guide it along, initially. You have to, teach it how to teach itself. After that, when it is more capable, we don't have to.
Just as we tell our babies that crayon is red in colour, but we shouldn't guide their hands in whatever they draw. We can tell them an example of something one can draw, but to tell them what to draw, guiding them by hand is a no no. Telling an AI that a strong attack with movement 2 is good is superficial - you have to move on to the basic principle of warfare.
It will eventually store these things and evaluate.
It will choose: objective: knock out enemy. Choice: slow, but high defense, medium attack Hoplite infantry? Or High speed, High Attack, Low defense lightning cavalry?
When do I apply the situation? Why is sometimes the infantry better? It will learn very superficial things at first, then it will start to link. It will adapt to take advantages of bonuses. It will remember to think twice before attacking anything on rocky squares, or whether to choose another target, (a bit superficial), then later, evaluate whether it should hurry sth or not. Along those lines.
quote: but it's unlikely you'll ever have the time to process everything and think of all inputs to yield a good ai. |
I don't process everything. The idea is an AI that adapts, so the programmers don't do countless superficial rules. Move there in this position, move this in that position. Rather, it will evaluate. If the AI made a mistake, but you saw it too late and it started to win (ie. "agh! I should have attacked the unit in that square, not that one), so you reload to correct it so you could gain the upper hand, guess what it will do next.
quote: How does it recognize what a base is? What a developped base is? Is it really a good idea to remember it? |
It will, it will build up. It will recognise it not superficially, but in principle. It will realise the mathematical principle, that in exponential situations like LABS multiplying facilities, the larger the index, the better. It will aply this to all games. It will eventually realise that all the time, when it tried to place it in a bad base, it failed. When it it placed it in a good base it did better.
It writes in rulebook.
Then it realises that it placed it in a base poor in energy but rich in minerals, that Research Hospital seemed to be built quickly, but didn't go so well. But that mineral poor, but energy rich base, that Research Hospital yielded a better game.
Learns: place it in energy high bases. Learns: hurrying is better in this situation. The next step is also linking. Of course, it will not know what energy is, it just knows if the value is high, it succeeds. So the next step is the code to understand. Then it realises how to get high energy.
Discernment isn't an easy thing, the discernment to recognise, not an easy thing to program. But once its laid down, there are no barriers to advancement. Then of course playing single player games start to become meaningful, because you're breeding a little entity with the ability to one day become sentient. 
|
|
|  |
 |
|
CygnusZ
|
|
This reminds me of a game I bought when I was in 5th grade (for reference, I'm 22 now). In this game, a simple grid of either 3x3, 4x4 or 5x5 was displayed and the player and computer would take turns placing blue and red spheres. The trick here though, was that the player decided when he had won or when the computer had won. Based on what the player said was a winning position, the computer attempted to formulate the rules of the game.
While interesting in this context, there is a problem with having this sort of intelligence in a real computer game. Computers can predict with much more accuracy what the optimal moves are while humans would be better at creating new strategy. Once the computer has learned the optimal moveset it will always be undefeatable. Remember that the trick with building AI nowadays is to make it convincing in its miscalculations. Having an AI that could destroy the human player (without cheating) isn't really that difficult.
|
|
|  |
 |
|
LDiCesare
|
|
La Ferté sous Jouarre France
Jan 2001 time: 05:20
|
|
quote: place it in energy high bases. |
Again, I do not see how you can tell it what a base is or energy is. It must learn it. There are two ways to learn. By oneself or thru a teacher. Trying to have an ai behave properly without a teacher seems very hard for me. Having a teacher is what most games do right now, except most games don't evole after being finished.
Just for comparison, it takes maybe 8 years for a human being to be able to learn playing civ. I doubt an 8-year old would play civ, but who knows. Do you think you can get an ai learn the same things faster?
How would you get the ai to decide that 'knocking out the enemy' is a possible choice? If it is something it should learn by itself, not only will it take a long time for it to find it out, but it will probably be unable to explain its reasoning and strategy to you, which in terms of debug and convergence of the program, may prove hard adn maybe impossible to overcome.
|
|
|  |
 |
|
Panzeh
|
|
The most notable game with an AI that 'learns', or at least something close to it is SuperPower.
The game's AI is rather random and erratic.
|
|
|  |
 |
|
LDiCesare
|
|
La Ferté sous Jouarre France
Jan 2001 time: 05:20
|
|
I've been working in a firm which developped neural network software and solutions. The first thing we did was provide pretreatment for the NN to be able to cope with the quantity of data. Showing it in a correct way helps the program a lot, and that's true of all machine learning algorithms. For instance if there is a linear relation between variables, it's easy to see. If the relation is logarithmic, you'd better feed it the logarithms of the variables too in order for it to be able to see the relation. If you're working on f.e. ilage processing, there are lots of invariants in the picture which you can preprocess to get rid of. For instance in movement detection, you will start by substracting 2 images rather than give the 2 images and let the program learn to do the subtraction. The reason is that it would learn it eventually, but it would probably be doing the subtraction pixel per pixel and get one or two pixels wrong. A program will always behave better if you feed it some intelligence to start with. Thinking a program can learn everything from scratch is very optimistic in my opinion.
And an 8-year old doesn't have to learn just physics. You start as a baby, must learn to see and recognize patterns like faces (which are somewhat hard-wired). Face recognition is not really complete until around 3 years (show a bald person to a 2-year old and ask him to show the top of the heas. The baby will be surprised by the lack of a hairline and have trouble processing the information). This input-processing, learning to see and learning to hear and make out words, takes years. Then learning to speak, even simple words, or control motions, takes months. And then humans are hard-wired to learn that. A program which has to learn to make out what information stored in a 100ko (civ2) or 1Mo (civ3) file means will need a lot of time if it's not given guidance.
I'm looking at this from a pragmatic point of view, that is: could I use some machine learning algorithms in my own game? I will let the ai decide by simulating fights to see if the fight turns out well or not. But then, such a fight absolutely has to be simulated rather than learnt because it takes a lot of variables into account and it's unlikely the same situation will happen again unless you teach the program millions of times with the same set of data. And then you must make sure it didn't learn something which happens to be right in this situation but is generally silly.
For instance, it can decide that it needs an attack value of 100 + opponent value - (opponent value squared)/100. This may work very well until the opponent value suddenly exceeds 100 and the ai never saw that before. It will then start behaving like a moron and will have to relearn everything. With a program where you let everything run and learn by itself, like neural nets (which is the machine learning I know best), it's very hard to know what the program is doing and help it learn more.
The research space in civ is virtually infinite (you can have an unlimited number of units in a square for instance). It's so huge, that all situations can't be seen by the program, and hoping that the program will evolve a strategy ex nihilo rather than simple, tactical rules, looks like an act of faith to me.
|
|
|  |
 |
|
LDiCesare
|
|
La Ferté sous Jouarre France
Jan 2001 time: 05:20
|
|
This experiment is a breed of neural networks and evolutionary algorithms. The neural networks let each robot (ai) learn, with the pitfalls I mentionned (it requires filtered input in order to behave properly and can learn by heart if not dimensionned correctly). Then the evolutionary algorithm weeds out the weakest ai's and lets the others learn and refine. I'm not sure how they mutate, though.
The best thing such a scheme could provide for a game is probably a set of different, flawed ai's, each with different flaws and strengths, like UR has been talking about in that 'Castles' game.
I disagree that modding is changing the rules. To me, rules are what's written in the code, and thus the ai which is written in the code must be able to handle all of that. Then if you start modding more than just units (think the SLICs in CtP2), you have to be able to mod the ai too, so opening the rules for modding means you have to open the ai for modding too. If the learning algorithm takes a long time (and it usually does), then you can't use learning algorithms to manage the modded game unless you spend hours teaching the ai how to play the game.
I think the ai should compare various possibilites, and use a somewhat random algorithm instead of systematically picking the best-looking choice, but don't think you can evolve a complex game with current technology.
|
|
|  |
 |
|
Blake
|
 |
Brainfallocatione
Oct 2000 time: 17:20
|
|
Usually in games, there are a few strategies that work really well. If you play Warcraft 3, you know of the Archmage and Mountainking hero combination - it's simply the best. If you played C&C Generals you know of the scorpion rush and mass chinese drivel + gatling tank strategies. Once discovererd, inventing new strategies and active adaption becomes distinctly unimportant, instead implementing the cookie-cutter strategies as good as possible becomes the thing to focus on, in other words, practise. I don't know how you make an AI practise. But the point is, these strategies are VERY WELL DEFINED. In SMAC you tech to Ind.Auto, or you might tech to impact rovers, random deviation is *NOT* going to improve your game, sticking to the plan is the best thing you can do.
The time (and only time) for real adapation is *CHOOSING THE STRAETGY*, you can generally choose a teching strategy, an expansion strategy, or a conquest strategy - note that in most games expansion > teching > conquest > expansion (assuming a teching player builds defense). As it turns out, theres no real need for intelligence in choosing the strategy either, choosing the best strategy is quite mechanical, even if it involves a mixed strategy (like rushing 50% of the time, expanding 40% of the time, teching 10% of the time). There is remarkably little need for intelligence in strategy games.
How do you apply this to AI?
The very best thing you can do is allow the experts to directely train the AI, this is much more effective than learning from experience, because the experts will learn and define the best strategies far quicker than the AI can - if it ever can at all. So making the AI very scriptable is a good thing indeed.
Once the AI can implement a number of strategies, you take a game theory approach to deciding which one to use, it should stick with that strategy unless it *really* needs to change - it is important that it can change strategies otherwise it becomes 100% predictable. Like if by chance the enemy has done the perfect counter to the chosen strategy, adaption is nessecary.
There is some scope for adaption, but it is mostly still mechnical, if they get air units, add enough anti air units to your forces - that sort of stuff. Theres still no need for the AI to learn what to do, an expert can tell it the proper counter just fine.
The major failing of AI's for nearly all RTS games is they use a Generic Strategy, like build 6 tanks, attack. Build some defense, tech after a while, expand at some point, keep sending attacks. The Generic Strategy cannot be improved, the AI needs to use entirely different strategies, and stick to the chosen strategy. It needs to pull of the meanest tank rush, OR it needs to tech hardcore with static defenses, OR it needs to expand like a whore. It needs to mix these strategies by choosing which one to use, not by trying to implement all of them at the same time.
I'm not saying that polymorphic AI's don't have some place in strategy games, just that in the vast majority of strategy games most players get along just fine with simple imitation, and to make the AI decent, the same approach should be taken. I feel that Game Theory is far underused in making Game AI's, kinda reverse-iorny seeing superficially game theory has little to do with computer games.
I'm not saying that an AI will never be invented that can beat humans without being trained by humans, one day that AI will be invented, it will have the properties of imagination and creativity, it may well have rights as a sentience. But the day before that AI is invented, the best approach will still be using human experts to train the AI (and forcing a sentient AI to just play one computer game might be considered immoral)
|
|
|  |
 |
|
LDiCesare
|
|
La Ferté sous Jouarre France
Jan 2001 time: 05:20
|
|
quote: There is remarkably little need for intelligence in strategy games. |
Errr... Disagree.
quote: expansion > teching > conquest > expansion |
There are variants. Most games require an initial expand phase, but it's mostly because the ai has been trained that way. I once modded Galciv to make initial expansion impossible. You had to build constructors to move them to a sector with a star in order to be able to build a colony there. By changing the techs, I offered various choices: You could either expand at the cost of tech and production, or learn tech, or boost your production and ships (turtle). The problem is: The ai couldn't do it, as it didn't know it could use a constructor to let it build a colony. It learnt techs based on wrong suppositions (that it could expand) and generally behaved very badly.
However, the ai does behave in various ways. For instance, in Galciv, it can try to out-culture you or to ally itself with another opponent in order to beat you (or bribe them). There are many strategies that work in galciv. You can use allies, trade with an opponent in order to make it less profitable for them to fight you, etc.
Although the initial moves are, as you implied, pretty much always the same.
But then in civ/civ2, if the ai would have been taught "You're on an island far from everything with 4 whales nearby, go for One City Challenge", it could have been pretty annoying to beat them on a huge map.
A game where there is a single, nest strategy, is a poorly balanced game. It's not that strategy games don't require intelligence, it's that some don't because they are badly coded/balanced.
Anyway, I agree with most of what you say. It's far easier to train the ai by giving it goals (e.g. build strong units - maintain disorder as low as possible) than by letting it learn through trial and error.
I also agree that mimicking (if you see your opponent is using lots of units of type X, then it's probably a good idea to use the same kind of units) and adapting(build a kind of unit which is strong at countering X's) are important, but they belong to a more tactical level.
|
|
|  |
 |
|
LDiCesare
|
|
La Ferté sous Jouarre France
Jan 2001 time: 05:20
|
|
But at least, CtP2 has SLIC. Modded ai can compete far better than the out-of-the-box ai. That's probably because the game was rushed out.
AI should provide some modding ability to the players. The problem is goal-driven, choice of strategies, etc. have to be coded at some point, so unless the whole game logic is written in a scripting language (why not), there will always be shortcomings.
|
|
|  |
 |
|
LDiCesare
|
|
La Ferté sous Jouarre France
Jan 2001 time: 05:20
|
|
The ai in Sims or creatures is, unfortunately, quite simple. One has a few basic sensors, and each input must be at a good level, otherwise the creature/sim feels bad. It will learn how to avoid bad feelings. There are very few problems however that these ai's must overcome. In particular, unless the player plays that role, there is no intelligent coordinated action against them. If you leave civ's ai alone, it will do a quite good job of building a civilisation too.
The interesting thing with creatures etc. is that you can by using a few simple rules create a pretty complex simulation. However, evolving a strategy that ways is not something I think possible.
A sim-ai could be:
Goal 1: Do not to starve.
When can that happen? One condition only, if you don't have eaten for a long time.
How to avoid that? Eat.
How to eat? Buy food and cook it.
How to cook? Learn it.
How to buy food? Get money.
How to get money? Get a work.
It's all simple and linear.
A civ-ai has a goal like:
Don't lose control of city X.
When can that happen? Enemy takes it militarily OR enemy bribes it OR enemy asks for it in a treaty OR city revolts due to culture/unhappiness.
That's already a lot of possibilities to account for for something which is really very basic in the civ game.
How to avoid all that? Avoid losing it militarily... Well, defend it with garrison troops is a possibility. Being at peace is another one. Getting rid of all enemies is yet another one. Even the simple garrison thing is harder than it looks because it depends on the opponent, which forces are unknown unless you can spy upon them.
In order to find out simple rules that would lead to simple ai core which could learn how to accomplish individual actions (cook, get food), you'd have to first find out what these rules are for civ, and that's not simple.
|
|
|  |
 |
|
Kuciwalker
|
 |
of Schmooism
Feb 2001 time: 00:20
|
|
quote: Originally posted by LDiCesare
The ai in Sims or creatures is, unfortunately, quite simple. One has a few basic sensors, and each input must be at a good level, otherwise the creature/sim feels bad. It will learn how to avoid bad feelings. There are very few problems however that these ai's must overcome. In particular, unless the player plays that role, there is no intelligent coordinated action against them. If you leave civ's ai alone, it will do a quite good job of building a civilisation too.
The interesting thing with creatures etc. is that you can by using a few simple rules create a pretty complex simulation. However, evolving a strategy that ways is not something I think possible.
A sim-ai could be:
Goal 1: Do not to starve.
When can that happen? One condition only, if you don't have eaten for a long time.
How to avoid that? Eat.
How to eat? Buy food and cook it.
How to cook? Learn it.
How to buy food? Get money.
How to get money? Get a work.
It's all simple and linear. |
Actually, what you're calling the "AI" in the Sims is only the tip of the iceberg. That's simply deciding, in general, what sort of thing to do. It's not too difficult to do. It's after that that it becomes difficult.
In fact, you know what is probably the most complicated part of the Sims AI, the part that uses the most advanced techniques and really applies AI theory?
The pathing algorithm.
Finding a route between two points is the classic AI problem. In fact, it turns out that problems that can be modeled as finding the shortest path between two points is probably the largest category of problems in AI. I can only think of two categories that can't really be represented as that: constraint satisfaction problems and logical calculus. And "deciding what to do next" in the general terms of "eat", "sleep", etc. are definately not any of those.
|
|
|  |
 |
|
Panzeh
|
|
In my experience playing games, there's a sort of slider.
On one side is the heavily scripted AI, the kind found in many FPS games. They can respond to you in no way other than what the script says. This AI is good at what it does, but when you do anything that the developers didn't see, it falls apart.
On the other is the non-scripted 'dynamic' AI, the kind found mostly in wargames. These AIs respond to you, but often in erratic and silly ways. This AI can do everything, but it's very random and has a difficulty forming coherent strategy, making it far weaker than a human.
Most games strike a balance somewhere, with FPSs, a few RTSs, and a couple special-case wargames forming the 'scripted' side, and wargames and a few RTSs forming the 'dynamic' side.
Two wargames are special cases. War in the Pacific is a monster Gary Grigsby wargame that takes a long time to play. The AI has a set plan, and when it stops executing that plan it falls apart quickly. There's also Axis and Allies, a '98 computer port of the board game. The AI had some decent opening moves, but once it got past that it really had no ability do anything useful.
There's an FPS with somewhat 'dynamic' AI, Operation Flashpoint. Its units can work without exact scripting to the 'T'. The AI is excellent fighting at long distances, but loses its effectiveness in close quarters(unlike most FPSs, where it's exactly the opposite).
|
|
|  |
 |
|
LDiCesare
|
|
La Ferté sous Jouarre France
Jan 2001 time: 05:20
|
|
Kuciwalker, pathfinding is AI, but the A* algorithm exists for quite a long while. Even if it's complex, it's well-known and just about every programmer learns it at some stage, so I don't think it's worth calling it difficult or complicated. The only problem with this algorithm is that it is slow, but it's usually pretty easy to correct that by adding intermediary points along a path. Decision-making is what makes a strategy game strategic, and constraint satisfaction is in my opinion the most common problem (sales traveller problem).
Note that A* is the best algorithm but games like chess have been using alpha beta searches for quite a long time and got good results with that too.
Anyway in terms of civ, pathfinding is not that much of a problem. It can if you add constraints like avoiding enemies, but in the Sims, you can just stop when you would collide with someone else and decide of a strategy to go around (f.e. decide to always go around moving obstacles by the right).
Optimisation is definitely a much harder ai problem htan path finding.
|
|
|  |
 |
|
Natalinasmpf
|
|
quote: random deviation is *NOT* going to improve your game, sticking to the plan is the best thing you can do. |
Oh it does....
There are situations where a beeline to Ind Auto does not work. A situation where you are severely crippled and have to fight it out at all times; or a situation where you are hard pressed, or where its impossible to get Ind Auto within the next fifty years but you have say, the Caretakers on your back.
Situations on deciding whether planned or free market is best for sth goal.....
Then what happens after getting Industrial Automation? It gets confused again.
|
|
|  |
All times are GMT. The time now is 05:20. Apolyton Time is 00:20. |
top of page
|
|
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|