4
\$\begingroup\$

I've implemented a game loop similar to that in Glenn Fiedler's Fix Your Timestep! article. I have an update step running at 50Hz and a render step running at 60Hz (monitor refresh rate). To keep things smooth, the update step produces snapshots that the render step can interpolate between with a constant latency of 20ms. These snapshots contain all the information needed for the rendering step to build skeletons and other transformations, but not anything involving physics, AI, or networking.

Actually interpolating between the snapshots is pretty simple, but something I've forgot about until now is how to deal with renderables being created or destroyed. What would be an elegant method to go about interpolating between snapshots when a renderable may only exist in one of them?

\$\endgroup\$
2
\$\begingroup\$

It's a Great article that Fiedler did.

You don't have to worried about that. The Alpha value you have for interpolating two render states is like an optional info, a hint you have to improve your animation as much as possible, but you don't have to interpolate the 100% of your renderables (visual and animated objects). You first should prioritize most visible and easy to interpolate features like: Camera movement (very important), Characer animations, dynamic objects, particles...

Then precisely with a visible object being "destroyed" it should have solved his way to disappear from your game world a bunch of frames before that particular frame when you decide to destroy it; using a death animation or particle effects. You can even keep it invisible if you need it or morphed|converted to other class|object|entity.

Is the same inverted with an object born|creation.

There are things you don't need or you can't interpolate; like a Boolean (true|false) value. The algorithm try to improve the visual side of your game as smooth and pleasant as possible while keeping consistent game-play logic, so go ahead and good luck with the implementation!

\$\endgroup\$
  • \$\begingroup\$ I guess I was probably trying to overcomplicate it. I'll just make it a rule that the oldest snapshot of the two determines "existence" (if you catch my drift). \$\endgroup\$ – jmegaffin Feb 9 '14 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.