Animation playback speed

From The DarkMod Wiki
(Redirected from Speed, AI)
Jump to: navigation, search

In TDM, you can change the speed at which an animation plays on an entity just by setting a spawnarg on that entity. The spawnarg to change is anim_rate_X, where X is an animation name. The animation's speed is multiplied by the spawnarg's value; 1.0 means no change, 0.5 means half speed, 2.0 means double speed, and so on.

For example, this spawnarg setting would cause the entity to walk at 95% of the usual speed:

"anim_rate_walk" "0.95"

You can use this to give different walk speeds to individual AIs, or to tweak the walk speed for entire classes of AI.

There is no 'run' property as such but you can make an AI run by adding the property and value run 1 to his path entities.


  • This only changes the animation's speed, not its character. You may not be able to vary e.g. the "purposefulness" of a walk by simply changing its playback speed; it could just look like it's in slow motion, or oddly sped up. Try experimenting to see how much you can get away with.
  • Walk speed is crucial for game balance. It is very difficult to blackjack or backstab an AI that walks faster than the player can move without alerting it! So don't set the walk animation rate too high either.
  • The speed of the walk animation appears to have an effect on how easily AI can climb stairs (and presumably slopes as well). The slower the walk animation is, the lower the stair has to be before the AI will be able to climb it. So don't set the walk animation rate too low. You could also try to work around this using extreme pathfinding. Don't worry about this too much, however, unless your AIs need to traverse unusually steep slopes. Small changes will usually be fine.
  • If the animation itself has a setRate frame command (which accomplishes the same effect as this spawnarg) in the modelDef where it's defined, then the frame command will override this spawnarg. -- note: setRate commands do not appear to work, at least in 2.03.