FabricMC / yarn

Libre Minecraft mappings, free to use for everyone. No exceptions.
Creative Commons Zero v1.0 Universal
914 stars 376 forks source link

Use "nextSomething" rather than "lastSomething" for interpolated values? #815

Open Runemoro opened 5 years ago

Runemoro commented 5 years ago

Using something and nextSomething for interpolated values would make more sense. The intrepolation is currently:

return MathHelper.lerp(tickDelta, this.lastProgress, this.progress);

where tickDelta is a positive float representing the time since last tick. This means that when the entity was last ticked, the correct value of progress was lastProgress, and it will only become progress on the next tick (which hasn't happened yet).

liach commented 5 years ago

This is like a makeup for fluent fps given Minecraft is a game with low tps (20). At the combination of the tick and frame, the tick already happened (i.e. the progress is already calculated in the tick), but the frame is still showing something between the last tick and this tick. Hence lastSomething and something makes sense to me.

Runemoro commented 5 years ago

To clarify:

                tick delta
                | ------ |
*---------------*---------------*---------------*
                ^        ^      ^
               last    right   next
               tick     now    tick

The issue is that if right now we're in between two ticks and we're interpolating between two values, it would be weird to call the second value something, rather than nextSomething, since that next tick hasn't happened yet.