Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .changeset/fixed-loop-step-in-frame.md

This file was deleted.

21 changes: 0 additions & 21 deletions .changeset/netcode-events-across-saves.md

This file was deleted.

26 changes: 0 additions & 26 deletions .changeset/netcode-one-message-per-frame.md

This file was deleted.

7 changes: 7 additions & 0 deletions packages/browser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @typeonce/ritmo-browser

## 0.27.0

### Patch Changes

- Updated dependencies [7828818]
- @typeonce/ritmo@0.27.0

## 0.26.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typeonce/ritmo-browser",
"version": "0.26.0",
"version": "0.27.0",
"description": "Browser fixed-step loop, keyboard, gamepad, pointer, and touch actions, merged input, local multiplayer, and input capture for Ritmo",
"author": "Sandro Maglione",
"license": "MIT",
Expand Down
8 changes: 8 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @typeonce/ritmo

## 0.27.0

### Minor Changes

- 7828818: `FixedLoop`'s `update` gets a second argument, `at: FixedLoop.StepInFrame`: `at.last` is true on the frame's last update (by the accumulator and `maxStepsPerFrame`), for code that acts once per frame after its steps, as a networked session does to send what the frame said in one message. An `update` that takes no arguments is unchanged.

The `ritmo` skill's netcode playbook says that a session sends one message per link per frame and repeats what was lost, so a link sends each message as it is (no outbox or batching of its own), that a game's `update` around `session.update` passes the loop's arguments through, and to measure with `status().sent`.

## 0.26.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typeonce/ritmo",
"version": "0.26.0",
"version": "0.27.0",
"description": "The agent-first, type-safe ECS runtime for TypeScript",
"author": "Sandro Maglione",
"license": "MIT",
Expand Down
10 changes: 10 additions & 0 deletions packages/devtools/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @typeonce/ritmo-devtools

## 0.27.0

### Patch Changes

- Updated dependencies [7828818]
- Updated dependencies [e7078d5]
- Updated dependencies [7828818]
- @typeonce/ritmo@0.27.0
- @typeonce/ritmo-netcode@0.27.0

## 0.26.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typeonce/ritmo-devtools",
"version": "0.26.0",
"version": "0.27.0",
"description": "Headless debug sessions, trace history, text reports, replays, and fuzzing for Ritmo runtimes",
"author": "Sandro Maglione",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools/src/internal/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* `package.json` by `scripts/sync-version.ts` (run by \`pnpm version-packages\`)
* and checked by a test.
*/
export const libraryVersion = "0.26.0"
export const libraryVersion = "0.27.0"
7 changes: 7 additions & 0 deletions packages/math/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @typeonce/ritmo-math

## 0.27.0

### Patch Changes

- Updated dependencies [7828818]
- @typeonce/ritmo@0.27.0

## 0.26.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/math/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typeonce/ritmo-math",
"version": "0.26.0",
"version": "0.27.0",
"description": "The 2D helpers most Ritmo games would otherwise rewrite (vectors, angles, swept collision, flow field), plain data in and out, built on Ops so they replay the same on every engine",
"author": "Sandro Maglione",
"license": "MIT",
Expand Down
49 changes: 49 additions & 0 deletions packages/netcode/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
# @typeonce/ritmo-netcode

## 0.27.0

### Minor Changes

- e7078d5: **`session.events` confirms the ticks a save makes final.** A save (the match's start, `resync()`, a page seated again after it loaded again, a hidden page back under `"resync-on-return"`) is the host's world as it ran, guesses of other seats' input included. Until now every peer, the host too, withdrew the ticks it had run before the save but not confirmed yet, and never confirmed them: their events were gone without a word. Under rollback that is up to `maxRollback` ticks on every page at each save: a page that reloads mid-match lets the others run on guesses of its seat until it is back, so a lap, a checkpoint, or a sound of that stretch never reached any page. The page the save seated was not affected: it confirms every tick from the save on, as before.

- The host confirms every tick it ran before its save.
- The save carries the inputs each of its last ticks ran with on the host. Every other peer confirms the ticks it ran with the same inputs, from a tick both confirmed; what `predicted()` handed out of them stands.
- The ticks before the save that a peer ran otherwise, confirmed otherwise (it had an input the host's world never got), or did not run at all, are reported by `lost()` with the new reason `"save"`, and what was predicted of them is withdrawn. A page the save seats for its first match (one that loaded again) is told nothing of the ticks before it: the save's world holds them.
- Fixed: a peer ahead of the host can confirm the save's own tick and the `inputDelay` ticks after it; `lost()` reported one tick fewer when a resync ran them again with other events.

The sync message carries the inputs (protocol version 6, with this release's other session changes): every page of a match runs this release.

**Breaking (types only):** `EventsLost["reason"]` is `"unread" | "resync" | "save"`. A `switch` over it adds a case; ticks reported `"save"` are ones whose events this peer cannot tell, like `"resync"`:

```ts
const lost = hits.lost()
if (lost !== undefined && lost.reason !== "unread") {
// "resync" or "save": the match ran ticks lost.from to lost.to otherwise than this page acted on
}
```
- 7828818: **A session sends one message per link per frame, and lighter ones.** Until now a session handed its links a message for each thing it said (inputs, checksums, pings, pongs), every step, so a frame that ran several steps sent several of each, and a relay that bills per message (a Cloudflare Durable Object) paid for all of them. Now everything one frame says goes out as one message per link, a bundle: driven by `session.update` from a `FixedLoop`, one per host frame however many steps it ran; each `advance` called directly is a frame of its own.

- A bundle names the protocol, the sender, and its epoch once. It still carries every input a peer has not acknowledged (a lost message costs nothing the next one does not repeat), but writes each distinct input once and which of them each tick had: a held input is two numbers however many ticks it was held. Acknowledgements are written as how far behind the sender's tick they are.
- A message that must survive loss (a seat reported gone, a change of who plays) goes out with the next five frames' bundles instead of five times in one frame. A page that hides still sends its announcement five times at once: no frame follows.
- `status().sent` counts the messages handed to the links and their bytes in UTF-8.

Over 120 ms with 60 ms of jitter and 5% loss, on pages at 60 Hz that sometimes run two or three steps in a frame: 2 peers went from 139 messages and 62 KiB a second to 97 and 16 to 23 KiB; 8 peers from 728 and 290 KiB to 387 and 73 to 103 KiB (the lower figure for input held 20 frames, the higher for input that changes nearly every frame).

**Breaking: every page of a match must run this version.** The session protocol changed (version 6): a peer on 0.26 or older ends with `ProtocolMismatch`.

**Breaking: the function `session.update(...)` returns takes the loop's two arguments.** Passed to `FixedLoop.start` as it is, nothing changes. Called from the game's own `update`, pass them through, so the session knows the frame's last step:

```diff
const tick = session.update({ input: readInput, onHalted })
FixedLoop.start({
...loop,
- update: () => tick(),
+ update: (seconds, at) => tick(seconds, at),
})
```

A link that batched the session's messages itself (an outbox flushed once per task) can send each as it is now.

### Patch Changes

- Updated dependencies [7828818]
- @typeonce/ritmo@0.27.0

## 0.26.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/netcode/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typeonce/ritmo-netcode",
"version": "0.26.0",
"version": "0.27.0",
"description": "Rollback and lockstep sessions over any transport for Ritmo: input timelines, checkpoint history, pacing, resync, and desync checks",
"author": "Sandro Maglione",
"license": "MIT",
Expand Down
4 changes: 4 additions & 0 deletions packages/oxlint-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @typeonce/oxlint-plugin-ritmo

## 0.27.0

No changes in this release.

## 0.26.0

No changes in this release.
Expand Down
2 changes: 1 addition & 1 deletion packages/oxlint-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typeonce/oxlint-plugin-ritmo",
"version": "0.26.0",
"version": "0.27.0",
"description": "Oxlint rules for Ritmo games: deterministic, headless simulation code and checked runtime results",
"author": "Sandro Maglione",
"license": "MIT",
Expand Down
6 changes: 6 additions & 0 deletions packages/pixi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @typeonce/ritmo-pixi

## 0.27.0

### Patch Changes

- @typeonce/ritmo-render@0.27.0

## 0.26.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/pixi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typeonce/ritmo-pixi",
"version": "0.26.0",
"version": "0.27.0",
"description": "Pixi container adapter for Ritmo render-node registries",
"author": "Sandro Maglione",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions packages/render/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @typeonce/ritmo-render

## 0.27.0

### Patch Changes

- Updated dependencies [7828818]
- @typeonce/ritmo@0.27.0

## 0.26.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/render/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typeonce/ritmo-render",
"version": "0.26.0",
"version": "0.27.0",
"description": "Renderer-agnostic entity-to-node mirroring for Ritmo",
"author": "Sandro Maglione",
"license": "MIT",
Expand Down
4 changes: 4 additions & 0 deletions packages/tools/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @typeonce/ritmo-tools

## 0.27.0

No changes in this release.

## 0.26.0

No changes in this release.
Expand Down
2 changes: 1 addition & 1 deletion packages/tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typeonce/ritmo-tools",
"version": "0.26.0",
"version": "0.27.0",
"description": "Asset tools for games made with Ritmo, for agents: fixes AI-made pixel art and animation sheets onto a true pixel grid and a palette, makes normal maps for art a game lights, keeps game sounds as JSON recipes, writes game music as JSON songs built around a hum, and draws pixel art effects as code, each with a review page for a person, pixel art included",
"author": "Sandro Maglione",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/tools/src/internal/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* `package.json` by `scripts/sync-version.ts` (run by `pnpm version-packages`)
* and checked by a test.
*/
export const toolsVersion = "0.26.0"
export const toolsVersion = "0.27.0"