1
\$\begingroup\$

The title says it all, but let me build more into the question:

I suppose everyone by now knows the Fix Your Timestep article, and its proposal to free your physics engine steps from your rendering steps. Which you can accomplish by accumulating time generated by the renderer and consuming it in fixed step sizes.

The interesting part is that Glenn Fiedler tells you to interpolate the previous and the current frame, which lead me to the following question:

Doing such will make the rendering lag one frame behind the physics. Won't that affect my input responsiveness? Since I'll take one more frame to see the results of my actions.

One may be inclined to say that one frame doesn't make that much of a difference, but then, these three articles of Mick West, one of the founders of Activision and former programmer of "Tony Hawk's Pro Skater" series says otherwise:

  1. Pushing Buttons
  2. Measuring Responsiveness in Games
  3. Programming Responsiveness

So again, the question: Interpolating the previous and current frame, will make me lag one frame behind. Will that hurt my input responsiveness?

\$\endgroup\$
  • \$\begingroup\$ Yeah it totally will. You can try and hide it through predictive animations and other things, but that's all smoke and mirrors. It will affect responsiveness definitely. How bad it is depends on your frame rate of course. It also depends on the needs of your game. A twitch game like quake would show the problem very clearly while in a typical rts, it wouldn't be noticeable. \$\endgroup\$ – Alan Wolfe Jul 13 '15 at 5:38
  • 1
    \$\begingroup\$ I've implemented this interpolation in my game and with 60 fps lag is imperceptible (at least for me). Do you really believe your players will notice one-frame input lag but won't notice continuous stutter without interpolation? \$\endgroup\$ – nikoliazekter Jul 13 '15 at 11:50
  • 1
    \$\begingroup\$ At 60fps, the latency is 16ms which is quite good. If you have lower frame rate and/or are making a hardcore twitch game it can totally matter. Like you say though, it probably won't matter because it doesn't for most games. \$\endgroup\$ – Alan Wolfe Jul 13 '15 at 16:03
0
\$\begingroup\$

Converting comment to answer:

Yeah it totally will. You can try and hide it through predictive animations and other things, but that's all smoke and mirrors. It will affect responsiveness definitely. How bad it is depends on your frame rate of course. It also depends on the needs of your game. A twitch game like quake would show the problem very clearly while in a typical rts, it wouldn't be noticeable.

\$\endgroup\$
0
\$\begingroup\$

After some time and research, I got to know that you actually lose only one physics step, and not a whole game frame.

And if you're updating your physics at a high rate (you should update it at least two times faster than the expected frame rate!), then it will probably go unnoticeable.

In my game I'm using a 0.008s (125fps) physics step and can't barely notice the lost step due to interpolation, but if I turn the interpolation off, then I immediately notice the stuttering.

I went for 0.008s step because I found it a good value to avoid rounding errors (which happens on 0.0083333s for 120fps), which helps a lot to keep stability between runs in different architectures.

EDIT: Since PCs use a IEEE 754 representation of floating numbers, 128fps seems to be a sweet spot, since it's:

  1. Divisible by two (giving less precision errors)
  2. At least two times higher than 60fps (which should be most people rendering frequency)

Consider using this value.

\$\endgroup\$
  • \$\begingroup\$ You're mentioning values that are evenly divisible in a decimal number system, but your engine is going to be using IEEE 754 floating point, which is a binary representation, not decimal. I imagine the value 125 gives you better stability because it is a higher number, not because it evenly divides. If you think even numbers are going to give better results, I recommend trying 128fps instead. \$\endgroup\$ – Merlyn Morgan-Graham Oct 18 '16 at 0:39
  • \$\begingroup\$ You're damn right! I figured it out some time later, but didn't remember to update the post. Gonna make an edit for future readers \$\endgroup\$ – Gustavo Maciel Oct 21 '16 at 20:54

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.