Sign in to follow this  

2D Turn-Based Strategy AI Design Question

Recommended Posts

Hello everyone,

I've posted this on the XNA forums as well but I am hoping that someone will be able to provide some insight here too.

I have a question regarding game AI and the best design approach to take. I am currently working on a 2D turn-based strategy game and I trying to figure out the best approach to handling AI on a per-unit basis. For a CPU player, should each individual game unit be responsible for handling its own AI decisions or does it make more sense to have an AI "Director" that handles performing any AI calculations and simply move the game units around as seen fit?

Here is a list of my thoughts so far:
- I'm trying to keep things simple, so I am just having one unit active at one time
- The units should be working together towards a common goal...either capturing objectives on the map or defending
- There will only ever be one CPU player at a time
- Only the CPU units would need AI functionality; Player control units have dumb AI and await human commands.
- AI actions are pretty basic in my mind (I'm sure I'll come up with more later):


- Attack Nearest Enemy Unit
- Attack Weakest Enemy Unit
- Attack Strongest Enemy Unit


- Fortify Position
- Defend Friendly Unit By Attacking Threatening Unit


- Move to objective

Thank you for your time.

Share this post

Link to post
Share on other sites
To answer your question, yes I would be coordinating all the movements for the units that I control. A good example of the type of game I am working on would be an old Nintendo game L'Empereur (made by KOEI, very similar to the Nobunaga's Ambition series as well) but with a medieval fantasy setting. The battle game play would follow in a very similar vein, where there are two players (one human, one computer) that each take a turn moving and attacking with all the units they control on their own turn, one unit at a time. Once I have used up all of the available movements for all of my units, the turn would end and the computer would then iterate through each of its units, one at a time, making the appropriate moves as deemed fit by my AI routines.

Share this post

Link to post
Share on other sites
Short answer: A bit of both might be best.

In strategy games makes more sense to have all the decisions point towards a common goal.

So, if you add independent AI for each unit, it would seem reasonable for the AI at times to consider it's own best interest rather then the interest of the CPU player, for instance, retreating before dying when it's death would produce a better outcome. And this behaviour alone doesn't make much sense.

It would make more sense to have a single AI entity decide what each unit does in order to achieve this common goal.

You might however spice things up a bit. For instance, you might introduce the concept of fearful units that will retreat if they face a particularly scary opponent. This would play out more like a characteristic of that particular unit, rather then an individual decision, and the CPU player would just have to make it's decisions bearing that characteristic in mind.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this