@typeonce/ritmo-netcode 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1 +1,41 @@
|
|
|
1
1
|
# @typeonce/ritmo-netcode
|
|
2
|
+
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- dbfbd9d: **New package: `@typeonce/ritmo-netcode`, online multiplayer.** A session per peer exchanges inputs over a `NetworkLink` and ticks the simulation with every seat's input: `Netcode.rollback` runs at once on guesses and rolls back with the runtime's checkpoints when real input contradicts one; `Netcode.lockstep` waits for every seat. Seat 0 starts the match and every resync from one save that every peer restores at the same tick; `session.rate` slows the peer that runs ahead; peers compare checksums of confirmed ticks, and a mismatch stops the session with `Desynced` until `resync()`.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
const seats = Netcode.seats(PlayerInput, { count: 2, idle }) // the simulation's input source
|
|
11
|
+
const session = Netcode.rollback(runtime, { simulate, seats: seats.value, seat, links: [WebSocketNetworkLink.make(socket)], hostClock, step })
|
|
12
|
+
FixedLoop.start({ ..., rate: session.value.rate, update: session.value.update({ input: readInput, onHalted: report }) })
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- Transports: `WebSocketNetworkLink.make(socket)` (a relay; the browser's, Node's, Deno's, or Bun's WebSocket), `WebRtcNetworkLink.make(channel)` (between peers), `MemoryNetworkLink.make(...)` (seeded latency, jitter, and loss, for headless tests), or any `{ send, receive, status }`.
|
|
16
|
+
- What does not compile: a rollback simulation that cannot be rewound, one whose requirements the runtime does not provide, and a runtime that cannot save. What fails at construction, as a typed `Result`: a seat out of range, seats another session took or the runtime does not provide, and a `maxRollback` beyond the checkpoints the runtime keeps.
|
|
17
|
+
- The skill's `playbooks/netcode.md` now drives the package instead of a hand-written loop.
|
|
18
|
+
|
|
19
|
+
**Core:**
|
|
20
|
+
|
|
21
|
+
- `FixedLoop.start` takes `rate`, read once per frame, within `FixedLoop.rateRange` (0.9 to 1.1): how fast host time runs into the accumulator, for a networked session's pacing. A value outside the range stops the loop with an `InvalidRate` failure, a new member of `FixedLoop.Failure`.
|
|
22
|
+
- **`runtime.restore` sets the next entity id to the save's**, where it used to keep the higher of the save's and the runtime's own. The same save restored in two runtimes now allocates the same ids afterwards, whatever each held before; peers of a networked game need it. A handle kept from before a restore may now name an entity spawned after it: drop handles across a restore, as their ids could already name restored entities.
|
|
23
|
+
|
|
24
|
+
**Lint:** `keep-simulation-headless` reports `WebSocket`, `RTCPeerConnection`, and `RTCDataChannel` with their own message: online play runs the simulation under a netcode session, and remote input goes through `Netcode.seats`, never `runtime.send(...)`.
|
|
25
|
+
|
|
26
|
+
**Devtools:** `Desync.compare(mine, theirs)` lists every difference between two saves of a tick, entities by id and values by path: the report for a `Desynced` session made with `keepSnapshots: true`.
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [c3719a5]
|
|
31
|
+
- Updated dependencies [70d054e]
|
|
32
|
+
- Updated dependencies [adb4066]
|
|
33
|
+
- Updated dependencies [97e95fb]
|
|
34
|
+
- Updated dependencies [dbfbd9d]
|
|
35
|
+
- Updated dependencies [343660e]
|
|
36
|
+
- Updated dependencies [d24258e]
|
|
37
|
+
- Updated dependencies [e169263]
|
|
38
|
+
- Updated dependencies [cfe332a]
|
|
39
|
+
- Updated dependencies [8aa1e85]
|
|
40
|
+
- @typeonce/ritmo@0.14.0
|
|
41
|
+
- @typeonce/ritmo-math@0.14.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typeonce/ritmo-netcode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Rollback and lockstep sessions over any transport for Ritmo: input timelines, checkpoint history, pacing, resync, and desync checks",
|
|
5
5
|
"author": "Sandro Maglione",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
"provenance": true
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@typeonce/ritmo": "^0.
|
|
52
|
-
"@typeonce/ritmo-math": "^0.
|
|
51
|
+
"@typeonce/ritmo": "^0.14.0",
|
|
52
|
+
"@typeonce/ritmo-math": "^0.14.0"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=20"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@typeonce/ritmo-
|
|
59
|
-
"@typeonce/ritmo-
|
|
58
|
+
"@typeonce/ritmo-browser": "0.14.0",
|
|
59
|
+
"@typeonce/ritmo-devtools": "0.14.0"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsc -b tsconfig.json --pretty false",
|