Contents
Designing AI Algorithms For Turn-Based Strategy Games
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
November 22, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [11]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [12]
 
New Tech, Design Details Of Project Natal To Emerge At Gamefest In February
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
November 22, 2009
 
Sucker Punch Productions
Texture Artist
 
Sucker Punch Productions
3D Environment Artist
 
Sucker Punch Productions
Network Programmer
 
Sucker Punch Productions
Character Artist
 
Sony Online Entertainment
Brand Manager
 
Monolith Productions
Sr. Software Engineer, Engine - Monolith Productions - #113767
 
Crystal Dynamics
Sr. Level Designer
 
Gargantuan Studios
Technical Art Director
spacer
Latest Features
spacer View All spacer
 
November 22, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [6]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [6]
 
arrow iPhone Piracy: The Inside Story [48]
 
arrow And Yet It Grows: Analyzing the Size and Growth of the European Game Market [5]
 
arrow NPD: Behind the Numbers, October 2009 [13]
 
arrow Reflecting On Uncharted 2: How They Did It [5]
 
arrow Sponsored Feature: Rasterization on Larrabee -- Adaptive Rasterization Helps Boost Efficiency
 
arrow Postmortem: Wadjet Eye's The Blackwell Convergence [2]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
November 22, 2009
 
Time Fcuk
 
Accepting the Inherent Value of Games
 
Planckogenesis, Part II: Song Structure & Gravy Train [1]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  Designing AI Algorithms For Turn-Based Strategy Games
by Ed Welch
1 comments
Share RSS
 
 
July 27, 2007 Article Start Previous Page 2 of 3 Next
 

The Solution: The Resource Assignment Algorithm

Assignment Scoring

In order to solve the problems detailed above, firstly we design a scoring system. Each task is assigned a general priority as follows:

Defending our colonies: 1
Attacking enemy colonies: 2
colonizing planets: 3
Attacking enemy ships: 4
Repairing damaged ships: 5
Exploring uncharted territory: 6

Advertisement

Each task also has a priority modifier, for instance the defense task gets a modifier for the value of the colony (colonies with production queues get very high modifier). Likewise, the repair task gets a modifier depending on the amount of damage and the colonize task gets a modifier depending on the "habitability" of the planet.

Finally the distance of the assigned ship is taken into account, as follows:

assignment score = (6 - general priority + modifier) / distance to ship that is assigned

Therefore, in the previous scenario destroyer C would get a higher score for attacking the enemy colony, even though the defense task has a higher priority, just because it was so close to the enemy planet.

Also, the priority modifier of the repair task for Destroyer A is quite high because it's so badly damaged. Coupled with that it is close to a repair queue, and that means that it scores higher than the defense task.

Algorithm Outline

The overall algorithm is broken into 4 parts:


Gathering Tasks

The AI has a list of enemy ships and planets within sensor range, as well as a list of its own assets. Tasks that need to be done are generated as follows:

Object present Task generated
Enemy ship near colony Defend colony task
Enemy ship Attack ship task
Enemy colony Attack planet task
habitable planet Colonize planet task
Damaged ship Repair ship task
Uncharted territory Explore task

Possible Assignments

The other part of the problem is that if we assign tasks in the wrong order the resource utilization will not be optimal. This can be resolved by assigning the tasks in phases. We use two special classes to help us: PossibleAssignment and Task. PossibleAssignment links a potential "task doer" (e.g. a ship) with a task and stores the "assignment score". Task stores the priority, priority modifier and objective.

 
Article Start Previous Page 2 of 3 Next
 
Comments

James O'Neill
profile image
hi, i am currently working on a turnbased stratagy on mobile device. it has all the functionality that i would like apart from the ai aspects for a single player. this is the first ai document i have read that actualy made some sense to me. i would just like to ask a few questions. could you please elaborate on the modifyers for me? can these be completly random or are you calculating them based on the objectives of the game? should they be high or low numbers or does it even matter?

or is it possible to point me in the direction of some reading material that will expand on what you have talked about here.

as you can tell this is the first peice of ai programming i have ever had to do. i have never had a lesson in the subject because my course took me in a diffrent direction. saying this i still have part of my final project in the area so some help would be much appriciated.


none
 
Comment:
 


Submit Comment