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

12 of 146 comments (clear)

  1. 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 malkavian · · Score: 2, Informative

      Diablo series uses heuristics, pure and simple. Each unit has a set behaviour rule, with no adaptive whatsoever.

    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.

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

  3. 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?

  4. Master of Orion by Johnno74 · · Score: 2, Informative

    I have yet to see anything that beats Master of Orion's AI

    But to be fair I've played very few strategy games in the last 10 years, so shoot me down if I'm talking out my arse :)

    In MOO the AI would recognise your tactics, and make moves specifically to counter them. You couldn't keep using a winning strategy.

    A good tactic early in the game was to build a large number (thousands) of tiny cheap ships loaded to the brim with MIRV missiles which would overwhelm the defences of the far larger, well equipped and expensive enemy ships.

    The AI would then counter by building a large number of small defensive ships, and equipping ships with ECM units, displacement devices etc which made missiles ineffective.

    Man that game was good. Perfect blend of simple gameplay and deep strategy. I've never played anything else as good, modern 4x space games all seem to be about micromanagement.

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

    The game isn't online, it's client-server between players. The "host" is just another player.

  6. Re:All their art is stolen. by x4000 · · Score: 2, Informative

    And we give credit to Daniel Cook in exactly the manner he requests. Really awesome of him to provide that sort of art for free, indie games are the better for it.

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

  8. Re:"Truer" AI suggestion by x4000 · · Score: 3, Informative

    This is a really interesting post, and some of it goes a little bit over my head. Like I've said, I'm a database programmer, not an AI programmer. I might experiment with things like neural networks and such in the future, but right now the AI is doing as well as I could possibly hope for. That was a big part of the point of my article: using the fancier techniques is not even always needed for something like an RTS game, because you can get surprisingly good results with comparably little code.

    I'm sure I will experiment around with this more in the future, but I bet you somebody else builds on my approach and does something more impressive before I even can. Anyway, future articles in my aI series will go more in-depth and will also include relevant code snippets to help illustrate my points. Feel free to use and abuse them, and expand away.

    The second article is now up, to appease those hungry for some source code and a bit more of an in-depth discussion on a couple of sub-topics: Designing Emergent AI, Part 2: Queries and Code.

  9. Re:"Truer" AI suggestion by x4000 · · Score: 2, Informative

    Thanks for the added explanation -- and I'm glad you found the second article more interesting. It has only one audience (programmers), which makes it easier to write. The other perhaps has too many target audiences. Switching up the relative weights of the preferences, and having the AI retain information and learn over time, is quite interesting. Beyond the scope of what I can probably accomplish in this game simply because of data size issues and such in a networked game (unless the AI had a permanent local database, and each computer's version of the game would thus have different intelligence). But very interesting, and I suspect I will probably try something more advanced along those lines in the future.