Working about pathfinding

This commit is contained in:
Vladislav Khorev committed 2026-11-08 17:24:15 +06:00
1 parent 6a5adb1c79
commit c6d98bd72a
25 files changed
+1997 -508

No files matched your search

+29 -4
View File
@@ -340,8 +340,9 @@ The player state remains campaign-level and survives location changes.
## Save and Load Schema
Authoritative persistence uses one strict, versioned schema. `schemaVersion` is
required and unsupported versions are rejected rather than migrated. A
Authoritative persistence currently uses strict schema version `5`.
`schemaVersion` is required and unsupported versions are rejected rather than
migrated. A
single-player save is a separate versioned envelope containing `networkState`
(the authoritative `GameState` JSON) and `localState` (the client-local location
map). Lockstep sends that authoritative document only in `initial_state`; later
@@ -351,6 +352,9 @@ messages contain numbered command bundles.
- Locations are keyed by location ID.
- Each location stores NPC and interactive-object state in ID-keyed objects.
- Pending interaction targets and character references use stable IDs.
- Character navigation persistence includes waypoints, actual previous-tick
movement, blocked/retry state, the blocker ID, and the NPC cooldown sequence
and cursor.
- Immutable content such as meshes, initial taxi configuration, and object
definitions is reconstructed from campaign configuration.
- Configuration is loaded first and mutable saved state is overlaid in place.
@@ -478,12 +482,33 @@ cmake --build proj-windows/build --config Debug --target ShadowOverBishkekDemo -
auxiliary-state synchronization without making `Game` a server friend.
- Empty player maps are valid. Player-specific interactions remain inactive until
a player entity is added.
- Pathfinding priority queues use cell index as a stable secondary key.
- Pathfinding uses integer cardinal/diagonal costs and compares priority,
accumulated cost, then cell index.
- Gameplay randomness must be seeded and serialized; the `random_device` battle
bot is disabled for multiplayer sessions.
- A lockstep compatibility fingerprint must match before the client accepts the
initial state.
### Dynamic Navigation Occupancy
`LocationGameState` is the authoritative boundary for character-aware planning.
It collects enabled, living, stationary players and NPCs in stable ID order and
passes their positions and collision radii to `LocationNetworkState` and
`PathFinder`. The requester is excluded; moving characters are transparent to
planning. “Moving” here means actual previous-tick displacement
(`movedLastTick`), not merely owning an active path, so visually stalled
characters remain planning obstacles. Route planning uses full avoidance radii;
the movement guard uses smaller contact radii.
Every character movement step is guarded against stable-ID-ordered reservations
initialized from tick-start geometry. Accepted steps update their reservation
before later characters advance, preventing two movers from ending a tick
overlapped. Blocked/retry counters, cooldown sequence/cursor, and blocker ID are
serialized character state. Head-on players and bots cancel their commands;
NPCs retain their targets and consume the next deterministic, ID-shuffled
cooldown before replanning. Static navigation topology changes route through
the same centralized replanning path.
## Main Files
- `src/GameState.h` / `src/GameState.cpp` — aggregate state and top-level persistence.
@@ -502,7 +527,7 @@ cmake --build proj-windows/build --config Debug --target ShadowOverBishkekDemo -
broadcasting, buffering, and replica advancement.
- `src/Game.h` / `src/Game.cpp` — application host, campaign lifecycle, and runtime wiring.
- `src/Location.h` / `src/Location.cpp` — loaded location runtime, command routing,
interactions, collisions, scripts, and presentation-event consumption.
interactions, scripts, and presentation-event consumption.
- `src/Character.h` / `src/Character.cpp` — passive character presentation resolving
immutable `CharacterState` snapshots by stable ID.
- `src/CharacterState.h` / `src/CharacterState.cpp` — deterministic character