munificent / game-programming-patterns

Source repo for the book
http://gameprogrammingpatterns.com/
Other
4.12k stars 498 forks source link

"interpolation" -> "extrapolation" #338

Open munificent opened 6 years ago

munificent commented 6 years ago

From a reader:

In the page about game loop you talk about interpolation, and you say a problem there is is that because it is a guess of the position of the objects, it might be a bit off, we don't really know where the object is gonna be. Maybe it'll be stopped by a wall or something

The error here is that this would be extrapolation rather than interpolation. If instead of interpolating/extrapolating between the last physics update and the next one, we interpolated between the second last update and the last update (both of which have been done and completed - so we don't need to guess anything) objects will never go through walls, or anything like that. There'd be no need to guess :D