Doing a passable 4X game AI

Posted by Extrakun on Game Development See other posts from Game Development or by Extrakun
Published on 2012-04-03T15:02:13Z Indexed on 2012/04/03 17:44 UTC
Read the original article Hit count: 308

Filed under:

I am coding a rather "simple" 4X game (if a 4X game can be simple). It's indie in scope, and I am wondering if there's anyway to come up with a passable AI without having me spending months coding on it.

The game has three major decision making portions; spending of production points, spending of movement points and spending of tech points (basically there are 3 different 'currency', currency unspent at end of turn is not saved)

  • Spend Production Points
    • Upgrade a planet (increase its tech and production)
    • Build ships (3 types)
  • Move ships from planets to planets (costing Movement Points)
    • Move to attack
    • Move to fortify
  • Research Tech (can partially research a tech i.e, as in Master of Orion)

The plan for me right now is a brute force approach. There are basically 4 broad options for the player -

  1. Upgrade planet(s) to its his production and tech output

  2. Conquer as many planets as possible

  3. Secure as many planets as possible

  4. Get to a certain tech as soon as possible

For each decision, I will iterate through the possible options and come up with a score; and then the AI will choose the decision with the highest score. Right now I have no idea how to 'mix decisions'. That is, for example, the AI wishes to upgrade and conquer planets at the same time. I suppose I can have another logic which do a brute force optimization on a combination of those 4 decisions....

At least, that's my plan if I can't think of anything better. Is there any faster way to make a passable AI? I don't need a very good one, to rival Deep Blue or such, just something that has the illusion of intelligence.

This is my first time doing an AI on this scale, so I dare not try something too grand too. So far I have experiences with FSM, DFS, BFS and A*

© Game Development or respective owner

Related posts about ai