Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am creating a board game using Actionscript 3.0. I've finished it to the point of the game playable with (computer players making random decision). I'm now working to create an AI framework/module ( Designing and creating classes that will be used to drive the AI). Is there a commonly/popular approach on creating an AI framework)? I've searhed around abit and could only find algorithms and sample codes. What I'm not looking for game/code specifics but more to thinking process in designing and modeling the AI.

share|improve this question
Related:… – Tetrad Dec 16 '10 at 20:05
up vote 5 down vote accepted

The AI broadly depends of what is it supposed to do. What I mean is that so many kinds of AI exist that it is impossible to just cover them all.

For your specific purpose of a board game (or at least, a perfect information game) you usually use minmax trees and all the possible optimizations starting from there. (eg AB-pruning).

These algorithm can easily be developed as a framework since what you really need are basically 2 functions:

  • a function (game state, player) -> game state list, which computes all the possible moves from a specific state of the game for a player
  • a function (game state, player) -> float which is the kernel of the algorithm. This function is used to evaluate how good is a state for a specific player. This is the heuristic involved, and it is what you will tweak of the whole algorithm to make your AI more cleaver.

One you build the main algorithm (which goes recursively over a tree) you could easily adapt it to whatever board game you like by modifying just the two functions described above.

share|improve this answer

Behavior trees have been growing in popularity lately as a way to partially decouple game logic from AI flow. You will probably want to find a library that implements the basic elements though, it is annoying to write from scratch.

share|improve this answer

I don't think there's a generic approach because AI is not so much a component or a system as a broad classification of algorithms, many of which do entirely different things. There is no standard interface that could be applied to them all, nor a standard representation that could be used across them.

You need to decide exactly which parts of your program require an AI approach (eg. picking a move to make), then select an algorithm that facilitates that (eg. minimax).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.