RTS AI

I have had very little experience in game AI and I’ve been struggling to come up with a good framework for AI for a real-time strategy game.
So far the best I could do would be to have StimulusProducers and Reactors, where a soldier in the game would be a reactor and would know how to handle various stimuli. I envisioned UI actions and orders as being a type of StimulusProducer. It is slightly more complicated than that, but its a little hard to describe everything in my head.

My concern with the above approach is that it would involve too many checks and calculations to generate the stimulus for each soldier, especially if I want to have 500+ units running at the same time.

My goal is to have something that can handle dynamic terrain and to modify the terrain themselves (ie break through glass or doors if they’re in a rush to get through), to be able to find realistic cover, and to behave tactically as squads of troops.

Perhaps these goals are a little far-fetched for the scale I’m interested in, but any ideas, pointers, or links would be much appreciated.

Thanks

Good luck!

Some good AI stuff here.

Make it multiplayer, then you don’t even have to bother with AI!

Multiplayer was going to be a large part, but even then I wanted the soldiers to behave semi-intelligently when pathing around. The tricky thing is that the game is set in an urban environment, so squad behavior is important for troops left alone by the player. I don’t want the ai to do too much for the player, but enough so that the player doesn’t have to micro-manage everything.

@SimonH
The website looked interesting but was a little hard to delve into. When I have more time, I’ll check it out in more detail.

I think it is well possible and not the hardest thing to do. Sure its not easy, but its possible. The problem is knowledge. I’ve read 3 books about game AI and have some ideas how to do it. But you cannot just type it in a few words. So I will rather tell you, there are ways to do this, but you will have to learn a lot about game ai.

The idea is very good alredy. A stimulus, or trigger, or event, influences the soldiers. One important rule is, that the event makes it self known to all objects in the area of effect, and not that all objects query for events in their sourrounding. But I do not see player actions as a stimulus in that way. The player gives rather high level targets, like attack that enemy, move to that position. The AI must break it down into simple actions like fire a shot or move north 1 field.

Dynamic terrain and pathfinding, finding cover, acting as squad, everything is possible and has a lot of solutions.

Try


http://www.gamedev.net/
http://www.aiwisdom.com/

I read the first three editions of AI Game Programming Wisdom, and they cover a lot of such stuff. But they arent exactly cheap. Quite some of the articles are also available freely in the web, but you have to find them.

If you have more specific problems or questions I can maybe give a better help.

-JAW

Sorry about the delay. In the time period between now and my original post, I have done some rethinking of the idea. My concern with the current one is that it doesn’t seem computationally efficient for large groups of soldiers, but here goes the concept:

Instead of stimulus based, it is primarily goal based. Soldiers have some amount of goals, which could include: complete orders, run in fear, attack spotted enemy, etc. The goal would delegate to intermediate classes that would handle fulfilling that goal for a particular type of soldier (ie tactics might change if it had different weapons, etc). Depending on the situation, goals can have multiple soldiers assigned to completing them, in which case the goal would ideally organize them to fulfill it more efficiently. As soldiers interact with the world, stimulus are generated and can then affect soldiers. Incoming stimulus have the ability to be ignored, affect variables such as morale, or turn into a new goal (such as when you give an attack move order and soldiers see an enemy, that stimulus creates a kill X goal, and once complete, the move goal returns into affect).

I haven’t written any code yet since my game isn’t at that stage yet, so this is purely hypothetical.