Advertisement

RTS AI help

Started by February 23, 2007 09:24 PM
14 comments, last by Jurney 17 years, 8 months ago
Hi, I'm writing my first RTS, and I'm looking for some starting pointers on how to go about implementing the computer-player AI. So far I have basic behaviours such as path finding, obstical avoidance, formation movement, finding&gathering resources, etc. implemented, but I don't know what kind of approaches to use to do the overall planning for the computer player. I'd be hoping for something better than this: if (not enough attacking units) gather resources; build units; else send all units to nearest enemy base. (and hope they destroy everything) Thanks!
I've been part of a couple threads answering this. Have a looksee:

http://www.gamedev.net/community/forums/topic.asp?topic_id=329005

http://www.gamedev.net/community/forums/topic.asp?topic_id=415522

http://www.gamedev.net/community/forums/topic.asp?topic_id=420275&whichpage=1�

I just skimmed them for relevance. The 3rd one may not be relevant, but also may be.... =)

Do some more searching on the site. I know there's an article or two that were the seeds of some of my ideas for the high level RTS AIs I've written.

-me
Advertisement
Thanks for those links, Influence maps seem like they could be quite usefull and easy to implement, but I'm still not sure how you can use them in a conrete fashion.

Googling, I saw one vauge reference suggesting to simply link the influence maps as inputs and the behvaiours as outputs with a neural network and train it from player vs player matches.

Has anyone tried this before, would such a simple approach really work? I like this idea as the nnet would always be able to learn from the player...
A neural net is almost definitely not what you want to be thinking of. The influence map is just a summary overview of the battlefield. You just use that to quickly see the properties of a given area.
Yeah, a neural net would be a really bad idea IMHO. what are the inputs, what are the outputs, how would you construct it, train it, etc. I'd stick with a straight up heuristic approach if you want good, fun results.

-me
There's a book I thought was very good on the subject, AI Game Engine Programming. It has some decent material on influence maps, fuzzy state machines, and many AI topics. After reading through it I was inspired to write RTS AI.
Advertisement
Quote:
if (not enough attacking units)
gather resources;
build units;
else
send all units to nearest enemy base. (and hope they destroy everything)


I don't think there will be anything better in RTS, it will just have to be more complicated. Suppose that your units are capable of basic actions autonomously, such as attacking, retreat, defense when disturbed, resource gathering...
Then you would be able to control them and buildings with goal driven agent, which will internally handle groups of units and issue commands to them. Goals have to be decomposed from "Destroy enemy" to "Build army", "Attack base", "Explore map". Those have to be decomposed further, until finished on elementary level, such as "Move to enemy base" or "Wait until regroup" which is directly transferable to command sequence for units.
Goal driven agent has advantage in easy maintenance and you can easily add special strategies, such as "Destroy enemy workers", or retreating when enemy is stronger

Machine learning is plausible for developing the A.I. to something other than "dumb", but not NN's specifically.

An actor/critical learning model where given some generalized state, the possible actions are given learned weights is a possibility.

I envision the state being something akin to a low resolution set of regional relative statistics (relative power, relative tech level, relative income, relative map control, etc) and the actions being regional goals (attack area, defend area, build units, tech up, explore, etc)

But its probably best just to use a rule based system and manualy tweak it..
Quote: Original post by e64
if (not enough attacking units)
gather resources;
build units;
else
send all units to nearest enemy base. (and hope they destroy everything)


Huh
this is pretty much how I play RTS games myself...
(when I used to)
They just never struck me has offering much depth of gameplay other than that.
Maybe thats the root of the problem? Simple games lead to simple strategies?

About the only complicated strategy I can think might show up is, if your game has 'fog of war' visibility, and the AI tries to estimate what portion of the map the player can see and attempts to keep his units hidden.
Quote: Original post by Anonymous Poster
They just never struck me has offering much depth of gameplay other than that.
Maybe thats the root of the problem? Simple games lead to simple strategies?
Maybe you're not playing the right RTS games?

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

This topic is closed to new replies.

Advertisement