Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

How to manage different speed of actions in RogueLike games?

What I mean is that turn based games may have actors acting at different "speed", depending on the action and some other characteristics. The actors then effectively do more actions/turns than others if they have greater speed, or not.

How to determine when an actor should be able to act (turn scheduling?)?

It looks like there is different ways to do it? Can you explain some with algorithms?

share|improve this question
I have a feeling that if you described out in detail the features that you want, an algorithm will become obvious. –  Tetrad May 15 '12 at 16:29
As Tetrad said, plus what do you mean by "speed of actions"? Roguelikes are typically turn-based so I can't see how this could apply to them. –  Laurent Couvidou May 15 '12 at 17:44
Even in turn based games, some entities will move faster or slower then others, having more or less turns compared to the others. I fixed the question. –  Klaim May 16 '12 at 1:56
@Patrick Hughes Nethack, one of the oldest and most popular roguelikes, has a very important speed attribute. nethackwiki.com/wiki/Speed –  Harry Stern May 16 '12 at 17:50
@HarryStern I've been playing poorly all this time? That might explain a few things... =) –  Patrick Hughes May 16 '12 at 17:52

4 Answers 4

up vote 6 down vote accepted

In my roguelike game Tyrant I used a system of action points and speed ratings.


  • Most actions had a AP cost of 100
  • Most creatures have a speed of 100

Then the game loop would go as follows.

  • Hero takes an action.
  • Elapsed time is calculated as hero action AP cost * 100 / hero speed
  • All creatures get given APs equal to creature speed * elapsed time / 100
  • Creatures take actions and have APs subtracted until their APs are <= 0
  • Repeat

This system worked very nicely overall, example nice features:

  • If you have a very fast hero (perhaps due to a magic speed bonus), you can get several moves in before an individual creature can move (it's APs would be negative for a few turns because the elapsed time would be small)
  • You can make some actions more or less expensive by varying the AP cost
  • You can delay creatures by subtracting APs, or give them a sudden one-off boost by adding APs
share|improve this answer

Action points. Give each entity a "speed" so that faster actors get more points each turn. Make each action take a specific number of points to complete, and subtract that number from the player's points for that turn when he takes an action. If an action takes more points than the player has left, mark it as "partially completed", and let him finish it next turn.

share|improve this answer

Do you mean having actions take multiple turns (i.e., sleeping for 50 turns straight)?

What I would do is keep an object, player.currentAction. currentAction might contain how many turns the action would require, what the resolution of the action is, and a list of states that cancel the action (in danger, being attacked, too hot, etc). Each turn, before we checked for player input, we would check to see if the player was currently in the middle of an action, then do something like something like...

 if(player.currentAction.complete() == true)
    player.currentAction.doAction(); //Some actions, like casting a spell, would have something happen here. Others, like sleeping, may or may not, depending on how you coded it.
    player.currentAction = null;
else player.currentAction.decreaseTimer(); //Decrease our timer by one.
 player.currentAction.interrupt(); //Let the player know he's been interrupted. Bungle the spell, cancel sleep, etc.
 player.currentAction = null;
share|improve this answer

You can go with action points but no turns per se but ticks, which are much smaller. Suppose every actor has action point accumulation speed (e.g. 2 AP per tick). It starts an action worth, say, 10 AP. The game advances 5 ticks forward (because this is how much it takes for the actor to pay action's AP price).

When there are several actors. The game advances tick by tick until somebody has payed AP price at wich point this action is executed.

The approach is similar to @mikera's, only there are no negative APs.

share|improve this answer
This is far messier, as you need to store the "intended" action of the creature. Some actions depend on state that may change before the mob has accumulated enough points. –  Warwick Allison May 19 '12 at 21:39
Maybe it's not perfect, but it reflects real life, when you decide to hit, you first swing and then hit - so it's decision-preparation-action, which is what this system allows. Also this allows to choose block action based on actual situation. –  zzandy May 22 '12 at 9:13

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.