Slashdot Mirror


Emergent AI In an Indie RTS Game

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."

13 of 146 comments (clear)

  1. Article summary: by ActionJesus · · Score: 5, Insightful

    "I just wrote a game. Heres some techy stuff to get it posted on slashdot. Yay advertising!"

  2. player mimicry by drDugan · · Score: 5, Interesting

    could you catalog user actions and use them as possible inputs for your AI?
    like this: http://slashdot.org/comments.pl?sid=1165583&cid=27243769

    it would seem this might make for the most challenging AI - one that
    learns and mimics good human players. I have yet to see any games
    that can do this well

  3. Summary useless by toxicbubble · · Score: 5, Informative

    Summary reads like a marketing blurb but the actual article is slightly more interesting. The basic idea is that in an RTS game, the AI is at a unit level rather than an 'almighty all-seeing controller'. It is a fairly interesting idea and does sound sort of different way of thinking about computer RTS opponents. Weather or not this actually makes for a fun game or a good idea remains to be seen, but at least there is something (dare I say) slightly innovative about this.

    1. Re:Summary useless by BikeHelmet · · Score: 4, Interesting

      In short, it segregates the controller AI from the unit AI.

      I can remember when playing SupCom against easy opponents, if I didn't build any defenses, the opponent would stop sending units into my base for a while, instead moving them around in circles somewhere outside it. Even an easy/stupid AI has to make decisions that a stupid person would make. Mainly - CHARGE!

      But at the same time, the best AIs were omniscient. They'd target your first fusion reactor with bombers as soon as you build it... It became so predictable that I'd build a shield, turn it off, build a fusion, then turn the shield back on.

      But in SupCom there were all the modded AIs which chose more interesting tactics, and you could enable cheating for any AI to give them a resource and difficulty boost.

      I think to be realistic, AI has to be segregated even more. You need an Advisor, which decides the direction things should be going. Do we need more resources? Do we have an urgent matter to deal with, like artillery pelting the base? The Advisor should just decide what to tackle, and then pass that on to the other AI subsystems. Like a player, the AI subsystems should take time to do stuff. An AI can't instantly decide what's an entrance to his base. He has to study where the units usually come from, and locate possible landing zones for air transports, etc.

      To ramp up the intelligence, you let it assign more issues to its subordinates more rapidly, and you let it learn across missions. Pretty soon the AI can tackle any frequently played map.

    2. Re:Summary useless by x4000 · · Score: 5, Informative

      Quite valid -- intelligent agents are not a new idea (I'm the dev from the article). However, the vast majority of RTS games are still using decision trees, I guess because the prevailing wisdom is that such is needed because of the complexity of RTS play. Is it so surprising that industry lags behind academia? But, even my approach is not purely an intelligent agent approach, but rather combines in a bit of global logic as well (for reinforcements, choosing global attack targets, etc). I think that a hybridized sort of approach is really needed for RTS games, since they do have so many levels at once.

  4. Like to see.... by Daemonax · · Score: 4, Insightful

    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."

    If you're serious about this, then release it under a Free software license.

    1. Re:Like to see.... by x4000 · · Score: 5, Informative

      I'm not going to release the game for free, given that if I'm to be able to continue to pursue game development it can't continue to be in my hobby time forever. For similar reasons, I'm not going to release the entire code as open source. However, I've already open-sourced a lot of smaller things from my code (force feedback code from my other game, fixed-int math from this game, etc). Also, I've now added a second part to the article which has some partial AI code from the game, and people are free to use the ideas there and build off of them as much as they want. I don't want people to make AI War clones, but rather to think about the ideas that I am presenting and implement them in their own way. The AI War code is not the only way to approach this general design philosophy, not by a long shot. Here's part 2 of the article, with the added code and such: Designing Emergent AI, Part 2: Queries and Code

  5. Not all that new by The+Optimizer · · 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.

  6. Add some flaws. by apodyopsis · · Score: 5, Informative

    I'll ignore the shameless plug.

    Ever since I wrote my first connect 4 game in the 80s - and was totally thrashed by it, I never beat it - its been clear to me that the trick is to degrade a computer player in most circumstances to the level that it appears to have human flaws and play in a more human fashion.

    Of course this logic only goes so far and some games require a search space so vast or a completely different programming model that even now a computer cannot beat a competent real human (Go is an excellent example of this).

    The point is that it is easy to program a computer to win, the hard part is to program is lose convincingly.

    1. Re:Add some flaws. by Anonymous Coward · · Score: 4, Informative

      http://en.wikipedia.org/wiki/Solved_game

      Connect Four

              Solved first by James D. Allen (Oct 1, 1988), and independently by Victor Allis (Oct 16, 1988)[3]. First player can force a win. Strongly solved by John Tromp's 8-ply database[4][5] (Feb 22, 1995). Weakly solved for all boardsizes where width+height is at most 15[3] (Feb 18, 2006).

      Emphasis mine.

  7. Re:All their art is stolen. by Anonymous Coward · · Score: 4, Informative

    I quote "the graphics have been made available under an open license in April 2007" http://en.wikipedia.org/wiki/Tyrian_(computer_game) so how are they stolen?

  8. Superficial Intelligence by Anonymous Coward · · Score: 5, Funny

    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 which blew up the stock market.

  9. Re:"Truer" AI suggestion by nedlohs · · Score: 4, 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).