All puzzles › Netcode and Interpolation
Netcode and Interpolation Practice Problems
5 puzzles (3 easy, 2 medium), in Python, JavaScript and C++.
Draw other players smoothly over a network that is not. Snapshot interpolation, render lag, and the angle wraparound everybody gets wrong, taken straight out of the code that runs the lobby.
The puzzles, easiest first
- Halfway Between (Easy): Given two points in time, (ta, xa) and (tb, xb), and a time between them, return the position at that time, rounded to three decimal places.
- Only the Last Few (Easy): Given a stream of timestamps and a cap, return the ones you keep, oldest first.
- Which Two Moments? (Easy): Given a sorted list of snapshot times and a target time, return the index of the last snapshot at or before the target.
- The Short Way Round (Medium): Given two headings in radians, return the smallest turn from the first to the second, rounded to four decimal places.
- Where Are They Now? (Medium): Given snapshot times and positions, the current time, and a lag, return where to draw the player, rounded to three decimal places.
Practice another pattern
Or browse by subject
Browse all 676 puzzles