# Tag Info

32

You interpolate when you know the 'before' and 'after' values. For example: in a point-and-click game, player is currently at position X, and from his interface, he clicks on spot Y. You must interpolate the displacement between X and Y because you know the two values. You extrapolate when you guess what's going to be future value, based on what you ...

14

Interpolation is done when you have both a start and end value, and you want to estimate what happens between this start and end value. An example would be to move a player from Position A to Position B in a fluid motion. Extrapolation, is done when you have a start value, but do not yet have data for the end. You can then extrapolate based on what data ...

5

There are two things crucial to get motion appearing smooth, the first is obviously that what you render needs to match the expected state at the time at which the frame is presented to the user, the second is that you need to present frames to the user at a relatively fixed interval. Presenting a frame at T+10ms, then another at T+30ms, then another at T+...

3

What everyone has been telling you is correct. Never update your sprite's simulation position in your render logic. Think of it like this, your sprite has 2 positions; where the simulation says he is as of the last simulation update, and where the sprite is rendered. They are two completely different coordinates. The sprite is rendered at his ...

2

Here is an excellent article on the subject. The final implementation of the game loop here is very clean and clear; double t = 0.0; double dt = 0.01; double currentTime = hires_time_in_seconds(); double accumulator = 0.0; State previous; State current; while ( !quit ) { double newTime = time(); double frameTime = newTime - currentTime; if ( ...

2

I would try to use raycasting. Cast a ray in the direction the ball will be going. If it hits any kind of obstacle, then reflect this vector along the hitpoint's normal. Cast a new ray int he reflected direction . Repeat until the ball hits the "goal zone". In the end the last hitpoint's coordinates give where you paddle should be. This should be quite ...

2

You interpolate to find states between known values, and you extrapolate to find future states. Think of the problem in terms of state variables, like positions and velocities. In the best of all scenarios, every computer which needs to work with state has access to the state data for the time they want to work on. For example, a collision algorithm to ...

2

Always interpolate when you can. When you don't have enough information to interpolate then you need to extrapolate. It really is that simple, don't over-think it :) To explain a bit more: In general interpolation is better because interpolation is always right. To extrapolate you have to guess. Then you have to deal with what happens when you guess ...

1

Interpolation is using known data to calculate a datum within the bounds of the data set (inter- being the 'inside' prefix). Extrapolation is calculating a datum outside the bounds of the existing data (extra- being the 'outside' prefix). Both are used to synthesize additional data, with the exact method of calculation defining the expected reliability of ...

1

current_position = starting_position + ((lag_delay + time_elapsed ) * velocity) Where "time elapsed" is how long we've known about the bullet existence. Ostensibly this doesn't need to be stored, as when the bullet is created client-side, it is 0, and afterwards we update its position every frame update. The lag delay is merely just an extra bit of ...

1

Latency, the #1 enemy of networked games. So, your problem is, that you don't know if packet loss happened or packet is late and thus you might receive packet, that should be discarded. You have to timestamp your packets or use incrementing id that is sent with packet, that helps you to identify packets that should not be cared anymore. If you use id for ...

1

I can't post a comment yet, so I will post this as an answer. If I understand the problem correctly, it goes something like this: first you have a collision then the object's position is corrected (presumably by the collision detection routine) the object's updated position is sent to the render function the render function then updates the object's ...

Only top voted, non community-wiki answers of a minimum length are eligible