How do you build the AI for a strategy game (C&C)?

Started by
15 comments, last by techpage 22 years, 3 months ago
Where do you send your units once you''ve built them?

First, you need to identify locations with a high stractegic value. Then you want to capture them. This may include the center of your enemy''s town. I''d build a strategic influence map for this, and look for points with a high local average. Different things add to the strategic influence map, like resources, hills, and chokepoints.

But what''s the best way to attack? From what direction? I''d build an influence map for that (go to http://www.gameai.com and look under Discussions), and find the path with the lowest cost. The more enemy influence, the higher cost. In short, it means get to the mines in the middle of your enemies base but flank the bunkers.

Then you need to know what the enemy is using for offense and what he''s using for defense. A simple FSM, perhaps using certain personality-specific prejudices would be best for this.

Before I mentioned detecting chokepoints. This is very very hard. One way to do it would be to build a traffic map, and find the areas with the highest traffic. Trace outward in circles from the center of each such region to find divisions that span them, blocking traffic. If the division is less than a certain distance long, then it''s a chokepoint and adds to the strategic importance of surrounding terrain.

This last chokepoint-detection thing works fine, but how can you know where to defend before the enemy attacks you there? You need to predict traffic. To do this, simulate expected traffic by finding paths between random points in your half of the map and the enemy''s half.

You need to predict influence in order to do this as well. For this, simply place enemy influence around where you''ve seen him in an expanding fashion, and of course update this when you receive more information from scouts. If you don''t know where the enemy is, expect that he''s in an unexplored region greater than a certain size. Distance from your base may affect this decision as well, since usually in RTS games you''re not put right next to your opponnent.

In short, there are a lot of maps containing values, a lot of use of pathfinding algorithms, and, to be honest, a lot of coding.

You still might find that building tanks as fast as you can and hurling them towards the center of the enemy base works just aas well!!!
Advertisement
On a high-level-implementation note...
Find military books and use their strategies.
I`m not kidding.
Then implement them using whatever algorithim.

See...I really hate C&C/SC/AOE-type games.
The AI is lame...it will simply throw weak units at you, often at uncritical areas....etc...

So you need a scalable-difficulty AI that will attack using military sense.

~V''lion

the bugle4D engine;
a new dimension in graphics...
[link]http://members.tripod.com/thefivelions/bugle4d/[/link]
~V'lionBugle4d
when I was playing Red Alert, one of the RTS games to begin looking at. I noticed that during a Skirmish game the Computer had a huge amount of flamethrowers and so on.

NOw you may say; "But he, that game is already five years old, can you blame them for giving the computer a unfair advantage?"

But I played also a few games of CivIII and I noticed that on the higher levels the computer was able to place a city every 3 turns. That stinks because in that time you dont hav ea city with 3 inhabitants, so they use the same idea although the game is very new.

Can someone give a game that works differently?
I don''t know about Civ III, but in Civ II, you were told about the differences in build formulas for the computer as the play level increased. The amount of food a city needed to expand was lessened was a big one. All you needed to do to verify this was spy on a city and you could see how the food display was different. That''s one change I remember off the cuff. There were others.

This isn''t necessarily a BAD way to change difficulties.

Dave Mark
Intrinsic Algorithm Development

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

are all RTS games use this kind of cheating AI? is any one of them uses honest AI? i mean, what about emperor: battle for dune? what do you guys think? well, i still see the pathfinding isn''t any good, one of the unit can get stuck in the traffic. but what about their tactics and strategies?

do you think the AI in skirmish game is a bit lamer than that in campaign or mission game?
There are not a lot of ways that you can increase the computer''s level of play short of adjusting strengths, build rates, etc. Unless you program in the possibility of the computer making an error in judgement, it will always choose the optimum strategy that it finds - which, of course, is limited by your AI programming. The point being, however, that it will generally choose the same logic from game to game... they are based on the same formula. Therefore, the computer''s ABILITY doesn''t change... the only way you can give it an advantage is to change it''s CAPABILITY through other means.

Dave Mark
Intrinsic Algorithm Development

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

(joking)

Here''s an idea: divide time for AI purposes into descrete intervals (eg, pretend its turn-based but with 1/30th second turns), and use a minmax search algorithm. Predict 30 minutes or so in advance (54000 moves), and your AI will be incredible.

Of course, if every atom in the universe were a Pentium III and they all started calculating at the instant of the Big Bang, calculating even one second wouldn''t be done yet.

So it''s pretty unrealistic.

I like my multiple importance/influence maps though!

This topic is closed to new replies.

Advertisement