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?

  • 7
    \$\begingroup\$ I have a feeling that if you described out in detail the features that you want, an algorithm will become obvious. \$\endgroup\$
    – Tetrad
    Commented May 15, 2012 at 16:29
  • \$\begingroup\$ 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. \$\endgroup\$ Commented May 15, 2012 at 17:44
  • 2
    \$\begingroup\$ 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. \$\endgroup\$
    – Klaim
    Commented May 16, 2012 at 1:56
  • 3
    \$\begingroup\$ @Patrick Hughes Nethack, one of the oldest and most popular roguelikes, has a very important speed attribute. nethackwiki.com/wiki/Speed \$\endgroup\$ Commented May 16, 2012 at 17:50
  • 1
    \$\begingroup\$ @HarryStern I've been playing poorly all this time? That might explain a few things... =) \$\endgroup\$ Commented May 16, 2012 at 17:52

5 Answers 5


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
  • \$\begingroup\$ Trying to wrap my head around this. If you have 1 player and 4 players. Doesnt this make the last player stack elapse time more and more. Allowing him to take maybe 4 actions and the second time around 8 in a row ?? \$\endgroup\$ Commented Feb 18, 2015 at 16:06
  • \$\begingroup\$ In the case of multiple human players, you probably want to keep track of APs for each, and make the time increment enough to make the next player ready to act (i.e. whichever player has max APs, make a time increment enough to bring their APs to >0). \$\endgroup\$
    – mikera
    Commented Apr 21, 2021 at 1:59

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.


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;

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.

  • \$\begingroup\$ 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. \$\endgroup\$ Commented May 19, 2012 at 21:39
  • \$\begingroup\$ 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. \$\endgroup\$
    – zzandy
    Commented May 22, 2012 at 9:13
  • \$\begingroup\$ I prefer going the other direction: mob picks an action with cost of n-ticks and then cannot pick a new action until n-ticks elapse. It can be implemented as a single value that is decremented on each tick. \$\endgroup\$
    – kitsu.eb
    Commented Jul 26, 2016 at 15:35

High Resolution Time

If punch takes 400 turns, and kick takes 1000 turns, I can punch you at least twice before you kick me, and I can punch you 5 times by the time you kick me twice.

By making things take lots of turns, you have a lot of control over how long things take.


You must log in to answer this question.

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