Add bump-to-attack, death and a sim event queue
A step onto an occupied tile is now an attack: the geometry rule is checked against terrain only and the target tile decides between move and bump. Entities carry an attack stat; at zero hp they are removed. The sim reports Attacked/Died through an event queue the game drains after every movement window — the seam for sound, log, camera effects and spawns. Click-to-move treats an occupied goal as a target but detours around entities in the way; the player's death ends the game. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+19
-4
@@ -58,13 +58,23 @@ crate's `tick`/`set_action` interface is the seam a server could be wrapped arou
|
||||
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] Entity blocking: `World::solid` (collidable tile ∨ out of world) and
|
||||
`World::blocked` (solid ∨ occupied). The sim checks the geometry rule against
|
||||
`solid` and resolves the target tile itself; the pathfinder plans with `blocked`.
|
||||
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] Bump-to-attack and death: the geometry rule is checked against terrain only
|
||||
(`World::solid`); an entity on the target tile turns the step into an attack
|
||||
(`Entity::attack` damage, `hp` saturating). At 0 hp the entity is removed. The
|
||||
sim reports both through its event queue — `sim::Event { Attacked, Died }`,
|
||||
drained by the game with `Sim::take_events` after every window — which is the
|
||||
seam for sound, message log, camera shake, spawns. Player death quits for now.
|
||||
Click-to-move treats an occupied goal as a target (route ends in a bump) but
|
||||
walks around entities in the way; keyboard steps always bump.
|
||||
- [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
|
||||
@@ -106,7 +116,12 @@ budget model goes once there are enough NPCs to need it. The action-point model
|
||||
06 is still pending and only matters once NPC speeds should differ.
|
||||
|
||||
- [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
|
||||
- [x] Bump-to-attack, death, `Event` queue
|
||||
- Stats beyond `hp`/`attack` (defense, speed) as plain fields; a `Stats` substruct once
|
||||
they crowd `Entity`. No ECS until entities actually differ in *which* components they
|
||||
carry — see the discussion of 2026-09-19.
|
||||
- NPC reactions (flee when hit, aggro on the player) — `think` would need to see the
|
||||
previous window's events; today the game drains them right after `step`
|
||||
- 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.
|
||||
|
||||
Reference in New Issue
Block a user