Interpolation value in FixedLogicrateGame

I haven’t seen any examples that use this so I’m wondering how the following is used:

float percentWithinTick = Math.min(1.0f, (float)(time1 - time0) / tickTime);
//render scene with interpolation value
render(percentWithinTick);


What does one do with percentWithinTick?

As usual, thanks for any help!

I assume the idea is to multiply movement, animation, etc by the percentoftick variable… so if your character/race car/monster/space ship has a movement speed of say .5, you’d move it .5 * percentoftick. Of course, this might be wrong, as there is an interpolation variable in simplegame that always has a value of -1 as far as I can see…

you should never do logic within the render method. Thats what the update method is there for :slight_smile:



The render(interpolation) just specifies that how long you have for the next rendering frame to be different. I.e. the next update tick. 1 being this is the new tick, and 0.5 is that your half way through. 0 means you still have a full tick to wait before rendering anything new. IIRC…



Ofcourse the idea behind FixedLogicrateGame is to render as fast as possible, and this is what it does. So the interpolation value just specifies when the next "changed" frame will be drawn…i think



DP

That interpolation value that is passed to the renderer is used for a variety of things. But I suppose the most important is for frame rate independence. This value is passed into the animation system, if the value is lower the computer is running faster, thus, the next frame of animation is changed less than a computer that is running slower. The faster computer will show smoother animation (as there will be more frames), but it won’t be a faster animation. That’s one example of using the time per frame value.