Add optional movement-state fields (isMoving, isSprinting, isSneaking, isJumping, weaponDrawn, movementSpeed) to transform packets and wire them end-to-end. Plugin changes: extend F4TNetworking API and RemotePlayerState, derive movement speed/jump state on the game-thread, validate values, include fields when formatting transform JSON, and add throttled remote movement-state logging. main.cpp adds sampling, speed/vertical calculations, jump hold logic, and change-detection to avoid extra sends. Networking parsing (F4TNetworking.cpp) reads optional booleans/floats safely, preserves backwards compatibility, and clears movement-state logs on disconnect. Proxy controller includes a TODO note for future animation use. Server and docs: update protocol and packet docs, dev-log, server README, and fake_client.py to parse/display optional fields safely. Also add several .cursor rule files for coding, documentation, protocol, project overview, and testing guidance. This milestone prepares the data model for later animation/behavior work while keeping existing relay behavior unchanged.
40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
---
|
|
description: Networking protocol compatibility and documentation rules
|
|
alwaysApply: true
|
|
---
|
|
|
|
# Protocol Rules
|
|
|
|
When modifying the networking protocol:
|
|
- Update protocol documentation whenever packet structure changes.
|
|
- Treat new fields as optional on receive unless the change is intentionally breaking.
|
|
- Use safe defaults when a field is missing.
|
|
- Do not rename protocol fields unless specifically requested.
|
|
- Preserve unknown JSON fields where possible.
|
|
|
|
Preserve existing field names, including:
|
|
- `type`
|
|
- `playerId`
|
|
- `x`, `y`, `z`
|
|
- `angleZ`
|
|
- `cellId`
|
|
- `worldspaceId`
|
|
- `movementType`
|
|
- `clientTime`
|
|
- `serverTime`
|
|
- `isMoving`
|
|
- `movementSpeed`
|
|
- `isSprinting`
|
|
- `isSneaking`
|
|
- `isJumping`
|
|
- `weaponDrawn`
|
|
|
|
When adding a new protocol field, make sure:
|
|
- The plugin sends it when appropriate.
|
|
- Receivers parse it safely and tolerate it being absent.
|
|
- The server preserves or relays it.
|
|
- `server/fake_client.py` is updated if useful for testing.
|
|
- Relevant protocol documentation is updated.
|
|
|
|
Protocol changes should avoid breaking already-working transform sync unless the requested change explicitly requires it.
|