47 votes
Accepted

Why do some networked games use interpolation and some use pathfinding for remote movement?

I've worked on the networking code for two real time AAA networked games, one for smartphones and one for a handheld console. To directly answer your question "why", well, some games use one or the ...
user avatar
  • 13.2k
32 votes

When should I extrapolate and when should I interpolate?

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 ...
user avatar
  • 15.3k
20 votes
Accepted

Why use Time.deltaTime in Lerping functions?

See also this answer. There are two common ways to use Lerp: 1. Linear blending between a start and an end ...
user avatar
  • 112k
14 votes
Accepted

How to handle realtime random movement with client side prediction

You can use random seed. Select same 32-bit value in server and client (or server can send it to client at start). Use it as seed for random generator. You can send actual seed from server to client ...
user avatar
14 votes
Accepted

How do I interpolate around a rectangle?

I'll assume your t goes from 0 to 1. (If not, just multiply to scale it appropriately.) Figure out what proportion (0–1) each side is of the perimeter. (side length / total perimeter) To find how ...
user avatar
  • 13.3k
14 votes

When should I extrapolate and when should I interpolate?

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 ...
user avatar
  • 8,269
10 votes
Accepted

How do I generalise Bresenham's line algorithm to floating-point endpoints?

You are looking for a grid traversal algorithm. This paper gives a good implementation; Here's the basic implementation in 2D found on the paper: ...
user avatar
9 votes

Could frame interpolation like used by SmoothVideo Project be an option to increase the framerate of games without as big a performance hit?

Yes it's possible, but it's not without its complications. While frame interpolation can work real-time on videos, that isn't necessarily the case with video games. Even though this is processing ...
user avatar
  • 72.7k
7 votes

Frameskipping in Android gameloop causing choppy sprites (Open GL ES 2.0)

From what I see, the game loops you are trying to use are somewhat specialized. I don't know why you chose those ones, but in my opinion you are trying to solve problems that don't exist in the first ...
user avatar
  • 13.2k
6 votes
Accepted

How can I make a spline out of three points that define a circular arc?

Let's assume you want a circular arc from point A to point B, guided by control handle H which is the intersection of the tangents at A & B (and thus equidistant from A & B). Circles being ...
user avatar
  • 112k
6 votes
Accepted

Could frame interpolation like used by SmoothVideo Project be an option to increase the framerate of games without as big a performance hit?

A system along these lines has been used in The Force Unleashed. I'm not aware of other titles that have used it though.
user avatar
  • 112k
6 votes

Interpolation using cubic Bezier curves

After playing with this function more. I realise that the bezier control points are acting similar to magnets. If I spread the control points so that they are positioned along a straight line with ...
user avatar
  • 231
5 votes

How do I generalise Bresenham's line algorithm to floating-point endpoints?

Blue's idea is good, but the implementation is a bit clumsy. In fact, you can easily do it without sqrt. Let's assume for the moment that you exclude degenerate cases (...
user avatar
  • 841
5 votes
Accepted

How does interpolation actually work to smooth out an object's movement?

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 ...
user avatar
  • 6,008
5 votes
Accepted

Low quality bilinear sampling in WebGL/OpenGL/DirectX

As luck would have it Iñigo Quilez wrote an article about this which popped up in my Facebook feed this morning. Hardware texture intepolation is fast and convenient. It is bilinear (plus ...
user avatar
  • 112k
5 votes

Interpolation using cubic Bezier curves

I usually solve this using Catmull-Rom splines. Instead of using control points, you simply specify the two points between which you'd like to interpolate, as well as a "previous" point and a "next" ...
user avatar
  • 286
5 votes
Accepted

Resolving prediction error from client side prediction and server reconciliation

I solved the problem on my own. My previous implementation of the networking engine made reconciliation impossible. The code I am using is private, though I plan on open sourcing the Box2D server/...
user avatar
  • 302
5 votes

Why does the kinematic body move in opposite direction after I interpolate its movement, and how do I fix it?

You can't rely on movement.x hitting 0. This is because floating point errors. Instead, check if it is closer to 0 than ...
user avatar
  • 17.9k
4 votes
Accepted

Convert vector interpolation to quaternion interpolation? (Catmull-Rom)

Since it seems acceptable, I’ll go for the following suggestion: just interpolate the quaternion components, then normalise the resulting quaternion. pro: it’s fast and the code is short pro: and ...
user avatar
  • 23.4k
4 votes

How do I generalise Bresenham's line algorithm to floating-point endpoints?

...
user avatar
4 votes
Accepted

What will happen if the argument of mix() or clamp() is above 1 or below 0?

The return value is computed as x*(1−a)+y*a. in other words if a is -1 then the result will be ...
user avatar
4 votes
Accepted

GLSL "varying" interpolation: component-wise? Reference in the spec?

TL;DR: Yes, it is component-wise. As you said, GLSL specifications have formulas for computing "datum associated with a fragment", like this one: GLSL 330 spec : 3.5.1 Basic Line Segment ...
user avatar
  • 1,830
4 votes
Accepted

How to smooth rotations?

Yes, in fact that's what quaternions are often used for - interpolating between two different orientations. Other methods of representing orientation suffer from issues like gimbal lock and wrap-...
user avatar
  • 14.5k
4 votes
Accepted

Fixed Timestep with Interpolation | Blurry & Choppy

Your lerps and slerps are backwards: lerp(current, previous, alpha) should be lerp(previous, current, alpha) ie. ...
user avatar
  • 112k
3 votes

How does interpolation actually work to smooth out an object's movement?

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 ...
user avatar
3 votes

Why do some networked games use interpolation and some use pathfinding for remote movement?

I have no insight on Valve's development process, so this is purely my opinion, but: Interpolation: I'd say it'd be better for fast paced games, like FPSs for example, where having a consistent ...
user avatar
3 votes
Accepted

Libgdx Actions interpolation Fadeout

I use Interpolation.bounceIn.apply(current_position, target_position, smoothness) to achieve this effect. Take a look at this. Edit I found the answer on their ...
user avatar
3 votes

How to handle realtime random movement with client side prediction

If both the server and client agree on the seed, most randomizing algorithm will output the same values.
user avatar
3 votes

How do I generalise Bresenham's line algorithm to floating-point endpoints?

Your assumption isn't necessarily to find the cells but the lines it cross on this grid. For example taking your image we can highlight not the cells, but lines of the grid it crosses: This then ...
user avatar
3 votes

How to synchronize the ball in a network pong game?

The ball, by pretty much the law of Pong and physics must either be going towards player one, or player two, not both. You could use this to switch interpolation priority between the two players. ...
user avatar

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