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

Let's say I am in a battle with four trolls, and I have the highest initiative, so I attack first. Should I randomly choose a troll to attack? Proximity to each troll does not matter (it is not a factor in the algorithm). I remember playing an older RPG (I think one of the Final Fantasy games on N64), and the attacks appeared random. You might have one troll that never gets hit, or you might have one that always gets hit. Is there an acceptable standard?

share|improve this question
What's wrong with letting the user select which one to attack? – Tetrad Mar 28 '11 at 4:15
Nothing. That is an option as well :) – Brian Reindel Mar 28 '11 at 4:19
There were no Final Fantasy games on the N64... but for the most part, most of the early Nintendo ones (outside of the first) resolved to random choice. Enemies didn't really have a row or priority system like the party had, so random choice just went to any old target. – Grace Note Mar 28 '11 at 18:44
It might have been Super Nintendo (that was so long ago :)... all I remember is my friend being so pissed that it appeared so random after he made an attack. That might be an indicator that if a player can choose, then that would make it more fun. – Brian Reindel Mar 30 '11 at 15:36
up vote 7 down vote accepted

If you don't have a good reason for otherwise, then the player always chooses.

share|improve this answer
Let the players choose, its a game not a cutscene :) – James Mar 28 '11 at 17:26
-1 That's a gameplay design matter, that doesn't answer the OP's question, just tells him not to make a decision he probably has already thought of and concluded that it's best for his specific game. Maybe he needs some sort of an "aggressive" mode where the player character automatically attacks enemies in sight? – Zaky German Mar 28 '11 at 19:44

The biggest troll or the most dangerous one.

share|improve this answer
... which is true since RPG is the best game genre; all others are so unrealistic. – Jonas Byström Mar 28 '11 at 9:20

You could solve an equation to see which strategy is the best.

There are 4 trolls and they all are different. Each one does N damage per second and takes T time to kill. In said example you have 24 possible killing sequences (1-2-3-4, 1-2-4-3, 1-3-4-2, etc..) you can estimate/compute all of them in under 1ms and choose/suggest the best strategy for the player.

Of course it would be nice if player could choose any one he likes to be killed first instead :)

share|improve this answer

From a realistic-y type PoV:

The heroes aren't really going to know 'oh look, this troll is the most damaged' or 'this one is the largest threat' too much. Mostly since they'll be avoiding getting hit. They're going to attack whatever is closest to them. As such, I would say in the situation like this (H for Hero, E for Enemy)


H1 E2

H2 E3
E4 H3


H1 will go for E2, H2 for E3, H3 for E4.

The other option is totally random, or let the player choose. It's probably easiest to let the player choose to avoid 'whoops, accidentally didn't kill the boss who had 3hp left oh look I am dead'.

share|improve this answer

There are a bunch of different ways to solve this problem, as others have said. This ranges from a completely random choice to completely player chosen.

One game that has the style of semi-randomness that you were talking about was Ogre Battle 64. All attacks were done without player choice, but you could direct how you wanted your squad to act. The options were autonomous (pretty much completely random), target weakest (try to kill the enemy with the weakest health), target strongest (slowly weaken the opposing squad), or target leader (without a leader, the squad tries to run back to their base).

The kind of system you want depends on the kind of game you are making. The typical Final Fantasy game is not based around large scale strategy, but are more based on the individual tactics of a single fight; allowing for almost complete player choice tends to be the best bet for this style. In a squad based game, like Ogre Battle, you may want to make the player focus more on the strategy, such as where the squads are placed on the map, or which enemies to kill or weaken first.

share|improve this answer

Depends on how smart you want the decision to be, which is a gameplay design decision - do i want a fluid gameplay where your AI party members automatically pick the correct things to hit on the head so that the player can just do his thing and keep hacking and slashing without being interrupted, or do i want "dumb" party members so that the player has to use his head and make all strategical decisions (maybe even after pausing the game)?

In Dragon Age (might have been done before so don't kill me) for example they've let the player pre-script the behavior of his party members and tell them how to "automatically" make that decision (and others as well).

About the AI picking which one to start striking first - are they all identical and distance doesn't matter? In that case i don't see why not pick a random one. Otherwise some things to take into consideration are which one would be the fastest to kill (least armored, smallest health buffer, already damaged)? Which one deals the most damage? Which one has an ability to heal it's allies? Which one has misc abilities that might be a threat - such as temporary disabling your friendly characters and debuffing them. Based on those and other factors you should make some sort of a score system, you check which troll gets the highest score, and this one gets attacked first.

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.