Smooth lerping

This commit is contained in:
2026-07-17 22:58:00 +02:00
parent 674cf91ef3
commit 5cc156992f
2 changed files with 145 additions and 30 deletions
+10 -6
View File
@@ -92,14 +92,18 @@ for entity in entities_by_player_proximity() {
---
### 09 — Client camera *(sprite rendering already done)*
### 09 — Client camera *(camera follow done, entity interpolation open)*
Sprite rendering already landed (see Achieved). What remains is the camera:
Sprite rendering already landed (see Achieved). Camera status:
- Smooth camera: lerp between last known and current server position; do not snap
(currently `player_pos` snaps hard to the server position in `game.rs`)
- Store previous + current position per entity, interpolate on render
- Camera math is architectural — affects how entity state is stored. Do it before UI.
- [x] Smooth camera follow: the camera is a float pixel position (`cam` in `game.rs`)
that tracks the player linearly at ~64 px/s, snapping only to whole pixels at
render time (and outright on teleport-sized corrections). The viewport renders
with sub-tile offsets (31×31 tile pass + right-strip clip).
- [x] Entity interpolation: per-id lerp table (`EntityLerp` in `game.rs`) beside the
entity list — previous/current tile plus a clock, rendered as a pixel lerp over
one movement interval. Jumps of more than one tile (Chebyshev) snap. Purely
cosmetic; game logic keeps using authoritative tile positions.
---