Ease the camera toward the player's interpolated position
The camera target was the sim tile, which jumps 8 px per movement window, and the follow was a constant-speed chase that stopped abruptly. Now the target is the render-side lerp position and the camera closes the gap exponentially, so it accelerates and settles smoothly. Also spawns the first NPC and switches the game to World::blocked. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+17
-11
@@ -54,9 +54,17 @@ crate's `tick`/`set_action` interface is the seam a server could be wrapped arou
|
||||
replanning toward the tile under the cursor (only when that tile changes — cursor
|
||||
or camera movement), sweeping across blocked tiles keeps the current route.
|
||||
- [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).
|
||||
that eases toward the player's *interpolated* render position (exponential
|
||||
approach, τ = 120 ms), 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 blocking: `World::blocked` (solid tile ∨ out of world ∨ occupied) is the
|
||||
one predicate the sim's `entity_tick` and the pathfinder share. Intents execute
|
||||
in id order, so the player (id 1) wins a contested tile deterministically.
|
||||
- [x] First NPC: `EntityKind { Player, Npc }` on `Entity`; `Sim::think` runs before
|
||||
every movement window and schedules a random king move for each NPC one window
|
||||
in four (seeded xorshift in `Sim`). Sprite = tile 1 in `entities.png` (a hen from
|
||||
the Mini-Medieval pack). One is spawned at (6, 6) in `Game::start`.
|
||||
- [x] Entity interpolation: per-id lerp table (`EntityLerp` in `game.rs`) — 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 the
|
||||
@@ -91,13 +99,14 @@ Remaining follow-ups when the need is concrete:
|
||||
|
||||
---
|
||||
|
||||
### 08 — Basic NPC entity + AI budget
|
||||
### 08 — Basic NPC entity + AI budget *(wanderer done — see Achieved)*
|
||||
|
||||
One dumb wandering enemy. Validates the simulation architecture before complexity accumulates.
|
||||
Depends on the action-point model from 06 being reintroduced. NPCs schedule intents through
|
||||
the same `Sim::set_action` the player uses.
|
||||
The wandering NPC and entity blocking have landed; `Sim::think` is the hook where the
|
||||
budget model goes once there are enough NPCs to need it. The action-point model from
|
||||
06 is still pending and only matters once NPC speeds should differ.
|
||||
|
||||
- Add `EntityKind::Npc` with a `think() -> u32` method returning budget cost
|
||||
- [x] `EntityKind::Npc`, `Sim::think` scheduling intents through the same intent table
|
||||
- Bump-to-attack: a step onto an occupied tile becomes an attack instead of a refused move
|
||||
- Per sim-tick: distribute a fixed `think_budget` across entities ordered by player proximity
|
||||
- Complex entities consume more budget; simple ones less. Loop breaks at zero — natural load shedding.
|
||||
- No framework. No trait objects yet. A match on `EntityKind` is fine.
|
||||
@@ -110,9 +119,6 @@ for entity in entities_by_player_proximity() {
|
||||
}
|
||||
```
|
||||
|
||||
- Entity-vs-entity blocking: `step_allowed` only checks tiles. Once NPCs exist, occupied
|
||||
tiles need to block too — in the sim *and* in the pathfinder's `blocked` closure.
|
||||
|
||||
---
|
||||
|
||||
### 09 — Client camera *(done — see Achieved)*
|
||||
|
||||
Reference in New Issue
Block a user