It's free to join Gamasutra!|Have a question? Want to know who runs this site? Here you go.|Targeting the game development market with your product or service? Get info on advertising here.||For altering your contact information or changing email subscription preferences.
Registered members can log in here.Back to the home page.

Search articles, jobs, buyers guide, and more.

Gamasutra
July 27 2007

Designing AI Algorithms For Turn-Based Strategy Games

arrowrightPage 1
arrowrightPage 2
arrowrightPage 3


Printer Friendly Version



Sign up for the Gamasutra Daily Newsletter!

Asian Studio : Producer (Post Launch Development) [07.04.08]
2K Marin : Animator [07.04.08]
Other Ocean Interactive : Producer [07.04.08]
Other Ocean Interactive : Programmer [07.04.08]
Other Ocean Interactive : Artist [07.04.08]
Other Ocean Interactive : Designer [07.04.08]
Recoil Games : LEAD GRAPHICS PROGRAMMER - Earth No More / Recoil Games [07.04.08]
Carbine : Sr. System Programmer [07.04.08]
Team Bondi Pty, Ltd : Lead Animator [07.04.08]
Rockstar San Diego : Physics Programmer [07.03.08]
Big Tree Games : Art Director [07.03.08]
Relic Entertainment : SENIOR DESIGNER [07.03.08]
Big Huge Games : Art Producer [07.03.08]
TimeGate Studios : Lead Software Engineer [07.03.08]
Activision : Publicist / Corporate Communications [07.03.08]

View All    Post A Job

Post Resume


Upcoming Events:
From Cutting Edge To Cookie Cutter
San Francisco, United States
07.20.08

Architecture & Design World 2008
Chicago, United States
07.21.08

Casual Connect Seattle
Seattle, United States
07.23.08

Christian Game Developers Conference - 7th Annual
Portland, United States
07.24.08

12th International Conference on Computer Games: AI, Animation, Mobile, Educational & Serious Games
Louisville, United States
07.30.08

Submit Event

View All


Designing AI Algorithms For Turn-Based Strategy Games

(Page 1/3)
Next arrow


In action games the AI opponent always has the natural advantage: perfect accuracy and lightning fast reflexes, so the challenge in designing the AI for those games is making it act more human and to be beatable.

In turn-based strategy games the tables are turned. Speed and accuracy are no longer important factors and the cunning and intuition of the human player will easily out match any AI opponent. In fact, it's nearly impossible to design a AI that can beat an experienced player, but that is not really the point anyway.

The challenge is to make the AI's attack and defense strategy to appear intelligent and thought out, providing a challenge but letting the player win in the end. Once the player has familiarized himself/herself with the tactics of the AI the game rapidly gets boring, so a certain amount of unpredictability is desirable.

Challenges Involved: Looking At A Typical Strategy Game

The AI design problem is easiest understood by taking a real life example, in this case we take a space based war game.

Our example is what's called a 4X game, where you must expand and dominate the galaxy. Each player has war ships and colony ships and starts with a home planet and can colonize habitable planets.

A first attempt at writing the AI would be a simple algorithm to assign orders to each resource (i.e. a planet, or ship), starting with the most important first. Defending planets with production queues has the highest priority, because they are the most valuable.

The next highest, is defending colonies without production queues, then attacking enemy home planets, then colonizing habitable planets, then attacking enemy ships, then repairing damaged ships and lastly exploring uncharted territory. So, we take the highest priority task first, and check for any enemy ships that are close to our colonies.

As you can see in the image above enemy frigates X & Y threaten both the AI's home world and colony. So, we find the closest warships and assign them to attack. You might see here the flaw here in our algorithm. If by chance, frigate Y is handled first, destroyer A will be assigned because it's the closest. Then, when Frigate X is processed, the only ship left to attack is destroyer B, which is too far away to reach it and Frigate X succeeds in bombing our home planet. It's obvious that Destroyer B should be assigned to Frigate Y and Destroyer A to Frigate X.

Also, other problems can occur with this simple algorithm. Have a look at a more complex scenario:

In this new scenario we have Destroyer A badly damaged from a previous attack. It would be a futile sacrifice sending it into battle again. It's wiser to send it back to the home planet for repair. So, that leaves Destroyers C and B to defend our colonies. But destroyer C is too far away to reach frigate Y in time and would be better served to bomb the enemy colony, seeing as it's so close (not to mention, that fuel conversation is important too). Meanwhile, the AI colonizer is armed, and could be diverted from its primary colonization mission.


(Page 1/3)
Next arrow






join | contact us | advertise | write | my profile
news | features | contract work | jobs | resumes | education | product guide | store