Fixing bugs with pathfinding, bump version
This commit is contained in:
1 parent
8e2b019c92
commit
f1cc28ab31
22 files changed
+1119
-759
No files matched your search
+224
-225
@@ -1,296 +1,295 @@
|
||||
# Pathfinding System
|
||||
# Pathfinding and Character Avoidance
|
||||
|
||||
This document describes the grid-based pathfinding used for the player and all NPCs, including the collision avoidance and movement quality improvements.
|
||||
This document describes the current authoritative navigation and movement
|
||||
system. The old grid-based implementation is no longer used. Static routes are
|
||||
computed on a triangulated navigation mesh, while moving characters avoid each
|
||||
other with a fixed-point ORCA solver.
|
||||
|
||||
---
|
||||
## 1. Authoritative update flow
|
||||
|
||||
## Table of Contents
|
||||
Navigation belongs to the game state, not the renderer:
|
||||
|
||||
1. [Grid Representation](#1-grid-representation)
|
||||
2. [Building the Walkable Grid](#2-building-the-walkable-grid)
|
||||
3. [A\* Path Search](#3-a-path-search)
|
||||
4. [Path Smoothing](#4-path-smoothing)
|
||||
5. [Approaching Unreachable Destinations](#5-approaching-unreachable-destinations)
|
||||
6. [Dynamic Obstacles](#6-dynamic-obstacles)
|
||||
7. [Path Following](#7-path-following)
|
||||
8. [Character Movement Guard](#8-character-movement-guard)
|
||||
9. [Dynamic Replanning](#9-dynamic-replanning)
|
||||
10. [Key Constants Reference](#10-key-constants-reference)
|
||||
1. A destination command is applied before a fixed 100 ms simulation tick.
|
||||
2. `CharacterState::setTarget()` asks the active `PathFinder` for a route.
|
||||
3. `CharacterState::update()` follows the current waypoint and computes
|
||||
`preferredVelocity`.
|
||||
4. `LocationGameState::update()` gathers all enabled characters in stable ID
|
||||
order and runs one ORCA step.
|
||||
5. ORCA writes the accepted position and velocity back to each
|
||||
`CharacterState`.
|
||||
6. Navigation requests produced by NPC logic are applied by
|
||||
`InternalGameServer` as deterministic simulation consequences.
|
||||
7. A new immutable snapshot is published for rendering.
|
||||
|
||||
---
|
||||
Rendering interpolates between completed snapshots in `Character.cpp`. That
|
||||
interpolation uses each client's wall clock and can look slightly different
|
||||
between clients; it never changes authoritative positions.
|
||||
|
||||
## 1. Grid Representation
|
||||
## 2. Fixed-point math
|
||||
|
||||
The world is divided into a uniform 2D grid in the XZ plane (Y is ignored during pathfinding; all characters walk on a flat floor at `floorY`).
|
||||
Gameplay navigation uses:
|
||||
|
||||
Each cell is either **walkable** (`1`) or **blocked** (`0`). The grid is stored as a flat `std::vector<unsigned char>` indexed by `z * gridWidth + x`.
|
||||
|
||||
**Parameters** (all configurable in the JSON config file):
|
||||
|
||||
| Parameter | Default | Description |
|
||||
|---|---|---|
|
||||
| `cellSize` | 0.4 m | Width and depth of one cell |
|
||||
| `agentRadius` | 0.45 m | Half-width of a character — used to erode free space |
|
||||
| `objectPadding` | 0.25 m | Extra clearance added around obstacle polygons |
|
||||
| `boundaryPadding` | 0.0 m | Inward erosion from the edges of navigation areas |
|
||||
| `floorY` | 0.0 | Y coordinate placed on every path waypoint |
|
||||
|
||||
**Grid bounds** are computed from the union of all navigation area polygons plus a padding margin of `cellSize * 2 + agentRadius + objectPadding` on every side.
|
||||
|
||||
**Cell coordinate conversion:**
|
||||
|
||||
```
|
||||
cell.x = floor((worldX - minX) / cellSize)
|
||||
cell.z = floor((worldZ - minZ) / cellSize)
|
||||
|
||||
cellCenter.x = minX + (cell.x + 0.5) * cellSize
|
||||
cellCenter.z = minZ + (cell.z + 0.5) * cellSize
|
||||
```cpp
|
||||
using fp = fpm::fixed<std::int32_t, std::int64_t, 12>;
|
||||
```
|
||||
|
||||
---
|
||||
`Vec2fp` is used for XZ navigation and velocity. `Vec3fp` is used for world
|
||||
positions and waypoints. With 12 fractional bits, one raw unit is 1/4096.
|
||||
|
||||
## 2. Building the Walkable Grid
|
||||
Path following, waypoint tests, ORCA constraints, collision correction,
|
||||
movement displacement, and facing calculations use fixed-point operations.
|
||||
Floating-point conversions remain at content and presentation boundaries.
|
||||
|
||||
The grid can be loaded in two ways.
|
||||
The navigation-mesh build is not fully fixed-point:
|
||||
|
||||
### 2a. Pre-computed grid (`.txt` file)
|
||||
- Input JSON numbers are converted to fixed point.
|
||||
- Polygon clipping uses scaled `int64_t` coordinates.
|
||||
- CDT triangulation temporarily uses `double`.
|
||||
- Triangle vertices and centers are converted back to fixed point before path
|
||||
queries.
|
||||
|
||||
A plain-text file with a small header followed by rows of `1`/`0` characters:
|
||||
Multiplayer therefore requires matching executable and content builds.
|
||||
|
||||
```
|
||||
cellSize 0.4
|
||||
agentRadius 0.45
|
||||
floorY 0.0
|
||||
...
|
||||
minX -5.0
|
||||
minZ -5.0
|
||||
gridWidth 50
|
||||
gridDepth 50
|
||||
11111111...
|
||||
10000001...
|
||||
```
|
||||
## 3. Navigation configuration
|
||||
|
||||
This format is generated by `PathFinder::saveGrid()` after building from polygons and can be loaded much faster than recomputing from geometry.
|
||||
|
||||
### 2b. Polygon-based config (`.json` file)
|
||||
|
||||
The JSON file lists **navigation areas** (convex or concave walkable regions) and **obstacle polygons** (impassable zones within those regions):
|
||||
Each navigation JSON contains:
|
||||
|
||||
```json
|
||||
{
|
||||
"cellSize": 0.4,
|
||||
"areas": [
|
||||
{ "name": "main_room", "available": true, "polygon": [[x,z], ...] }
|
||||
{
|
||||
"name": "main",
|
||||
"available": true,
|
||||
"polygon": [[-10, -10], [10, -10], [10, 10], [-10, 10]]
|
||||
}
|
||||
],
|
||||
"obstacles": [
|
||||
{ "name": "table", "polygon": [[x,z], ...] }
|
||||
]
|
||||
{
|
||||
"name": "wall",
|
||||
"polygon": [[1, 1], [2, 1], [2, 4], [1, 4]]
|
||||
}
|
||||
],
|
||||
"floorY": 0
|
||||
}
|
||||
```
|
||||
|
||||
**Build steps:**
|
||||
Only the first navigation area is currently loaded. A location may list
|
||||
multiple navigation JSON files; `LocationNetworkState::activeNavigationIndex`
|
||||
selects the active map.
|
||||
|
||||
1. **Mark available areas walkable** — every cell whose center lies inside any `available` navigation area polygon gets `walkable = 1`. If `boundaryPadding > 0`, cells too close to the outer edge of the area are left blocked.
|
||||
2. **Mark obstacle polygons blocked** — cells whose center lies inside an obstacle polygon, or within `agentRadius + objectPadding` of its edges, are set to `0`.
|
||||
The shared character radius is:
|
||||
|
||||
Navigation areas can be toggled at runtime via `PathFinder::setAreaAvailable()`, which rebuilds the entire grid. This is used to open or close doors, gated areas, etc.
|
||||
|
||||
---
|
||||
|
||||
## 3. A\* Path Search
|
||||
|
||||
`PathFinder::findPath(start, end)` runs a standard A\* on the walkable grid.
|
||||
|
||||
**Neighbor connectivity:** 8-directional (cardinal + diagonal). Diagonal moves are blocked if either of the two adjacent cardinal cells is unwalkable (no corner-cutting).
|
||||
|
||||
**Step costs:** integer `10` for cardinal and `14` for diagonal.
|
||||
|
||||
**Heuristic:** octile distance using the same `10`/`14` scale. Queue entries
|
||||
compare priority, accumulated cost, then linear cell index; stale entries are
|
||||
rejected. This avoids floating-point route-order differences.
|
||||
|
||||
**Start/end snapping:** If the exact cell for `start` or `end` is not walkable, `findNearestWalkableCell` expands a square ring outward (up to radius 8 m) to find the nearest walkable cell. This makes clicking slightly outside the nav mesh still produce a valid path.
|
||||
|
||||
**Path reconstruction:** After A\* completes, the cell chain is walked via `cameFrom[]` from `end` back to `start`, reversed, then smoothed (see §4).
|
||||
|
||||
**First-waypoint trimming:** If the first waypoint is within `cellSize × 0.75` of `start`, it is dropped (the character is already close enough).
|
||||
|
||||
**Last-waypoint precision:** If the requested `end` maps to the same cell as the snapped end cell, the last waypoint is replaced with the exact `end` world position rather than the cell centre.
|
||||
|
||||
---
|
||||
|
||||
## 4. Path Smoothing
|
||||
|
||||
Raw A\* paths follow the grid diagonals and produce staircase-shaped routes. A **string-pulling** (line-of-sight) pass compresses them:
|
||||
|
||||
```
|
||||
anchor = path[0]
|
||||
result = [anchor]
|
||||
while anchor is not the last cell:
|
||||
find the furthest cell 'next' from anchor with unobstructed line of sight
|
||||
result.append(next)
|
||||
anchor = next
|
||||
```cpp
|
||||
kCharacterAgentRadius = 0.42f
|
||||
```
|
||||
|
||||
Line-of-sight uses deterministic integer grid traversal and applies the same
|
||||
no-corner-cutting rule as A*. The result is a minimal set of waypoints connected
|
||||
by straight, obstacle-free segments.
|
||||
## 4. Building the navigation mesh
|
||||
|
||||
---
|
||||
`PathFinder::generateNavMesh()` performs these steps:
|
||||
|
||||
## 5. Approaching Unreachable Destinations
|
||||
1. Convert area and obstacle vertices to Clipper2 `int64_t` coordinates using
|
||||
`CLIPPER_SCALE = 10000`.
|
||||
2. Subtract obstacle polygons from the outer walkable polygon.
|
||||
3. Erode the result inward by `kCharacterAgentRadius`.
|
||||
4. Rebuild polygon and hole hierarchy with `PolyTree64`.
|
||||
5. Run constrained Delaunay triangulation with CDT.
|
||||
6. Convert generated triangles to fixed-point `NavTriangle` records.
|
||||
7. Store edge neighbors and mark connected components with deterministic BFS.
|
||||
|
||||
When a player clicks on a point in a disconnected region (e.g., across a thin wall), the original `findPath` returns an empty path and the character does not move. This is surprising — a click on a solid wall sensibly moves the character to the nearest reachable point, but a click into an inaccessible room does nothing.
|
||||
Each triangle contains three vertices, a fixed-point center, three neighbor
|
||||
indices, and a connected-component ID.
|
||||
|
||||
**`findPathToNearest`** runs one A\* search against the requested static and
|
||||
dynamic occupancy. If the destination is unreachable, the same search returns
|
||||
the reachable cell geometrically closest to it. It never retries without
|
||||
dynamic obstacles.
|
||||
## 5. Route queries
|
||||
|
||||
- While processing cells, it tracks `bestIndex` — the visited cell with the
|
||||
smallest squared grid distance to the end cell. Equal distances use the
|
||||
lower linear cell index.
|
||||
- If A\* exhausts all reachable space without finding `end`, it reconstructs and returns a path to `bestIndex`.
|
||||
- If `bestIndex` is still the start cell (character is completely isolated), an empty path is returned and the character stays put.
|
||||
`PathFinder::findPathToNearest(start, end)`:
|
||||
|
||||
The net effect: clicking anywhere in the world always moves the character as close as possible to the target, matching the behaviour of clicking on a solid wall.
|
||||
1. Finds the triangle containing the start.
|
||||
2. If necessary, clamps the start to the closest navigation-mesh boundary.
|
||||
3. Finds the destination triangle.
|
||||
4. If the destination is outside the mesh or on another connected component,
|
||||
clamps it to the closest boundary of the start component.
|
||||
5. Runs A* through adjacent triangles.
|
||||
6. Applies the funnel algorithm to the triangle corridor.
|
||||
7. Returns fixed-point 3D waypoints at `floorY`.
|
||||
|
||||
`LocationGameState` applies this behavior to players and NPCs.
|
||||
If start and destination are in the same triangle, the route is a direct
|
||||
segment. If no valid start or corridor exists, the result keeps the character
|
||||
at its current position.
|
||||
|
||||
---
|
||||
### A* ordering
|
||||
|
||||
## 6. Dynamic Obstacles
|
||||
A* uses fixed-point distances between triangle centers. Queue records compare:
|
||||
|
||||
When a path is planned, other characters can temporarily mark cells as blocked to make the character walk around them rather than through them.
|
||||
1. total estimated cost (`fScore`);
|
||||
2. triangle ID.
|
||||
|
||||
**How it works:**
|
||||
Neighbor edges are visited in stored edge order. The explicit triangle-ID tie
|
||||
break prevents priority-queue ordering from depending on allocation addresses.
|
||||
|
||||
`LocationGameState::collectPathObstacles` creates a stable-ID-sorted snapshot
|
||||
from authoritative players and NPCs. `PathFinder` stamps circles into a
|
||||
generation-tagged overlay and reuses A\* buffers; it does not copy or mutate the
|
||||
static walkability grid per query.
|
||||
### Funnel smoothing
|
||||
|
||||
**Which characters become obstacles:**
|
||||
The corridor's shared edges become left/right portals. The Simple Stupid
|
||||
Funnel Algorithm emits only the corners needed to stay inside the corridor,
|
||||
plus the exact clamped destination.
|
||||
|
||||
A character is added as a dynamic obstacle only when **all** of these are true:
|
||||
## 6. Path following
|
||||
|
||||
- It is not the character currently planning the path (`self`).
|
||||
- It is alive and enabled.
|
||||
- It did not physically move during the previous simulation tick, unless it
|
||||
just blocked this requester and is promoted for a forced replan. An active
|
||||
path alone does not make a stalled character transparent.
|
||||
`CharacterState` stores:
|
||||
|
||||
**Obstacle radius:** the character's full `collisionRadius`, inflated by the
|
||||
navigation map's `agentRadius` and one cell half-diagonal for conservative
|
||||
rasterization. There is no obstacle-dropping fallback; an occupied destination
|
||||
resolves to a nearby reachable cell.
|
||||
- `requestedWalkTarget`: the original destination intent;
|
||||
- `walkTarget`: the reachable route endpoint;
|
||||
- `pathWaypoints`: the current smoothed route;
|
||||
- `currentWaypointIndex`: the active waypoint;
|
||||
- `velocity`: the previous accepted ORCA velocity;
|
||||
- `preferredVelocity`: the velocity requested for the current tick.
|
||||
|
||||
---
|
||||
`CharacterState::update()` advances waypoints within
|
||||
`kWalkThreshold = 0.05 m`. The desired speed is the smaller of `walkSpeed` and
|
||||
the speed needed to reach the waypoint in the current tick. Reaching the final
|
||||
waypoint clears the path and produces the optional arrival event.
|
||||
|
||||
## 7. Path Following
|
||||
Destination requests within 0.25 m of the existing request are deduplicated.
|
||||
NPC navigation retries use a stable-ID-shuffled sequence of cooldown ticks.
|
||||
|
||||
`CharacterState::setTarget(destination, onArrived)` sets a new walk target. It
|
||||
calls the centralized location planner to generate a waypoint list. The result
|
||||
is stored in `pathWaypoints`; the reachable endpoint is stored in `walkTarget`
|
||||
and the original command destination in `requestedWalkTarget`.
|
||||
`stopInPlace()` clears the route and callback, targets the current position,
|
||||
resets blockage and retry state, and clears both movement velocities.
|
||||
|
||||
Each fixed simulation tick in `CharacterState::update`:
|
||||
## 7. Character avoidance with ORCA
|
||||
|
||||
1. **Active target** — if `pathWaypoints` is non-empty, the character moves toward `pathWaypoints[currentWaypointIndex]`; otherwise it moves toward `walkTarget`.
|
||||
2. **Movement** — the character advances along the XZ direction at `walkSpeed` m/s and rotates smoothly toward the movement direction at `rotationSpeed` rad/s.
|
||||
3. **Waypoint advance** — when the character is within `WALK_THRESHOLD = 0.05 m` of the current waypoint, it advances to the next one. When the last waypoint is reached, `pathWaypoints` is cleared and the optional `onArrived` callback is fired.
|
||||
4. **State machine** — the animation state switches between `STAND` and `WALK` based on whether the character is moving.
|
||||
Static routing does not insert moving characters into the navigation mesh.
|
||||
Instead, `LocationGameState` creates one `OrcaAgent` per enabled, living
|
||||
character after every character has computed its preferred velocity.
|
||||
|
||||
`CharacterState::isMoving()` reports whether navigation remains active.
|
||||
`movedLastTick` separately records actual displacement and controls dynamic
|
||||
obstacle filtering.
|
||||
Agents are sorted by stable character ID before solving. Each agent stores:
|
||||
|
||||
**Stopping in place:** `CharacterState::stopInPlace()` sets `walkTarget` and
|
||||
`requestedWalkTarget` to the current position, clears the path and callback, and
|
||||
resets blockage state. It is used to cancel player/bot movement after a
|
||||
persistent contact and by other explicit stop actions.
|
||||
- current XZ position;
|
||||
- previous accepted velocity;
|
||||
- preferred velocity;
|
||||
- collision radius and maximum speed;
|
||||
- stationary/combat state;
|
||||
- player/hostile avoidance policy.
|
||||
|
||||
---
|
||||
Current ORCA constants:
|
||||
|
||||
## 8. Character Movement Guard
|
||||
| Setting | Value |
|
||||
|---|---:|
|
||||
| Simulation step | 0.1 s |
|
||||
| Time horizon | 0.6 s |
|
||||
| Neighbor distance | 4.0 m |
|
||||
| Avoidance radius factor | 0.85 |
|
||||
| Parallel-line tolerance | 0.001 |
|
||||
| Constant-speed validity tolerance | 0.1 m/s |
|
||||
|
||||
Pathfinding steers around stationary characters. A second authoritative guard
|
||||
checks each proposed movement segment against stable-ID-ordered reservations
|
||||
initialized from tick-start circles. An accepted step updates that character's
|
||||
reservation before later characters advance. A step that approaches or sweeps
|
||||
through another circle is rejected rather than pushing either character.
|
||||
For each nearby character, ORCA constructs a permitted velocity half-plane.
|
||||
Constraints are solved with the standard three-stage linear program. Exact
|
||||
overlap uses the agents' stable sorted indices to choose a fallback direction.
|
||||
|
||||
Characters that moved during the previous tick are transparent during planning
|
||||
but remain solid to the movement guard. Planning uses the full
|
||||
`collisionRadius` (default 0.45 m); contact checks use the smaller
|
||||
`movementContactRadius` (default 0.32 m). NPC JSON can override these as
|
||||
`navigationAvoidanceRadius` and `movementContactRadius`. This tolerance avoids
|
||||
false bumps from grid discretization while still preventing stacking.
|
||||
### Character policies
|
||||
|
||||
When moving characters remain blocked head-on or while crossing for three
|
||||
ticks, both stop. Player and bot destinations are cancelled; the user or bot
|
||||
may issue another command. NPCs retain `requestedWalkTarget` and retry later.
|
||||
Characters following in the same direction simply wait for spacing and do not
|
||||
accumulate stuck ticks. A rejected movement step uses the standing animation.
|
||||
- Hostile attacking NPCs are treated as ghosts for avoidance policy.
|
||||
- Non-ghost characters do not add braking constraints for ghosts.
|
||||
- Ghosts take 95% of avoidance responsibility around non-ghost characters.
|
||||
- A moving character takes full responsibility around a stationary character.
|
||||
- Non-ghost characters try deterministic candidate angles from 0 through
|
||||
±90 degrees while preserving preferred speed; if none is valid, they stop.
|
||||
|
||||
---
|
||||
### Hard-overlap correction
|
||||
|
||||
## 9. Dynamic Replanning
|
||||
After applying velocities, `resolveHardCollisions()` runs two stable pairwise
|
||||
passes. Overlapping characters are separated along their fixed-point normal.
|
||||
Non-ghost characters push ghosts completely; other pairs split correction
|
||||
according to stationary weights.
|
||||
|
||||
Rejected non-following movement increments serialized `movementBlockedTicks`.
|
||||
After three blocked ticks an NPC stops and schedules a retry. When its cooldown
|
||||
expires, `InternalGameServer` promotes the blocker to a hard obstacle and
|
||||
replans to `requestedWalkTarget`.
|
||||
Finally, any character outside the active navigation mesh is clamped back to
|
||||
its closest boundary.
|
||||
|
||||
Each NPC has `navigationRetryCooldownTicks`, normally ten distinct values.
|
||||
`LocationDefinition` deterministically shuffles the sequence from the stable NPC
|
||||
ID, and every retry consumes the next value. The sequence and cursor are
|
||||
serialized, preventing synchronized retry loops while preserving lockstep.
|
||||
NPC JSON can override it with `navigationRetryCooldownTicks` or
|
||||
`navigationRetryCooldownMs`.
|
||||
## 8. Movement and animation state
|
||||
|
||||
Example NPC tuning:
|
||||
After ORCA:
|
||||
|
||||
```json
|
||||
{
|
||||
"navigationAvoidanceRadius": 0.45,
|
||||
"movementContactRadius": 0.32,
|
||||
"navigationRetryCooldownMs": [
|
||||
200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100
|
||||
]
|
||||
}
|
||||
- accepted position and `newVel` become authoritative state;
|
||||
- `movedLastTick` is set from actual displacement;
|
||||
- `movementBlockedTicks` is reset after movement or incremented when a desired
|
||||
move produced no displacement;
|
||||
- walking/standing animation state follows actual movement;
|
||||
- facing follows the accepted ORCA velocity.
|
||||
|
||||
`facingAngle` and `targetFacingAngle` are explicitly initialized. This is
|
||||
important because the underlying fixed-point library's default constructor does
|
||||
not initialize its raw integer.
|
||||
|
||||
## 9. Deterministic lockstep requirements
|
||||
|
||||
All clients must begin a tick with identical state. The following movement
|
||||
history is serialized in schema version 6:
|
||||
|
||||
- exact raw fixed-point `velocity` components;
|
||||
- path targets, waypoints, and waypoint index;
|
||||
- `movedLastTick` and blocked/retry counters;
|
||||
- deterministic retry sequence and cursor;
|
||||
- animation frame, state, `resetAnim`, and attack phase;
|
||||
- facing and target-facing angles.
|
||||
|
||||
Velocity is stored as raw fixed-point integers rather than decimal floats. It
|
||||
must be present in late-join and reconnect snapshots because the next ORCA step
|
||||
uses previous velocity directly. `resetAnim` and `attack` are also persisted
|
||||
because they affect the next animation/combat update after a snapshot.
|
||||
|
||||
Character and interactive-object maps may use `unordered_map`, but simulation
|
||||
collects and sorts stable IDs before order-sensitive updates. ORCA sorts agents
|
||||
again defensively.
|
||||
|
||||
## 10. Compatibility and divergence diagnostics
|
||||
|
||||
The manual campaign compatibility label is combined with:
|
||||
|
||||
- deterministic simulation version;
|
||||
- campaign and multiplayer slot metadata;
|
||||
- ordered location/navigation configuration;
|
||||
- authoritative configuration and start-state bytes;
|
||||
- referenced animation bytes.
|
||||
|
||||
The resulting fingerprint is logged by server and client. Connections are
|
||||
rejected when fingerprints differ, preventing two Release directories with
|
||||
different navigation resources from entering lockstep.
|
||||
|
||||
After every server tick, the server sends a canonical authoritative-state hash.
|
||||
Each client computes the same hash after applying that tick and logs:
|
||||
|
||||
```text
|
||||
[network] Lockstep divergence at tick N: server=..., client=...
|
||||
```
|
||||
|
||||
The configured values are clamped to positive tick counts and shuffled
|
||||
deterministically per NPC ID. Supplying different ten-value sets gives explicit
|
||||
control for unusually dense locations.
|
||||
The hash excludes the persistence timestamp but includes serialized movement
|
||||
history. Compare authoritative raw positions at the same completed tick ID;
|
||||
do not compare interpolated render-frame positions.
|
||||
|
||||
Navigation map switches, area availability changes, and added static obstacle
|
||||
polygons also force centralized replanning.
|
||||
## 11. Known constraints
|
||||
|
||||
Opposing traffic in a one-character-wide corridor can wait until one route or
|
||||
blocker changes; this policy intentionally does not implement space-time
|
||||
cooperative reservations.
|
||||
- Navigation-mesh generation still depends on Clipper2/CDT and temporary
|
||||
`double` values, so cross-toolchain identity is not guaranteed.
|
||||
- Triangle IDs are taken from CDT output and are used as A* tie breakers.
|
||||
- Only one navigation area from each JSON file is currently loaded.
|
||||
- ORCA is local collision avoidance, not cooperative space-time planning.
|
||||
Dense opposing traffic can still stop temporarily.
|
||||
- Runtime area and obstacle changes rebuild or mutate local navigation state
|
||||
and must be applied identically on every lockstep replica.
|
||||
|
||||
---
|
||||
## 12. Main files and tests
|
||||
|
||||
## 10. Key Constants Reference
|
||||
- `src/navigation/PathFinder.h/.cpp`: navmesh generation, A*, clamping, funnel.
|
||||
- `src/navigation/fpmutils.h/.cpp`: fixed-point vectors and conversions.
|
||||
- `src/CharacterState.h/.cpp`: path state, waypoint following, serialization.
|
||||
- `src/OrcaSolver.h`: deterministic local avoidance and overlap correction.
|
||||
- `src/LocationGameState.h/.cpp`: stable character collection and ORCA update.
|
||||
- `src/game_server/InternalGameServer.cpp`: authoritative tick consequences.
|
||||
- `src/game_server/NetworkProtocol.cpp`: tick messages and canonical hashes.
|
||||
- `src/game_server/WebsocketGameClient.cpp`: replica advancement and hash check.
|
||||
|
||||
| Constant | Location | Value | Description |
|
||||
|---|---|---|---|
|
||||
| `cellSize` | `PathFinder` config | 0.4 m | Grid cell size |
|
||||
| `agentRadius` | `PathFinder` config | 0.45 m | Character half-width for grid erosion |
|
||||
| `objectPadding` | `PathFinder` config | 0.25 m | Extra clearance around obstacles |
|
||||
| `movementContactRadius` | `CharacterState` / NPC config | 0.32 m | Smaller movement-guard radius |
|
||||
| `kWalkThreshold` | `CharacterState.h` | 0.05 m | Distance below which a waypoint is considered reached |
|
||||
| `TARGET_REPLAN_THRESHOLD` | `CharacterState.cpp` | 0.25 m | Deduplication threshold in `setTarget` |
|
||||
| `BLOCKED_REPLAN_TICKS` | `CharacterState.cpp` | 3 ticks | Blocked steps before stopping |
|
||||
| default retry sequence | `CharacterState.cpp` | 2–11 ticks | Ten ID-shuffled NPC retry cooldowns |
|
||||
| `NPC_TALK_DISTANCE` | `Location.cpp` | 1.35 m | Distance at which walking-to-NPC interaction fires |
|
||||
Release regression coverage includes:
|
||||
|
||||
### Reference benchmark
|
||||
|
||||
`GameServerPathFinderTests --benchmark` is non-gating. On the development
|
||||
Windows Release build with an 80×80 grid, the current implementation completed
|
||||
100 obstacle-aware queries in 15 ms and 1000 queries in 176 ms. Treat these as
|
||||
comparative measurements rather than cross-machine budgets.
|
||||
- fixed-point velocity round-trip;
|
||||
- compatibility fingerprint sensitivity to navigation-map order;
|
||||
- two-client late join after ORCA movement has already started;
|
||||
- exact raw position and velocity equality across server and both replicas;
|
||||
- pathfinder, state, protocol, lockstep, and server smoke tests.
|
||||
@@ -5,7 +5,7 @@
|
||||
"npcs": "resources/config/npcs_battle_zone.json",
|
||||
"dialogues": "resources/dialogue/battle_zone_dialogues.json",
|
||||
"navigation": [
|
||||
"resources/navigation/battle_zone001.json",
|
||||
"resources/navigation/battle_zone001.json",
|
||||
"resources/navigation/dorm0_large.json"
|
||||
],
|
||||
"script": "resources/start_battle_zone.lua",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id": "park_korea",
|
||||
"gameObjects": "resources/w/technopark2/game_objects.json",
|
||||
"interactiveObjects": "resources/w/technopark2/interactive_objects.json",
|
||||
"npcs": "resources/config/npcs_battle_zone.json",
|
||||
"dialogues": "resources/dialogue/battle_zone_dialogues.json",
|
||||
"navigation": [
|
||||
"resources/navigation/dorm0_large.json"
|
||||
],
|
||||
"script": "resources/start_battle_zone.lua",
|
||||
"playerPosition": [-6, 0, 12.8]
|
||||
}
|
||||
@@ -1,328 +1,328 @@
|
||||
{
|
||||
"npcs": [
|
||||
{
|
||||
"id": "ghost_01x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -5.6,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -12.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange" : 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_02x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -6.4,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -12.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange" : 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_03x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -5.6,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -12.5,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange" : 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_04x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -6.4,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -12.5,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange" : 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_05x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -5.6,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -13.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange" : 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_06x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -6.4,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -13.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange" : 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_07x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -5.6,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -14.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange" : 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_08x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -6.4,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -14.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange" : 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_09x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -5.6,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -14.5,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange" : 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_10x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -6.4,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -14.5,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange" : 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_11x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -5.6,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -15.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange" : 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_12x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -6.4,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -15.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange" : 6.5,
|
||||
"canAttack": true
|
||||
}
|
||||
{
|
||||
"id": "ghost_01x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -5.6,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -12.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange": 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_02x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -6.4,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -12.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange": 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_03x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -5.6,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -12.5,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange": 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_04x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -6.4,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -12.5,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange": 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_05x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -5.6,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -13.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange": 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_06x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -6.4,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -13.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange": 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_07x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -5.6,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -14.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange": 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_08x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -6.4,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -14.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange": 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_09x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -5.6,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -14.5,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange": 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_10x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -6.4,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -14.5,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange": 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_11x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -5.6,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -15.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange": 6.5,
|
||||
"canAttack": true
|
||||
},
|
||||
{
|
||||
"id": "ghost_12x",
|
||||
"name": "Тень",
|
||||
"meshTextures": {
|
||||
"Shadow_NPC_Rigged": "resources/w/shadow/Shadow_BaseColor.png"
|
||||
},
|
||||
"animationIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationWalkPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionIdlePath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionAttackPath": "resources/w/shadow/shadow_attack003.anim",
|
||||
"animationStandToActionPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToStandPath": "resources/w/shadow/shadow_idle003.anim",
|
||||
"animationActionToDeathPath": "resources/w/shadow/shadow_die003.anim",
|
||||
"animationDeathIdlePath": "resources/w/shadow/shadow_dead003.anim",
|
||||
"positionX": -6.4,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -15.0,
|
||||
"walkSpeed": 1.5,
|
||||
"rotationSpeed": 8.0,
|
||||
"modelScale": 1.0,
|
||||
"modelCorrectionRotX": -90.0,
|
||||
"modelCorrectionRotY": 180.0,
|
||||
"modelCorrectionRotZ": 0.0,
|
||||
"hp": 35,
|
||||
"visibleRange": 6.5,
|
||||
"canAttack": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -490,6 +490,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": false,
|
||||
@@ -603,6 +606,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -791,7 +797,7 @@
|
||||
]
|
||||
},
|
||||
"savedAt": "2026-11-10 20:38",
|
||||
"schemaVersion": 5,
|
||||
"schemaVersion": 6,
|
||||
"taxiIsCalled": false,
|
||||
"tutorialJournalScreenOpened": false,
|
||||
"tutorialNeedOpenTaxiScreen": false,
|
||||
|
||||
@@ -132,6 +132,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -139,7 +142,7 @@
|
||||
"facingAngle": 0.0,
|
||||
"homeDriftCheckTimer": 5.0,
|
||||
"homePosition": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-12.0
|
||||
],
|
||||
@@ -163,12 +166,12 @@
|
||||
"pathWaypoints": [
|
||||
],
|
||||
"position": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-12.0
|
||||
],
|
||||
"requestedWalkTarget": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-12.0
|
||||
],
|
||||
@@ -176,7 +179,7 @@
|
||||
"targetFacingAngle": 0.0,
|
||||
"visibleRange": 6.5,
|
||||
"walkTarget": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-12.0
|
||||
]
|
||||
@@ -186,6 +189,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -193,7 +199,7 @@
|
||||
"facingAngle": 0.0,
|
||||
"homeDriftCheckTimer": 5.0,
|
||||
"homePosition": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-12.0
|
||||
],
|
||||
@@ -217,12 +223,12 @@
|
||||
"pathWaypoints": [
|
||||
],
|
||||
"position": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-12.0
|
||||
],
|
||||
"requestedWalkTarget": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-12.0
|
||||
],
|
||||
@@ -230,7 +236,7 @@
|
||||
"targetFacingAngle": 0.0,
|
||||
"visibleRange": 6.5,
|
||||
"walkTarget": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-12.0
|
||||
]
|
||||
@@ -240,6 +246,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -247,7 +256,7 @@
|
||||
"facingAngle": 0.0,
|
||||
"homeDriftCheckTimer": 5.0,
|
||||
"homePosition": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-12.5
|
||||
],
|
||||
@@ -271,12 +280,12 @@
|
||||
"pathWaypoints": [
|
||||
],
|
||||
"position": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-12.5
|
||||
],
|
||||
"requestedWalkTarget": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-12.5
|
||||
],
|
||||
@@ -284,7 +293,7 @@
|
||||
"targetFacingAngle": 0.0,
|
||||
"visibleRange": 6.5,
|
||||
"walkTarget": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-12.5
|
||||
]
|
||||
@@ -294,6 +303,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -301,7 +313,7 @@
|
||||
"facingAngle": 0.0,
|
||||
"homeDriftCheckTimer": 5.0,
|
||||
"homePosition": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-12.5
|
||||
],
|
||||
@@ -325,12 +337,12 @@
|
||||
"pathWaypoints": [
|
||||
],
|
||||
"position": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-12.5
|
||||
],
|
||||
"requestedWalkTarget": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-12.5
|
||||
],
|
||||
@@ -338,7 +350,7 @@
|
||||
"targetFacingAngle": 0.0,
|
||||
"visibleRange": 6.5,
|
||||
"walkTarget": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-12.5
|
||||
]
|
||||
@@ -348,6 +360,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -355,7 +370,7 @@
|
||||
"facingAngle": 0.0,
|
||||
"homeDriftCheckTimer": 5.0,
|
||||
"homePosition": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-13.0
|
||||
],
|
||||
@@ -379,12 +394,12 @@
|
||||
"pathWaypoints": [
|
||||
],
|
||||
"position": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-13.0
|
||||
],
|
||||
"requestedWalkTarget": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-13.0
|
||||
],
|
||||
@@ -392,7 +407,7 @@
|
||||
"targetFacingAngle": 0.0,
|
||||
"visibleRange": 6.5,
|
||||
"walkTarget": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-13.0
|
||||
]
|
||||
@@ -402,6 +417,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -409,7 +427,7 @@
|
||||
"facingAngle": 0.0,
|
||||
"homeDriftCheckTimer": 5.0,
|
||||
"homePosition": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-13.0
|
||||
],
|
||||
@@ -433,12 +451,12 @@
|
||||
"pathWaypoints": [
|
||||
],
|
||||
"position": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-13.0
|
||||
],
|
||||
"requestedWalkTarget": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-13.0
|
||||
],
|
||||
@@ -446,7 +464,7 @@
|
||||
"targetFacingAngle": 0.0,
|
||||
"visibleRange": 6.5,
|
||||
"walkTarget": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-13.0
|
||||
]
|
||||
@@ -456,6 +474,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -463,7 +484,7 @@
|
||||
"facingAngle": 0.0,
|
||||
"homeDriftCheckTimer": 5.0,
|
||||
"homePosition": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-14.0
|
||||
],
|
||||
@@ -487,12 +508,12 @@
|
||||
"pathWaypoints": [
|
||||
],
|
||||
"position": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-14.0
|
||||
],
|
||||
"requestedWalkTarget": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-14.0
|
||||
],
|
||||
@@ -500,7 +521,7 @@
|
||||
"targetFacingAngle": 0.0,
|
||||
"visibleRange": 6.5,
|
||||
"walkTarget": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-14.0
|
||||
]
|
||||
@@ -510,6 +531,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -517,7 +541,7 @@
|
||||
"facingAngle": 0.0,
|
||||
"homeDriftCheckTimer": 5.0,
|
||||
"homePosition": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-14.0
|
||||
],
|
||||
@@ -541,12 +565,12 @@
|
||||
"pathWaypoints": [
|
||||
],
|
||||
"position": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-14.0
|
||||
],
|
||||
"requestedWalkTarget": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-14.0
|
||||
],
|
||||
@@ -554,7 +578,7 @@
|
||||
"targetFacingAngle": 0.0,
|
||||
"visibleRange": 6.5,
|
||||
"walkTarget": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-14.0
|
||||
]
|
||||
@@ -564,6 +588,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -571,7 +598,7 @@
|
||||
"facingAngle": 0.0,
|
||||
"homeDriftCheckTimer": 5.0,
|
||||
"homePosition": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-14.5
|
||||
],
|
||||
@@ -595,12 +622,12 @@
|
||||
"pathWaypoints": [
|
||||
],
|
||||
"position": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-14.5
|
||||
],
|
||||
"requestedWalkTarget": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-14.5
|
||||
],
|
||||
@@ -608,7 +635,7 @@
|
||||
"targetFacingAngle": 0.0,
|
||||
"visibleRange": 6.5,
|
||||
"walkTarget": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-14.5
|
||||
]
|
||||
@@ -618,6 +645,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -625,7 +655,7 @@
|
||||
"facingAngle": 0.0,
|
||||
"homeDriftCheckTimer": 5.0,
|
||||
"homePosition": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-14.5
|
||||
],
|
||||
@@ -649,12 +679,12 @@
|
||||
"pathWaypoints": [
|
||||
],
|
||||
"position": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-14.5
|
||||
],
|
||||
"requestedWalkTarget": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-12.5
|
||||
],
|
||||
@@ -662,7 +692,7 @@
|
||||
"targetFacingAngle": 0.0,
|
||||
"visibleRange": 6.5,
|
||||
"walkTarget": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-14.5
|
||||
]
|
||||
@@ -672,6 +702,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -679,7 +712,7 @@
|
||||
"facingAngle": 0.0,
|
||||
"homeDriftCheckTimer": 5.0,
|
||||
"homePosition": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-15.0
|
||||
],
|
||||
@@ -703,12 +736,12 @@
|
||||
"pathWaypoints": [
|
||||
],
|
||||
"position": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-15.0
|
||||
],
|
||||
"requestedWalkTarget": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-15.0
|
||||
],
|
||||
@@ -716,7 +749,7 @@
|
||||
"targetFacingAngle": 0.0,
|
||||
"visibleRange": 6.5,
|
||||
"walkTarget": [
|
||||
-5.5999999046325684,
|
||||
-5.6,
|
||||
0.0,
|
||||
-15.0
|
||||
]
|
||||
@@ -726,6 +759,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -733,7 +769,7 @@
|
||||
"facingAngle": 0.0,
|
||||
"homeDriftCheckTimer": 5.0,
|
||||
"homePosition": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-15.0
|
||||
],
|
||||
@@ -757,12 +793,12 @@
|
||||
"pathWaypoints": [
|
||||
],
|
||||
"position": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-15.0
|
||||
],
|
||||
"requestedWalkTarget": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-15.0
|
||||
],
|
||||
@@ -770,7 +806,7 @@
|
||||
"targetFacingAngle": 0.0,
|
||||
"visibleRange": 6.5,
|
||||
"walkTarget": [
|
||||
-6.4000000953674316,
|
||||
-6.4,
|
||||
0.0,
|
||||
-15.0
|
||||
]
|
||||
@@ -817,6 +853,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -860,6 +899,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": false,
|
||||
@@ -903,6 +945,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": false,
|
||||
@@ -946,6 +991,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": false,
|
||||
@@ -990,7 +1038,7 @@
|
||||
]
|
||||
},
|
||||
"savedAt": "2026-11-05 17:43",
|
||||
"schemaVersion": 5,
|
||||
"schemaVersion": 6,
|
||||
"taxiIsCalled": false,
|
||||
"tutorialJournalScreenOpened": false,
|
||||
"tutorialNeedOpenTaxiScreen": false,
|
||||
|
||||
@@ -132,6 +132,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -186,6 +189,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -240,6 +246,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -294,6 +303,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -348,6 +360,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -402,6 +417,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -456,6 +474,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -510,6 +531,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -564,6 +588,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -618,6 +645,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -672,6 +702,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -726,6 +759,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -817,6 +853,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": true,
|
||||
@@ -860,6 +899,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": false,
|
||||
@@ -903,6 +945,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": false,
|
||||
@@ -946,6 +991,9 @@
|
||||
"attackTargetId": "",
|
||||
"attack_cooldown": 0.0,
|
||||
"battle_state": 0,
|
||||
"attack": 0,
|
||||
"resetAnim": false,
|
||||
"velocity": [0, 0],
|
||||
"currentState": 0,
|
||||
"currentWaypointIndex": 0,
|
||||
"enabled": false,
|
||||
@@ -990,7 +1038,7 @@
|
||||
]
|
||||
},
|
||||
"savedAt": "2026-11-05 17:43",
|
||||
"schemaVersion": 5,
|
||||
"schemaVersion": 6,
|
||||
"taxiIsCalled": false,
|
||||
"tutorialJournalScreenOpened": false,
|
||||
"tutorialNeedOpenTaxiScreen": false,
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
"y": 10,
|
||||
"width": 160,
|
||||
"height": 36,
|
||||
"text": "v. 1.1.2",
|
||||
"text": "v. 1.1.3",
|
||||
"fontSize": 24,
|
||||
"textCentered": false,
|
||||
"topAligned": true,
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
"y": 10,
|
||||
"width": 160,
|
||||
"height": 36,
|
||||
"text": "v. 1.1.2",
|
||||
"text": "v. 1.1.3",
|
||||
"fontSize": 24,
|
||||
"textCentered": false,
|
||||
"topAligned": true,
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
"y": 10,
|
||||
"width": 160,
|
||||
"height": 36,
|
||||
"text": "v. 1.1.2",
|
||||
"text": "v. 1.1.3",
|
||||
"fontSize": 24,
|
||||
"textCentered": false,
|
||||
"topAligned": true,
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
"y": 10,
|
||||
"width": 160,
|
||||
"height": 36,
|
||||
"text": "v. 1.1.2",
|
||||
"text": "v. 1.1.3",
|
||||
"fontSize": 24,
|
||||
"textCentered": false,
|
||||
"topAligned": true,
|
||||
|
||||
+3
-3
@@ -152,9 +152,9 @@ int main(int argc, char** argv)
|
||||
"' is missing from the initial state");
|
||||
}
|
||||
compatibilityFingerprint =
|
||||
campaign->networkCompatibility.empty()
|
||||
? "lockstep-v2:" + campaignId
|
||||
: campaign->networkCompatibility;
|
||||
FRG::makeNetworkCompatibilityFingerprint(*campaign);
|
||||
std::cout << "[server] Compatibility fingerprint: "
|
||||
<< compatibilityFingerprint << '\n';
|
||||
if (!campaign->tutorial) {
|
||||
server.submit(FRG::SetTutorialStepCommand{
|
||||
FRG::TutorialStep::Completed});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "LocationGameState.h"
|
||||
#include "game_server/InternalGameServer.h"
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
@@ -12,6 +13,19 @@ int fail(const char* message)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
FRG::Vec3fp point(float x, float y, float z)
|
||||
{
|
||||
return {
|
||||
static_cast<FRG::fp>(x),
|
||||
static_cast<FRG::fp>(y),
|
||||
static_cast<FRG::fp>(z)};
|
||||
}
|
||||
|
||||
bool samePoint(const FRG::Vec3fp& left, const FRG::Vec3fp& right)
|
||||
{
|
||||
return left.x == right.x && left.y == right.y && left.z == right.z;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main()
|
||||
@@ -74,17 +88,34 @@ int main()
|
||||
!singlePlayerBattleZone || !multiplayerBattleZoneConfig) {
|
||||
return fail("Expected three campaigns including both Battle Zone modes");
|
||||
}
|
||||
if (singlePlayerBattleZone->startStatePath !=
|
||||
multiplayerBattleZoneConfig->startStatePath) {
|
||||
return fail("Battle Zone modes do not share their initial state");
|
||||
if (singlePlayerBattleZone->startStatePath.empty() ||
|
||||
multiplayerBattleZoneConfig->startStatePath.empty()) {
|
||||
return fail("Battle Zone modes are missing initial state paths");
|
||||
}
|
||||
if (multiplayerBattleZoneConfig->networkPlayerSlots.size() != 2 ||
|
||||
if (multiplayerBattleZoneConfig->networkPlayerSlots.size() != 4 ||
|
||||
multiplayerBattleZoneConfig->networkPlayerSlots[0] != "player1" ||
|
||||
multiplayerBattleZoneConfig->networkPlayerSlots[1] !=
|
||||
"player2" ||
|
||||
multiplayerBattleZoneConfig->networkPlayerSlots[2] != "player3" ||
|
||||
multiplayerBattleZoneConfig->networkPlayerSlots[3] != "player4" ||
|
||||
multiplayerBattleZoneConfig->networkCompatibility.empty()) {
|
||||
return fail("Multiplayer player slots were not loaded");
|
||||
}
|
||||
const std::string compatibilityFingerprint =
|
||||
FRG::makeNetworkCompatibilityFingerprint(
|
||||
*multiplayerBattleZoneConfig);
|
||||
FRG::CampaignConfig reorderedContent = *multiplayerBattleZoneConfig;
|
||||
if (reorderedContent.locations.empty() ||
|
||||
reorderedContent.locations.front().navigationJsonPaths.size() < 2) {
|
||||
return fail("Expected multiple navigation maps for fingerprint test");
|
||||
}
|
||||
std::reverse(
|
||||
reorderedContent.locations.front().navigationJsonPaths.begin(),
|
||||
reorderedContent.locations.front().navigationJsonPaths.end());
|
||||
if (compatibilityFingerprint ==
|
||||
FRG::makeNetworkCompatibilityFingerprint(reorderedContent)) {
|
||||
return fail("Compatibility fingerprint ignored navigation-map order");
|
||||
}
|
||||
|
||||
FRG::LocationDefinition definition;
|
||||
definition.config.id = "test_location";
|
||||
@@ -152,18 +183,18 @@ int main()
|
||||
hostileNpc.enabled = true;
|
||||
hostileNpc.canAttack = true;
|
||||
hostileNpc.hp = hostileNpc.initialHp = 75.f;
|
||||
hostileNpc.position = Eigen::Vector3f::Zero();
|
||||
hostileNpc.homePosition = {5.f, 0.f, 0.f};
|
||||
hostileNpc.position = point(0.f, 0.f, 0.f);
|
||||
hostileNpc.homePosition = point(5.f, 0.f, 0.f);
|
||||
hostileNpc.stopInPlace();
|
||||
|
||||
auto playerOne = std::make_shared<FRG::CharacterState>();
|
||||
playerOne->configureAsPlayer();
|
||||
playerOne->enabled = true;
|
||||
playerOne->position = {3.f, 0.f, 0.f};
|
||||
playerOne->position = point(3.f, 0.f, 0.f);
|
||||
auto playerTwo = std::make_shared<FRG::CharacterState>();
|
||||
playerTwo->configureAsPlayer();
|
||||
playerTwo->enabled = true;
|
||||
playerTwo->position = {2.f, 0.f, 0.f};
|
||||
playerTwo->position = point(2.f, 0.f, 0.f);
|
||||
FRG::PlayerStateMap combatPlayers{
|
||||
{"player1", playerOne}, {"player2", playerTwo}};
|
||||
|
||||
@@ -172,8 +203,8 @@ int main()
|
||||
return fail("Hostile NPC did not select the nearest player");
|
||||
}
|
||||
|
||||
playerOne->position = {1.f, 0.f, 0.f};
|
||||
playerTwo->position = {4.f, 0.f, 0.f};
|
||||
playerOne->position = point(1.f, 0.f, 0.f);
|
||||
playerTwo->position = point(4.f, 0.f, 0.f);
|
||||
state.update(100, combatPlayers, false);
|
||||
if (hostileNpc.attackTargetId != "player2") {
|
||||
return fail("Hostile NPC did not retain its living target lock");
|
||||
@@ -189,64 +220,12 @@ int main()
|
||||
state.update(100, combatPlayers, false);
|
||||
if (!hostileNpc.attackTargetId.empty() ||
|
||||
hostileNpc.battle_state != 0 ||
|
||||
(hostileNpc.requestedWalkTarget - hostileNpc.homePosition).norm() >
|
||||
FRG::CharacterState::kWalkThreshold) {
|
||||
(hostileNpc.requestedWalkTarget -
|
||||
hostileNpc.homePosition).normSquared() >
|
||||
FRG::CharacterState::kWalkThreshold_SQUARED()) {
|
||||
return fail("Hostile NPC did not return home after losing its target");
|
||||
}
|
||||
|
||||
auto blocker = std::make_shared<FRG::CharacterState>();
|
||||
blocker->enabled = true;
|
||||
blocker->hp = 50.f;
|
||||
blocker->position = {0.8f, 0.f, 0.f};
|
||||
state.npcs["blocker"] = blocker;
|
||||
hostileNpc.position = Eigen::Vector3f::Zero();
|
||||
hostileNpc.homePosition = {5.f, 0.f, 0.f};
|
||||
hostileNpc.attackTargetId = "player1";
|
||||
hostileNpc.requestedWalkTarget = playerOne->position;
|
||||
hostileNpc.walkTarget = playerOne->position;
|
||||
hostileNpc.pathWaypoints = {playerOne->position};
|
||||
hostileNpc.currentWaypointIndex = 0;
|
||||
hostileNpc.movementBlockedTicks = 0;
|
||||
playerOne->enabled = true;
|
||||
playerOne->hp = 75.f;
|
||||
playerOne->position = {4.f, 0.f, 0.f};
|
||||
playerTwo->enabled = true;
|
||||
playerTwo->hp = 75.f;
|
||||
playerTwo->position = {2.f, 0.f, 0.f};
|
||||
|
||||
bool blockedRetryRequested = false;
|
||||
for (int tick = 0; tick < 10 && !blockedRetryRequested; ++tick) {
|
||||
const FRG::LocationSimulationEvents events =
|
||||
state.update(100, combatPlayers, false);
|
||||
for (const auto& event : events.characters) {
|
||||
if (event.characterId == "npc" &&
|
||||
event.events.forceNavigationReplan) {
|
||||
blockedRetryRequested = true;
|
||||
if (!state.replanCharacter(
|
||||
"npc", combatPlayers,
|
||||
event.events.blockingCharacterId)) {
|
||||
return fail("Blocked NPC replan was rejected");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!blockedRetryRequested ||
|
||||
hostileNpc.attackTargetId != "player2" ||
|
||||
(hostileNpc.requestedWalkTarget - playerTwo->position).norm() >
|
||||
FRG::CharacterState::kWalkThreshold) {
|
||||
return fail("Blocked NPC did not switch to the nearest player");
|
||||
}
|
||||
|
||||
playerOne->enabled = false;
|
||||
playerTwo->enabled = false;
|
||||
if (!state.replanCharacter("npc", combatPlayers, "blocker") ||
|
||||
!hostileNpc.attackTargetId.empty() ||
|
||||
hostileNpc.battle_state != 0 ||
|
||||
(hostileNpc.requestedWalkTarget - hostileNpc.homePosition).norm() >
|
||||
FRG::CharacterState::kWalkThreshold) {
|
||||
return fail("Blocked NPC did not return home without an eligible target");
|
||||
}
|
||||
|
||||
FRG::CampaignConfig battleZone;
|
||||
battleZone.id = "battle_zone";
|
||||
battleZone.questsPath = "resources/config/quests_battle_zone.json";
|
||||
@@ -295,8 +274,9 @@ int main()
|
||||
return fail(
|
||||
"Loaded multiplayer slot did not restore animation metadata");
|
||||
}
|
||||
if (!loadedNetworkBot->second.state.position.isApprox(
|
||||
Eigen::Vector3f(4.f, 0.f, 5.f))) {
|
||||
if (!samePoint(
|
||||
loadedNetworkBot->second.state.position,
|
||||
point(4.f, 0.f, 5.f))) {
|
||||
return fail("Loaded multiplayer slot position was overwritten");
|
||||
}
|
||||
if (loadedNetworkBot->second.state.enabled)
|
||||
@@ -304,19 +284,19 @@ int main()
|
||||
|
||||
const std::string locationId = loadedNetworkSnapshot->currentLocationId;
|
||||
networkServer.submit(FRG::SetCharacterPositionCommand{
|
||||
locationId, "player2", Eigen::Vector3f(7.f, 0.f, 8.f), true});
|
||||
locationId, "player2", point(7.f, 0.f, 8.f), true});
|
||||
networkServer.submit(FRG::SetCharacterFacingAngleCommand{
|
||||
locationId, "player2", 1.5f, true});
|
||||
locationId, "player2", FRG::fp(1.5f), true});
|
||||
networkServer.submit(FRG::SetCharacterFaceTargetCommand{
|
||||
locationId, "player2", "player1"});
|
||||
networkServer.submit(FRG::SetCharacterEnabledCommand{
|
||||
locationId, "player2", false});
|
||||
const auto commandSnapshot = networkServer.snapshot();
|
||||
const auto commandCharacter = commandSnapshot->players.at("player2").state;
|
||||
if (!commandCharacter.position.isApprox(Eigen::Vector3f(7.f, 0.f, 8.f)) ||
|
||||
!commandCharacter.homePosition.isApprox(Eigen::Vector3f(7.f, 0.f, 8.f)) ||
|
||||
commandCharacter.facingAngle != 1.5f ||
|
||||
commandCharacter.targetFacingAngle != 1.5f ||
|
||||
if (!samePoint(commandCharacter.position, point(7.f, 0.f, 8.f)) ||
|
||||
!samePoint(commandCharacter.homePosition, point(7.f, 0.f, 8.f)) ||
|
||||
commandCharacter.facingAngle != FRG::fp(1.5f) ||
|
||||
commandCharacter.targetFacingAngle != FRG::fp(1.5f) ||
|
||||
!commandCharacter.faceTargetId.empty() ||
|
||||
commandCharacter.enabled) {
|
||||
return fail("Semantic character commands were not applied");
|
||||
@@ -330,61 +310,20 @@ int main()
|
||||
}
|
||||
|
||||
FRG::CharacterState guardedMover;
|
||||
guardedMover.configureAsPlayer();
|
||||
guardedMover.enabled = true;
|
||||
guardedMover.position = Eigen::Vector3f::Zero();
|
||||
guardedMover.walkTarget = Eigen::Vector3f(2.f, 0.f, 0.f);
|
||||
guardedMover.requestedWalkTarget = guardedMover.walkTarget;
|
||||
guardedMover.pathWaypoints = {guardedMover.walkTarget};
|
||||
const std::vector<FRG::CharacterMovementObstacle> movementObstacles{
|
||||
{"mover", Eigen::Vector3f::Zero(), 0.45f},
|
||||
{"blocker", Eigen::Vector3f(0.8f, 0.f, 0.f), 0.45f}};
|
||||
FRG::CharacterUpdateContext guardedContext;
|
||||
guardedContext.characterId = "mover";
|
||||
guardedContext.movementObstacles = &movementObstacles;
|
||||
FRG::CharacterUpdateEvents blockedEvents;
|
||||
for (int i = 0; i < 3; ++i)
|
||||
blockedEvents = guardedMover.update(100, guardedContext);
|
||||
if (!guardedMover.position.isZero() ||
|
||||
blockedEvents.forceNavigationReplan ||
|
||||
!guardedMover.pathWaypoints.empty()) {
|
||||
return fail("Movement guard did not cancel the blocked player action");
|
||||
}
|
||||
nlohmann::json guardedJson;
|
||||
guardedMover.velocity = {
|
||||
FRG::fp::from_raw_value(12345),
|
||||
FRG::fp::from_raw_value(-6789)};
|
||||
guardedMover.save(guardedJson);
|
||||
FRG::CharacterState restoredGuardedMover;
|
||||
restoredGuardedMover.load(guardedJson);
|
||||
if (restoredGuardedMover.movementBlockedTicks !=
|
||||
guardedMover.movementBlockedTicks ||
|
||||
restoredGuardedMover.navigationRetryTicks !=
|
||||
guardedMover.navigationRetryTicks) {
|
||||
return fail("Movement blockage state did not round trip");
|
||||
}
|
||||
|
||||
FRG::LocationGameState occupancyState;
|
||||
auto stationary = std::make_shared<FRG::CharacterState>();
|
||||
stationary->enabled = true;
|
||||
stationary->hp = 10.f;
|
||||
stationary->position = Eigen::Vector3f(4.f, 0.f, 0.f);
|
||||
auto moving = std::make_shared<FRG::CharacterState>();
|
||||
moving->enabled = true;
|
||||
moving->hp = 10.f;
|
||||
moving->pathWaypoints = {Eigen::Vector3f(8.f, 0.f, 0.f)};
|
||||
moving->movedLastTick = true;
|
||||
moving->attackTargetId = "stationary";
|
||||
FRG::PlayerStateMap occupancyPlayers{
|
||||
{"stationary", stationary}, {"moving", moving}};
|
||||
if (occupancyState.collectPathObstacles(
|
||||
"requester", occupancyPlayers).size() != 1 ||
|
||||
occupancyState.collectPathObstacles(
|
||||
"requester", occupancyPlayers, "moving").size() != 2 ||
|
||||
!occupancyState.collectPathObstacles(
|
||||
"stationary", occupancyPlayers).empty() ||
|
||||
!occupancyState.collectPathObstacles(
|
||||
"moving", occupancyPlayers).empty() ||
|
||||
occupancyState.collectPathObstacles(
|
||||
"moving", occupancyPlayers, "stationary").size() != 1) {
|
||||
return fail("Stationary obstacle collection policy is incorrect");
|
||||
guardedMover.navigationRetryTicks ||
|
||||
restoredGuardedMover.velocity.x.raw_value() != 12345 ||
|
||||
restoredGuardedMover.velocity.y.raw_value() != -6789) {
|
||||
return fail("Character velocity did not round trip");
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@@ -13,6 +13,16 @@ void require(bool condition, const char* message)
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
FRG::Vec3fp point(float x, float y, float z)
|
||||
{
|
||||
return {FRG::fp(x), FRG::fp(y), FRG::fp(z)};
|
||||
}
|
||||
|
||||
bool samePoint(const FRG::Vec3fp& left, const FRG::Vec3fp& right)
|
||||
{
|
||||
return left.x == right.x && left.y == right.y && left.z == right.z;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main()
|
||||
@@ -49,7 +59,7 @@ int main()
|
||||
|
||||
FRG::DestinationInputMessage input;
|
||||
input.clientSequence = 7;
|
||||
input.target = Eigen::Vector3f(1.234f, 0.f, -5.678f);
|
||||
input.target = point(1.234f, 0.f, -5.678f);
|
||||
FRG::DestinationInputMessage parsedInput;
|
||||
require(
|
||||
FRG::parseDestinationInputMessage(
|
||||
@@ -57,7 +67,7 @@ int main()
|
||||
"destination input did not round trip");
|
||||
require(
|
||||
parsedInput.clientSequence == 7 &&
|
||||
parsedInput.target.isApprox(Eigen::Vector3f(1.23f, 0.f, -5.68f)),
|
||||
samePoint(parsedInput.target, input.target),
|
||||
"destination input was not normalized");
|
||||
|
||||
FRG::CharacterActionInputMessage actionInput{
|
||||
@@ -147,9 +157,9 @@ int main()
|
||||
|
||||
FRG::LockstepTimeline timeline(2);
|
||||
const std::uint64_t firstSequence =
|
||||
timeline.schedule("player1", Eigen::Vector3f(1.f, 0.f, 1.f));
|
||||
timeline.schedule("player1", point(1.f, 0.f, 1.f));
|
||||
const std::uint64_t secondSequence =
|
||||
timeline.schedule("player2", Eigen::Vector3f(2.f, 0.f, 2.f));
|
||||
timeline.schedule("player2", point(2.f, 0.f, 2.f));
|
||||
const FRG::TickMessage emptyTick = timeline.advance();
|
||||
require(
|
||||
emptyTick.tickId == 1 && emptyTick.commands.empty(),
|
||||
|
||||
@@ -16,6 +16,16 @@ void require(bool condition, const char* message)
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
FRG::Vec3fp point(float x, float y, float z)
|
||||
{
|
||||
return {FRG::fp(x), FRG::fp(y), FRG::fp(z)};
|
||||
}
|
||||
|
||||
bool samePoint(const FRG::Vec3fp& left, const FRG::Vec3fp& right)
|
||||
{
|
||||
return left.x == right.x && left.y == right.y && left.z == right.z;
|
||||
}
|
||||
|
||||
template <class Predicate>
|
||||
bool waitFor(Predicate predicate)
|
||||
{
|
||||
@@ -28,6 +38,15 @@ bool waitFor(Predicate predicate)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool sameMovement(
|
||||
const FRG::CharacterState& left, const FRG::CharacterState& right)
|
||||
{
|
||||
return left.position.x.raw_value() == right.position.x.raw_value() &&
|
||||
left.position.z.raw_value() == right.position.z.raw_value() &&
|
||||
left.velocity.x.raw_value() == right.velocity.x.raw_value() &&
|
||||
left.velocity.y.raw_value() == right.velocity.y.raw_value();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main()
|
||||
@@ -70,7 +89,22 @@ int main()
|
||||
auto hostileNpc = std::make_shared<FRG::CharacterState>();
|
||||
hostileNpc->enabled = true;
|
||||
hostileNpc->hp = 200.f;
|
||||
hostileNpc->position = point(-1.f, 0.f, 0.f);
|
||||
hostileNpc->walkTarget = point(4.f, 0.f, 0.f);
|
||||
hostileNpc->requestedWalkTarget = hostileNpc->walkTarget;
|
||||
hostileNpc->pathWaypoints = {hostileNpc->walkTarget};
|
||||
hostileNpc->velocity = {FRG::fp(1.5f), FRG::fp(0.f)};
|
||||
testLocation.npcs.emplace("hostile_npc", std::move(hostileNpc));
|
||||
auto secondHostileNpc = std::make_shared<FRG::CharacterState>();
|
||||
secondHostileNpc->enabled = true;
|
||||
secondHostileNpc->hp = 200.f;
|
||||
secondHostileNpc->position = point(1.f, 0.f, 0.f);
|
||||
secondHostileNpc->walkTarget = point(-4.f, 0.f, 0.f);
|
||||
secondHostileNpc->requestedWalkTarget = secondHostileNpc->walkTarget;
|
||||
secondHostileNpc->pathWaypoints = {secondHostileNpc->walkTarget};
|
||||
secondHostileNpc->velocity = {FRG::fp(-1.5f), FRG::fp(0.f)};
|
||||
testLocation.npcs.emplace(
|
||||
"hostile_npc_2", std::move(secondHostileNpc));
|
||||
nlohmann::json testLocationState;
|
||||
testLocation.save(testLocationState);
|
||||
initialState["currentLocationId"] = "test_location";
|
||||
@@ -93,6 +127,22 @@ int main()
|
||||
"client did not receive initial state");
|
||||
require(client->localPlayerId() == "player1", "wrong player slot assigned");
|
||||
|
||||
// Advance avoidance before the second client joins. Its initial snapshot must
|
||||
// carry previous-tick velocity or its very next ORCA result will diverge.
|
||||
server.update();
|
||||
require(
|
||||
waitFor([&]() {
|
||||
client->update(0);
|
||||
const auto first = client->snapshot();
|
||||
const auto host = authoritative.snapshot();
|
||||
return sameMovement(
|
||||
first->locations.at("test_location").npcs.at(
|
||||
"hostile_npc").state,
|
||||
host->locations.at("test_location").npcs.at(
|
||||
"hostile_npc").state);
|
||||
}),
|
||||
"first client did not apply the pre-join movement tick");
|
||||
|
||||
auto secondClient = std::make_unique<FRG::WebsocketGameClient>(
|
||||
"127.0.0.1", std::to_string(server.port()), "/");
|
||||
require(
|
||||
@@ -126,10 +176,34 @@ int main()
|
||||
authoritative.snapshot()->players.at("player2").state.enabled,
|
||||
"connection presence was not broadcast to all replicas");
|
||||
|
||||
for (int tick = 0; tick < 6; ++tick) server.update();
|
||||
require(
|
||||
waitFor([&]() {
|
||||
client->update(0);
|
||||
secondClient->update(0);
|
||||
const auto first = client->snapshot();
|
||||
const auto second = secondClient->snapshot();
|
||||
const auto host = authoritative.snapshot();
|
||||
for (const char* id : {"hostile_npc", "hostile_npc_2"}) {
|
||||
const auto& hostState =
|
||||
host->locations.at("test_location").npcs.at(id).state;
|
||||
if (!sameMovement(
|
||||
first->locations.at("test_location").npcs.at(id).state,
|
||||
hostState) ||
|
||||
!sameMovement(
|
||||
second->locations.at("test_location").npcs.at(id).state,
|
||||
hostState)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}),
|
||||
"late-joining client diverged during character avoidance");
|
||||
|
||||
client->submit(FRG::SetCharacterDestinationCommand{
|
||||
{}, "spoofed", Eigen::Vector3f(1.234f, 0.f, 2.345f), "ignored"});
|
||||
{}, "spoofed", point(1.234f, 0.f, 2.345f), "ignored"});
|
||||
secondClient->submit(FRG::SetCharacterDestinationCommand{
|
||||
{}, "spoofed", Eigen::Vector3f(-1.234f, 0.f, 3.456f), "ignored"});
|
||||
{}, "spoofed", point(-1.234f, 0.f, 3.456f), "ignored"});
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
server.update();
|
||||
server.update();
|
||||
@@ -140,17 +214,23 @@ int main()
|
||||
const auto first = client->snapshot();
|
||||
const auto second = secondClient->snapshot();
|
||||
const auto host = authoritative.snapshot();
|
||||
return first->players.at("player1").state.requestedWalkTarget.isApprox(
|
||||
Eigen::Vector3f(1.23f, 0.f, 2.35f)) &&
|
||||
second->players.at("player2").state.requestedWalkTarget.isApprox(
|
||||
Eigen::Vector3f(-1.23f, 0.f, 3.46f)) &&
|
||||
first->players.at("player2").state.requestedWalkTarget.isApprox(
|
||||
return samePoint(
|
||||
first->players.at("player1").state.requestedWalkTarget,
|
||||
point(1.234f, 0.f, 2.345f)) &&
|
||||
samePoint(
|
||||
second->players.at("player2").state.requestedWalkTarget,
|
||||
point(-1.234f, 0.f, 3.456f)) &&
|
||||
samePoint(
|
||||
first->players.at("player2").state.requestedWalkTarget,
|
||||
second->players.at("player2").state.requestedWalkTarget) &&
|
||||
second->players.at("player1").state.requestedWalkTarget.isApprox(
|
||||
samePoint(
|
||||
second->players.at("player1").state.requestedWalkTarget,
|
||||
first->players.at("player1").state.requestedWalkTarget) &&
|
||||
host->players.at("player1").state.requestedWalkTarget.isApprox(
|
||||
samePoint(
|
||||
host->players.at("player1").state.requestedWalkTarget,
|
||||
first->players.at("player1").state.requestedWalkTarget) &&
|
||||
host->players.at("player2").state.requestedWalkTarget.isApprox(
|
||||
samePoint(
|
||||
host->players.at("player2").state.requestedWalkTarget,
|
||||
second->players.at("player2").state.requestedWalkTarget);
|
||||
});
|
||||
if (!destinationsConverged) {
|
||||
@@ -160,13 +240,13 @@ int main()
|
||||
std::cerr << "destination revisions " << first->revision << ", "
|
||||
<< second->revision << ", " << host->revision << "\n"
|
||||
<< "player targets "
|
||||
<< first->players.at("player1").state.requestedWalkTarget.transpose()
|
||||
<< first->players.at("player1").state.requestedWalkTarget.toEigen().transpose()
|
||||
<< " / "
|
||||
<< host->players.at("player1").state.requestedWalkTarget.transpose()
|
||||
<< host->players.at("player1").state.requestedWalkTarget.toEigen().transpose()
|
||||
<< "\nplayer2 targets "
|
||||
<< second->players.at("player2").state.requestedWalkTarget.transpose()
|
||||
<< second->players.at("player2").state.requestedWalkTarget.toEigen().transpose()
|
||||
<< " / "
|
||||
<< host->players.at("player2").state.requestedWalkTarget.transpose()
|
||||
<< host->players.at("player2").state.requestedWalkTarget.toEigen().transpose()
|
||||
<< std::endl;
|
||||
}
|
||||
require(
|
||||
@@ -218,8 +298,17 @@ int main()
|
||||
waitFor([&]() {
|
||||
client->update(0);
|
||||
secondClient->update(0);
|
||||
return client->snapshot()->revision ==
|
||||
secondClient->snapshot()->revision;
|
||||
const auto host = authoritative.snapshot();
|
||||
return sameMovement(
|
||||
client->snapshot()->locations.at("test_location").npcs.at(
|
||||
"hostile_npc").state,
|
||||
host->locations.at("test_location").npcs.at(
|
||||
"hostile_npc").state) &&
|
||||
sameMovement(
|
||||
secondClient->snapshot()->locations.at(
|
||||
"test_location").npcs.at("hostile_npc").state,
|
||||
host->locations.at("test_location").npcs.at(
|
||||
"hostile_npc").state);
|
||||
}),
|
||||
"attack combo command was not rebroadcast in lockstep");
|
||||
|
||||
|
||||
@@ -1,13 +1,87 @@
|
||||
#include "Campaign.h"
|
||||
#include "utils/Utils.h"
|
||||
#include "external/nlohmann/json.hpp"
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <cstdint>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
namespace FRG {
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace {
|
||||
|
||||
void hashBytes(std::uint64_t& hash, const void* data, std::size_t size)
|
||||
{
|
||||
const auto* bytes = static_cast<const unsigned char*>(data);
|
||||
for (std::size_t i = 0; i < size; ++i) {
|
||||
hash ^= bytes[i];
|
||||
hash *= 1099511628211ull;
|
||||
}
|
||||
}
|
||||
|
||||
void hashString(std::uint64_t& hash, const std::string& value)
|
||||
{
|
||||
const std::uint64_t size = static_cast<std::uint64_t>(value.size());
|
||||
hashBytes(hash, &size, sizeof(size));
|
||||
hashBytes(hash, value.data(), value.size());
|
||||
}
|
||||
|
||||
bool hasAnimationExtension(const std::string& value)
|
||||
{
|
||||
if (value.size() < 5) return false;
|
||||
std::string extension = value.substr(value.size() - 5);
|
||||
std::transform(
|
||||
extension.begin(), extension.end(), extension.begin(),
|
||||
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
||||
return extension == ".anim";
|
||||
}
|
||||
|
||||
void collectAnimationPaths(
|
||||
const json& value, std::set<std::string>& animationPaths)
|
||||
{
|
||||
if (value.is_string()) {
|
||||
const std::string path = value.get<std::string>();
|
||||
if (hasAnimationExtension(path)) animationPaths.insert(path);
|
||||
return;
|
||||
}
|
||||
if (value.is_array()) {
|
||||
for (const auto& child : value)
|
||||
collectAnimationPaths(child, animationPaths);
|
||||
return;
|
||||
}
|
||||
if (value.is_object()) {
|
||||
for (const auto& [key, child] : value.items()) {
|
||||
(void)key;
|
||||
collectAnimationPaths(child, animationPaths);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<char> readCompatibilityResource(
|
||||
const std::string& path, const std::string& zipFile)
|
||||
{
|
||||
const std::vector<char> bytes =
|
||||
zipFile.empty() ? readFile(path) : readFileFromZIP(path, zipFile);
|
||||
if (bytes.empty())
|
||||
throw std::runtime_error(
|
||||
"Cannot fingerprint missing or empty resource '" + path + "'");
|
||||
return bytes;
|
||||
}
|
||||
|
||||
void addPath(std::set<std::string>& paths, const std::string& path)
|
||||
{
|
||||
if (!path.empty()) paths.insert(path);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
static bool parseJsonFile(const std::string& path, const std::string& zipFile, json& out) {
|
||||
const std::string content = readLocalizedConfigFile(path, zipFile);
|
||||
if (content.empty()) {
|
||||
@@ -91,6 +165,111 @@ namespace FRG {
|
||||
return (loc && !loc->loadingScreenPath.empty()) ? loc->loadingScreenPath : loadingScreenPath;
|
||||
}
|
||||
|
||||
std::string makeNetworkCompatibilityFingerprint(
|
||||
const CampaignConfig& campaign, const std::string& zipFile)
|
||||
{
|
||||
const std::string versionLabel = campaign.networkCompatibility.empty()
|
||||
? "lockstep-v2:" + campaign.id
|
||||
: campaign.networkCompatibility;
|
||||
|
||||
json manifest{
|
||||
{"simulationVersion", kDeterministicSimulationVersion},
|
||||
{"versionLabel", versionLabel},
|
||||
{"campaignId", campaign.id},
|
||||
{"startLocation", campaign.startLocation},
|
||||
{"networkPlayerSlots", campaign.networkPlayerSlots},
|
||||
{"startStatePath", campaign.startStatePath},
|
||||
{"questsPath", campaign.questsPath},
|
||||
{"locations", json::array()}
|
||||
};
|
||||
|
||||
std::set<std::string> resourcePaths;
|
||||
addPath(resourcePaths, campaign.startStatePath);
|
||||
addPath(resourcePaths, campaign.questsPath);
|
||||
for (std::size_t i = 0; i < campaign.locations.size(); ++i) {
|
||||
const LocationConfig& location = campaign.locations[i];
|
||||
const std::string configPath =
|
||||
i < campaign.locationConfigPaths.size()
|
||||
? campaign.locationConfigPaths[i] : std::string();
|
||||
addPath(resourcePaths, configPath);
|
||||
addPath(resourcePaths, location.gameObjectsJsonPath);
|
||||
addPath(resourcePaths, location.interactiveObjectsJsonPath);
|
||||
addPath(resourcePaths, location.npcsJsonPath);
|
||||
addPath(resourcePaths, location.teleportsJsonPath);
|
||||
addPath(resourcePaths, location.triggerZonesJsonPath);
|
||||
for (const std::string& path : location.navigationJsonPaths)
|
||||
addPath(resourcePaths, path);
|
||||
|
||||
json locationManifest{
|
||||
{"id", location.id},
|
||||
{"configPath", configPath},
|
||||
{"gameObjects", location.gameObjectsJsonPath},
|
||||
{"interactiveObjects", location.interactiveObjectsJsonPath},
|
||||
{"npcs", location.npcsJsonPath},
|
||||
{"navigation", location.navigationJsonPaths},
|
||||
{"teleports", location.teleportsJsonPath},
|
||||
{"triggerZones", location.triggerZonesJsonPath},
|
||||
{"playerPosition", {
|
||||
location.playerPosition.x.raw_value(),
|
||||
location.playerPosition.y.raw_value(),
|
||||
location.playerPosition.z.raw_value()}},
|
||||
{"lockInteractiveObjectsDuringTutorial",
|
||||
location.lockInteractiveObjectsDuringTutorial}
|
||||
};
|
||||
if (location.taxi) {
|
||||
const LocationConfig::Taxi& taxi = *location.taxi;
|
||||
locationManifest["taxi"] = {
|
||||
{"triggerPosition", {
|
||||
taxi.triggerPosition.x(), taxi.triggerPosition.y(),
|
||||
taxi.triggerPosition.z()}},
|
||||
{"waypoints", json::array()},
|
||||
{"initialPosition", {
|
||||
taxi.initialPosition.x(), taxi.initialPosition.y(),
|
||||
taxi.initialPosition.z()}},
|
||||
{"initialRotation", taxi.initialRotation},
|
||||
{"waypointReachRadius", taxi.waypointReachRadius}
|
||||
};
|
||||
for (const Eigen::Vector3f& waypoint : taxi.waypoints) {
|
||||
locationManifest["taxi"]["waypoints"].push_back({
|
||||
waypoint.x(), waypoint.y(), waypoint.z()});
|
||||
}
|
||||
}
|
||||
manifest["locations"].push_back(std::move(locationManifest));
|
||||
}
|
||||
|
||||
std::uint64_t hash = 1469598103934665603ull;
|
||||
hashString(hash, manifest.dump());
|
||||
std::set<std::string> animationPaths;
|
||||
for (const std::string& path : resourcePaths) {
|
||||
const std::vector<char> bytes =
|
||||
readCompatibilityResource(path, zipFile);
|
||||
hashString(hash, path);
|
||||
hashBytes(hash, bytes.data(), bytes.size());
|
||||
if (path.size() >= 5 &&
|
||||
path.substr(path.size() - 5) == ".json") {
|
||||
try {
|
||||
collectAnimationPaths(
|
||||
json::parse(bytes.begin(), bytes.end()), animationPaths);
|
||||
} catch (const std::exception& error) {
|
||||
throw std::runtime_error(
|
||||
"Cannot fingerprint invalid JSON resource '" + path +
|
||||
"': " + error.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const std::string& path : animationPaths) {
|
||||
const std::vector<char> bytes =
|
||||
readCompatibilityResource(path, zipFile);
|
||||
hashString(hash, path);
|
||||
hashBytes(hash, bytes.data(), bytes.size());
|
||||
}
|
||||
|
||||
std::ostringstream output;
|
||||
output << versionLabel << ":sim" << kDeterministicSimulationVersion
|
||||
<< ':' << std::hex << std::setfill('0') << std::setw(16) << hash;
|
||||
return output.str();
|
||||
}
|
||||
|
||||
CampaignRegistry& CampaignRegistry::instance() {
|
||||
static CampaignRegistry reg;
|
||||
return reg;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
namespace FRG {
|
||||
|
||||
inline constexpr int kDeterministicSimulationVersion = 1;
|
||||
|
||||
// One location of a campaign, loaded from resources/config/locations/<name>.json.
|
||||
// Optional paths may be left empty; Location::setup skips them.
|
||||
struct LocationConfig {
|
||||
@@ -72,6 +74,13 @@ namespace FRG {
|
||||
std::string loadingScreenFor(const std::string& locationId) const;
|
||||
};
|
||||
|
||||
// Combines the deterministic simulation version with the exact authoritative
|
||||
// resource bytes used by a campaign. Matching manual version labels alone are
|
||||
// not sufficient to establish lockstep compatibility.
|
||||
std::string makeNetworkCompatibilityFingerprint(
|
||||
const CampaignConfig& campaign,
|
||||
const std::string& zipFile = std::string());
|
||||
|
||||
// Campaigns listed in resources/config/campaigns.json, in display order.
|
||||
class CampaignRegistry {
|
||||
public:
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "LocationState.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace FRG {
|
||||
|
||||
@@ -499,6 +500,8 @@ void CharacterState::save(nlohmann::json& out) const
|
||||
out["hp"] = hp;
|
||||
out["enabled"] = enabled;
|
||||
out["battle_state"] = battle_state;
|
||||
out["attack"] = attack;
|
||||
out["resetAnim"] = resetAnim;
|
||||
out["currentState"] = static_cast<int>(currentState);
|
||||
out["attack_cooldown"] = attack_cooldown;
|
||||
out["showWeapon"] = showWeapon;
|
||||
@@ -517,6 +520,10 @@ void CharacterState::save(nlohmann::json& out) const
|
||||
out["movementBlockedTicks"] = movementBlockedTicks;
|
||||
out["navigationRetryTicks"] = navigationRetryTicks;
|
||||
out["movedLastTick"] = movedLastTick;
|
||||
out["velocity"] = {
|
||||
velocity.x.raw_value(),
|
||||
velocity.y.raw_value()
|
||||
};
|
||||
out["navigationRetryCooldownTicks"] = navigationRetryCooldownTicks;
|
||||
out["navigationRetryCooldownIndex"] = navigationRetryCooldownIndex;
|
||||
|
||||
@@ -549,6 +556,8 @@ void CharacterState::load(const nlohmann::json& in)
|
||||
visibleRange = static_cast<fp>(in.value("visibleRange", static_cast<double>(visibleRange)));
|
||||
enabled = in.value("enabled", enabled);
|
||||
battle_state = in.value("battle_state", battle_state);
|
||||
attack = in.at("attack").get<int>();
|
||||
resetAnim = in.at("resetAnim").get<bool>();
|
||||
currentState = static_cast<AnimationState>(in.value("currentState", static_cast<int>(currentState)));
|
||||
attack_cooldown = in.value("attack_cooldown", attack_cooldown);
|
||||
showWeapon = in.value("showWeapon", showWeapon);
|
||||
@@ -568,6 +577,16 @@ void CharacterState::load(const nlohmann::json& in)
|
||||
movementBlockedTicks = in.value("movementBlockedTicks", movementBlockedTicks);
|
||||
navigationRetryTicks = in.value("navigationRetryTicks", navigationRetryTicks);
|
||||
movedLastTick = in.value("movedLastTick", movedLastTick);
|
||||
const auto& velocityValue = in.at("velocity");
|
||||
if (!velocityValue.is_array() || velocityValue.size() != 2 ||
|
||||
!velocityValue[0].is_number_integer() ||
|
||||
!velocityValue[1].is_number_integer()) {
|
||||
throw std::runtime_error(
|
||||
"Character velocity must contain two fixed-point raw integers");
|
||||
}
|
||||
velocity = Vec2fp(
|
||||
fp::from_raw_value(velocityValue[0].get<std::int32_t>()),
|
||||
fp::from_raw_value(velocityValue[1].get<std::int32_t>()));
|
||||
navigationRetryCooldownTicks = in.value(
|
||||
"navigationRetryCooldownTicks", navigationRetryCooldownTicks);
|
||||
navigationRetryCooldownIndex = in.value(
|
||||
|
||||
@@ -72,8 +72,8 @@ public:
|
||||
|
||||
// --- Position / orientation ---
|
||||
Vec3fp position;
|
||||
fp facingAngle;
|
||||
fp targetFacingAngle;
|
||||
fp facingAngle{0};
|
||||
fp targetFacingAngle{0};
|
||||
|
||||
// --- Health ---
|
||||
float hp = 200.f;
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ struct StoredChatMessage {
|
||||
};
|
||||
|
||||
struct GameState : public ISaveable {
|
||||
static constexpr int kSchemaVersion = 5;
|
||||
static constexpr int kSchemaVersion = 6;
|
||||
|
||||
// --- World ---
|
||||
// Campaign being played (see CampaignRegistry).
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "WebsocketGameClient.h"
|
||||
#include "../Campaign.h"
|
||||
#include "../Location.h"
|
||||
#include "../utils/Utils.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace FRG {
|
||||
@@ -20,10 +21,11 @@ void RemoteGameServerHost::initializeCampaign(
|
||||
CampaignRegistry::instance().find(campaignId);
|
||||
if (!campaign)
|
||||
throw std::runtime_error("Unknown remote campaign '" + campaignId + "'");
|
||||
client_.expectCompatibility(
|
||||
campaign->networkCompatibility.empty()
|
||||
? "lockstep-v2:" + campaignId
|
||||
: campaign->networkCompatibility);
|
||||
const std::string fingerprint =
|
||||
makeNetworkCompatibilityFingerprint(*campaign, zipFile);
|
||||
logger() << "[network] Client compatibility fingerprint: "
|
||||
<< fingerprint << std::endl;
|
||||
client_.expectCompatibility(fingerprint);
|
||||
client_.replica_.startCampaign(*campaign, zipFile, true, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -617,12 +617,12 @@ void WebsocketGameClient::update(std::int64_t)
|
||||
if (!tick.stateHash.empty()) {
|
||||
nlohmann::json state;
|
||||
replica_.save(state);
|
||||
/*const std::string localHash = canonicalStateHash(std::move(state));
|
||||
const std::string localHash = canonicalStateHash(std::move(state));
|
||||
if (localHash != tick.stateHash) {
|
||||
std::cerr << "[network] Lockstep divergence at tick "
|
||||
<< tick.tickId << ": server=" << tick.stateHash
|
||||
<< ", client=" << localHash << '\n';
|
||||
}*/
|
||||
}
|
||||
}
|
||||
++nextExpectedTick_;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user