I'm planning to make a turn-based fleet battle game. While I think I can figure out most of the things I need, I have no idea about the AI handling this sort of game. I need some general direction about how should I deal with it.

None of the things I described below is currently done - except maybe unit movement stuffs.

The combat resembles Frozen Synapse or Steambirds, in which you and your opponent plan their unit's actions and then execute it to see how it resolves. Since the units are naval warships, their movement is restricted by current direction and speed, etc etc. They attack when you order them to do so(not automatic).

I think I can give scores to each move(like Chess AI), depending on its location, direction, possible movement area, known enemy positions and things like that. Then I can use Minimax algorithm to let the AI select the best move.

Now, I'm asking because I can't figure out

  1. which situation should the score be based on. Should the AI make a plan assuming the enemies are all moving straight, predict the best enemy plan based on it, and then write the actual plan based on the prediction? Is it going to demand a lot of processing power? Or is there simpler way using Minimax?

  2. Unlike grid-based tactical games, the area which a unit can move is a (semi-)continual area. If I try to give score to all possible positions, that might take too much processing power. Is there a way to handle this issue neatly?

  3. There might be more efficient/effective alternatives to the Minimax on this particular game which I do not know.

So... i'm asking for general direction about how should I handle the AI. Details will be in when I actually make it.

  • \$\begingroup\$ Probably worth reading through this question. \$\endgroup\$
    – test
    Oct 19, 2015 at 16:02
  • 1
    \$\begingroup\$ As a tip on question building, you should post links to youtube videos showing what you have in mind, instead of pointing to the game sites, as what you want to explain is either impossible to find, or very hard to find on the games websites. \$\endgroup\$
    – Vaillancourt
    Oct 19, 2015 at 16:08
  • \$\begingroup\$ Grr, thanks. Will do when the computer is available again. \$\endgroup\$
    – Aron0621
    Oct 19, 2015 at 16:12
  • \$\begingroup\$ Also please break question up so only one question at a time. \$\endgroup\$
    – Steven
    Oct 19, 2015 at 16:15
  • \$\begingroup\$ Edited the post to clearify what is the actual question. Previously confusing. \$\endgroup\$
    – Aron0621
    Oct 20, 2015 at 11:48

1 Answer 1


When the game is parallel turn-based, you can calculate your moves while the player is making theirs. This gives your AI quite a lot of time. So performance is not that much of a concern as it would be in a real-time game.

In many games it is not actually necessary to plan ahead more than one round. It is often possible to write a passable AI which doesn't. It will certainly be weaker than any moderately experienced player, but you can compensate for that by giving the AI a material advantage in form of more and stronger units. Yes, this is a lazy solution, but it is the solution used by the majority of titles on the market, among them many bestsellers. The expectations of the players are quite low in this regard.

When you decide that you do want to calculate more than one move ahead, the number of calculations increases exponentially. In an average turn-based strategy game, there is a very large number of possible moves each unit can perform per round. So even when your AI has up to a minute per move, this might become too much to handle. You can not assume that the player will set idle, so you have to also calculate the possible moves the player could perform and evaluate them like you evaluate those of the AI. This creates a really, really broad game-tree, which means some alpha-beta pruning will be necessary.

You can easily do that by reducing the moves you evaluate down to those which fulfill some tactical objective. First, check which tactical objectives are available for each unit. Which objectives are worth considering depends on your game mechanics, but it could be things like "rush enemy unit A", "snipe enemy unit A", "secure objective A" or "protect self". Take the one most obvious move to fulfill each objective, and use these moves as possible candidates by calculating the strategic value of each.

A completely different approach is to not focus on creating a strategically smart AI, but rather one which has units act impulsive like you would expect people to act in a real-time environment. Have units only react on what they can see and make them do decisions depending on a state machine governed by emotions like "anger" or "fear", not on what would be the decision with the strategically best outcome. The result will be an AI which will definitely be far too weak to stand any chance against a player when put on equal terms, but one which will be quite enjoyable to play against when a small number of player units is put against an overwhelming enemy force.

  • \$\begingroup\$ A quick question: if I understood it correctly, you mention at the beginning that while one player is making a move, the game can calculate the move of other players. However, while I can see that working for the high-level decision making (e.g. goals), I got confused by how would it be with the low-level (e.g. unit position). Suppose 4 AI controlled players. While AI-1 is making its moves, if AI-4 is already calculating low-level decisions, that could be waste of CPU time because it will have to update again after AI-2 and AI-3 make their moves. \$\endgroup\$
    – MAnd
    Oct 20, 2015 at 3:38
  • \$\begingroup\$ @MAnd when I am talking about a "player" in the above answer I am talking about a human player. When I understood you correctly, in your game every side - human or AI - makes their moves independently without knowing what the others are doing. So the parallelism is inherent in the system. When you want the AI's to cooperate by taking each others decisions into account, it would be most useful to have them decide on their moves one after another so the later AIs can take the actions of the previous ones into account when evaluating their own moves. \$\endgroup\$
    – Philipp
    Oct 20, 2015 at 7:56
  • \$\begingroup\$ Pruning based on goals... I'll keep that in mind. So, it would be two AIs, one analyzes the battlefield and assign orders(Admiral AI) and the other sets the each ships' move to complete the task. \$\endgroup\$
    – Aron0621
    Oct 20, 2015 at 10:17
  • \$\begingroup\$ @Philipp I am not the OP :). Actually, I though the turn-based structure meant the OP looked for AI decisions one after each other. But I see what you mean. My concern with the parallel approach here is the following. It makes sense the AI-players take decisions in parallel because they do not know what the others are doing. However, when they happen to see what any other is doing (e.g. an AI-2 enemy unit coming close to AI-4 player's cities), then AI-$ will have to re-updated all over again. But still, that will only happen when AIs get in touch. \$\endgroup\$
    – MAnd
    Oct 20, 2015 at 17:57
  • \$\begingroup\$ @MAnd The move of the turn is already set before the 'initiating phase' begins. Spotting new units won't change it, and AIs will consider them in subsequent turns. \$\endgroup\$
    – Aron0621
    Oct 21, 2015 at 14:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .