Unit animations

Unit animations receiving an overhaul. According to new rendering engine, everything should change from fixed-step to floating-step.

In older days render was running at 10 frames per second and there was no interpolation between frames. Now with 3D the render is uncapped and can run at any rate (e.g. on my developer machine it runs at 60-90fps).

From players standpoint that means that everything is becoming much smoother. It’s hard to describe, but once you’ve seen it – older method looks like a slide-show.

From programming standpoint that means a bit more:

  • A whole lot of trouble with units movements prediction. We try to predict where unit will be in next tick and render it at interpolated position and animation according to elapsed time since last tick. Either that or delaying the render by 1 game tick and rendering state that is 1 tick old, which is simpler, but adds 100ms lag to the game.
  • Interpolation between animation frames. Skeletal animation is still a frame-based concept. Bones animation are rigged by keyframes, which then get converted to frame-by-frame bones positions at specified rate. In our case that’s 40fps. Later in the game rendering engine calculates desired animation step which then should be used to interpolate between two bones positions frames produced earlier. Interpolation is planned but yet postponed, because choosing nearest frame from 40 is working out good enough for now.
  • We still measure unit actions in game ticks, but now we can tweak actions lengths and interpolate animations lengths to that. That means we need to decouple these two lengths – which is another round of refactoring.
  • Still vs Animated actions. It was okay before, to freeze units in place at some frame and let them stay for minutes. Now with smooth animations and 3D this trick won’t work that well. Units will need idle animations.

There might be some more issues, but these are the biggest for now.

This entry was posted in Sidenotes. Bookmark the permalink.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.