|
| 1 | +# Movement Bootstrap Implementation Plan |
| 2 | + |
| 3 | +> For Hermes: use test-driven-development. Keep slices tiny and push one commit at a time. |
| 4 | +
|
| 5 | +Goal: accept a minimal MOVE packet in GAME, keep the session stable, and expose a project-owned minimal replication/ack path that is easy to test. |
| 6 | + |
| 7 | +Architecture: add a dedicated movement protocol package, then a tiny GAME-phase flow package, then stitch it into boot and the bootstrap runtime. Start with one-player deterministic behavior only; no visible-world fanout, no sync-position, no pathfinding. |
| 8 | + |
| 9 | +Tech stack: Go 1.26, existing frame/session packages, net/http/tcp runtime already in repo. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## Task 1: Freeze minimal MOVE packet codecs |
| 14 | +Objective: define the wire layouts for client MOVE and server MOVE replication. |
| 15 | + |
| 16 | +Files: |
| 17 | +- Create: `internal/proto/move/move.go` |
| 18 | +- Create: `internal/proto/move/move_test.go` |
| 19 | +- Update later docs only after code is green |
| 20 | + |
| 21 | +Steps: |
| 22 | +1. Write failing tests for: |
| 23 | + - client MOVE encode/decode |
| 24 | + - server MOVE encode/decode |
| 25 | + - invalid header/payload rejection |
| 26 | +2. Run: `go test ./internal/proto/move` |
| 27 | +3. Implement the smallest codec set to pass. |
| 28 | +4. Re-run: `go test ./internal/proto/move` |
| 29 | +5. Commit: `feat: add move packet codecs` |
| 30 | + |
| 31 | +## Task 2: Add a minimal GAME flow |
| 32 | +Objective: handle MOVE only when the session is already in GAME. |
| 33 | + |
| 34 | +Files: |
| 35 | +- Create: `internal/game/flow.go` |
| 36 | +- Create: `internal/game/flow_test.go` |
| 37 | + |
| 38 | +Steps: |
| 39 | +1. Write failing tests for: |
| 40 | + - accepting MOVE in GAME |
| 41 | + - rejecting MOVE outside GAME |
| 42 | + - returning one deterministic replication packet |
| 43 | +2. Run: `go test ./internal/game` |
| 44 | +3. Implement a tiny config-driven flow with no extra behavior. |
| 45 | +4. Re-run: `go test ./internal/game` |
| 46 | +5. Commit: `feat: add minimal game movement flow` |
| 47 | + |
| 48 | +## Task 3: Stitch movement into boot |
| 49 | +Objective: route GAME-phase packets through the new game flow. |
| 50 | + |
| 51 | +Files: |
| 52 | +- Modify: `internal/boot/flow.go` |
| 53 | +- Modify: `internal/boot/flow_test.go` |
| 54 | +- Modify: `internal/boot/flow_socket_test.go` |
| 55 | + |
| 56 | +Steps: |
| 57 | +1. Write failing tests for: |
| 58 | + - boot flow accepts MOVE after ENTERGAME |
| 59 | + - TCP path reaches GAME and survives one MOVE round-trip |
| 60 | +2. Run targeted failing tests. |
| 61 | +3. Implement the smallest boot wiring to pass. |
| 62 | +4. Re-run targeted tests, then `go test ./internal/boot`. |
| 63 | +5. Commit: `feat: route move packets through boot flow` |
| 64 | + |
| 65 | +## Task 4: Wire movement into bootstrap runtime |
| 66 | +Objective: make `gamed` emit a deterministic MOVE replication packet using the selected character VID. |
| 67 | + |
| 68 | +Files: |
| 69 | +- Modify: `internal/minimal/factory.go` |
| 70 | +- Modify: `internal/minimal/factory_test.go` |
| 71 | + |
| 72 | +Steps: |
| 73 | +1. Write failing tests for: |
| 74 | + - selected character can move in GAME |
| 75 | + - created character can move in GAME |
| 76 | +2. Run: `go test ./internal/minimal` |
| 77 | +3. Implement the smallest selected-character tracking needed. |
| 78 | +4. Re-run: `go test ./internal/minimal` |
| 79 | +5. Commit: `feat: add bootstrap movement handling` |
| 80 | + |
| 81 | +## Task 5: Update docs |
| 82 | +Objective: record the new GAME movement slice. |
| 83 | + |
| 84 | +Files: |
| 85 | +- Modify: `README.md` |
| 86 | +- Modify: `spec/protocol/packet-matrix.md` |
| 87 | +- Modify: `spec/protocol/boot-path.md` |
| 88 | +- Optionally create: `spec/protocol/movement.md` |
| 89 | + |
| 90 | +Steps: |
| 91 | +1. Document the frozen packet shapes and current limits. |
| 92 | +2. Run: `go test ./... && go vet ./...` |
| 93 | +3. Commit: `docs: document movement bootstrap slice` |
| 94 | + |
| 95 | +## Verification |
| 96 | +- `go test ./...` |
| 97 | +- `go vet ./...` |
| 98 | +- Boot TCP test covers: handshake -> login -> select/create -> enter game -> move |
| 99 | +- Runtime tests cover both pre-existing and newly-created characters |
| 100 | + |
| 101 | +## Scope guardrails |
| 102 | +- Do not add pathfinding |
| 103 | +- Do not add sync-position yet |
| 104 | +- Do not add multi-client fanout yet |
| 105 | +- Do not redesign world state yet |
| 106 | +- Keep all movement behavior deterministic and single-character |
0 commit comments