Emergent AI In an Indie RTS Game 146
x4000 writes "My recent RTS game uses a new style of AI that hybridizes rules-based AI with emergent AI logic. As a disclaimer, I'm really not an AI programmer at all — my background is in databases, financial modeling, etc. But it just so happens that database experience, which often involved distilling data points from multiple sources and then combining them into suggested decisions for executives, also makes a great foundation for certain styles of AI. The approach I came up with leans heavily on my database background, and what concepts I am familiar with from reading a bit about AI theory (emergent behavior, fuzzy logic, etc). The results are startlingly good. Total development time on the AI was less than 3 months, and its use of tactics is some of the best in the RTS genre. I'm very open to talking about anything and everything to do with the design I used, as I think it's a viable new approach to AI to explore in games, and I'd like to see other developers potentially carry it even further."
Article summary: (Score:5, Insightful)
"I just wrote a game. Heres some techy stuff to get it posted on slashdot. Yay advertising!"
Like to see.... (Score:5, Insightful)
If you're serious about this, then release it under a Free software license.
Not all that new (Score:5, Insightful)
I seem to remember most all of these things were in (or experimented with) the RTS games I worked on a decade ago - Age of Empires/Kings/Mythology (Decentralized Intelligence, Strategic Tiers, Sub-Commanders, etc). Not all of those were exposed to the end-user via the AI script / expert system / etc, and things improved with each iteration.
I also remember that while some Ai things may have seemed like great ideas, and were neat to implement, they didn't always make for a better game experience.
And I personally say you should make an economic AI that is bound by exactly the same rules as human players, and doesn't cheat at all. And as I remember, the definition of 'doesn't cheat at all' was an occasional ongoing discussion and subtle things that could be considered as cheating, like 'Can I Path from here to there?' or the reactions times of the computer vs a human sometimes had massive implementation ramifications.
A good test in my book was 'can the AI handle a wide range of truly random maps / game worlds.
Humans will always be finding the limits of Computer player AIs, and saying you'll just put in counter code whenever someone tells you of your AI's limits... Hmmm... I think that's weak.
All this has been done before, and all this will be done again.
All the above is solely my opinion and recollections, and in no way speaks for anyone but myself.
Re:Summary useless (Score:2, Insightful)
Even I, 12 years ago at the University, had to implement a miserable little game where the A.I. was at a lower level than an all seeing, all knowing AI that makes decisions, each agent with it's set of "intelligent", adaptive rules.
So... how is this concept new (or NEWSworthy, for that matter)?
Re:Add some flaws. (Score:3, Insightful)
You never beat your Connect 4 game? I used to play such a game on my dinosaur PC in the early 90s. The AI even had a name: Olivetti. It was perfect; it would always win.
Unless you tricked it.
You see, you have to counter his every move, and anticipate the last column that will be left. Eventually it'll be forced to put his chip in the last column, which allows you to win.
Re:Article summary: (Score:4, Insightful)
It is very light on implementation details.
Which is unfortunate, because it's a really interesting topic.
Basically what he says is that he has three levels of AI: strategic, sub-commander and unit. Units look out for themselves, strategic is rule based and sets strategic goals, and sub-commander is the fun part: it makes units work together through flocking.
That's pretty much it. Very interesting, but a bit more meat would have been nice.
The slashvertisement worked, though. I'm very tempted to buy this game to see if the AI is really good, even though I hate RTS games.
Re:Not all that new (Score:3, Insightful)
I agree that the "do not cheat" is a good rule. However, having ten times mire resources for the AI is only cheating if it is hidden. If you have a starwars-esque setting where you are taking on the huge Empire with only a tenth of their resources, it can make for an interesting challenge.
Rebels against the Empire is never going to be a flat playing field. The die-hard do-not-cheat/flat-playing-field position means you start out from the same position, with the same resources, the same information and the same options.
Whether that makes for a fun game is a different matter. It does when the AI is really, really good. So usually it doesn't.
This gentleman says that his AI is often the goliath in a david vs goliath scenario. I suspect that this makes AI far easier : it doesn't care to waste some resources, its strategy is to be overwhelming...
Exactly. It's a different style of play compared to the flat playing-field duel. It's not a fair game anymore, so what counts as cheating and what's simply part of the designed imbalance is very fuzzy.
"Truer" AI suggestion (Score:4, Insightful)
This looks like a similar approach to one I have been thinking about for a while now.
This type of layered control is very likely to be the future of all AI, not just that in games (I say this because there is some evidence that the human brain works in exactly this manner). I have a suggestion: let the thing fight itself. Begin with the same basic game, and rather than the randomness and fuzzy logic that you use (what does that mean? Can we see your algorithms?), use an artificial neural network for each unit, another for each "squad" (all nearby units, allows for flanking and such). Something with a few input nodes, a single hidden layer, and a similar number of output nodes should probably be all that's needed for the units, and the squad AI would only need a few more than that. This would likely be more computationally expensive, but it has one big advantage: it will learn.
Begin with two full armies, each with their NNs randomly generated. Use an evolutionary algorithm, and have the winner fight the winner. Not only does this allow you to create a solid AI with minimal effort (see here [ieee.org]), but when you have your final AI, it will be able to adapt to a specific player's gameplay style (over the course of several games). Replay value is off the charts, development takes a bit more initial effort than what you have, but in the long run you'll get an AI that genuinely uses tactics just like a real human player. I'm not sure how this could be adapted to a commander AI that would dictate broader strategy (due to the complexity of the NN required, you'd probably need a monster computer to run it), but it would be the sort of thing to try.
Also, this same approach would also work for strong AI, if we had any idea what sorts of NNs to create. RTS is a much simpler problem, and has a lot of applications (pathfinding, planning, coordination) to other types of AI.
If I've entirely misunderstood what you're doing here, I'm apologize, but TFA had more pop culture references than technical details. Reply if you want me to clarify any points.
Re:"Truer" AI suggestion (Score:5, Insightful)
NNs have the huge draw back that when you find a situation in which the AI does something completely ridiculous that ruins the game it's really hard to fix especially if you need to ship soon. Your small tweak will likely mess with some other situation. This is more likely in a video game than in a game like checkers since there's more factors at play (interaction with the path finding, etc).
Backgammon is a better example than checkers. TD-Gammon not only plays the game very well, but changed the way people play the game. There were a number of situation where it played differently than the traditional expert recommendation of the best play, and it's play is now the one the experts use.
Some games won't be so great at the "learning by playing against itself" NN approach. Anything in which getting stuck in a loop is reasonable will be problematic since the if the game doesn't end there's no result to learn from. In an RTS, this might be the case where you can build a defensive structure that is effectively impenetrable, neither one is going to win even though it could be the optimal strategy (if not losing is the goal, as opposed to winning).
Re:Like to see.... (Score:1, Insightful)
I am normally a pretty big advocate of Open Source. But for some reason, this comment made me want to punch babies. This guy, and his team, worked hard to create something using their talent and skills. The author of the article spoke at length about the methods he used to attempt to take the AI control of his RTS game in a new direction. And you say that if he is serious about wanting other people to take it further he should just give it to you.
Do you honestly feel that much of a sense of entitlement?
For the first time in a long time I have a greater understanding of the battle between the Open Source movement and the IP Rights defenders. And at the moment I am strongly supporting the rights of the creators, not the 'rights' of the masses.
If you want to further the research into AI using his methods, roll your own code. Best start with some heavy research and lots of education on the topic. At which point you may also be less interested in giving away the fruits of your labor for free.
Re:AI is pattern matching. (Score:3, Insightful)
The human brain is simply a pattern matching engine designed to find the most appropriate response in order to maximize survival.
"simply"?! How can you not be in awe of such a machine? I counter your implied apathetic bias with my own bias of amazement. (^_^)
Re:"Truer" AI suggestion (Score:1, Insightful)
Facing AI with AI using NN's usually ends up in very odd and unrealistic situations. Since you're putting something unintelligent against something unintelligent, they'll end up making unintelligent scenarios and equally unintelligent solutions for those gibberish scenarios.
Re:Like to see.... (Score:3, Insightful)
If you don't want to do that though, that's your choice of course, you wrote the code. But if you wanted to see it implemented in other games, the easiest way would be to give access to the code under a Free license. Either way I don't care too much as I'm not much into computer games.