cloudflare / cloudflare/partykit

[Feature] Incremental State Sync

Open
#229 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.3k
Forks
79
PR merge metrics
No merged PRs in 30d

Description

Hi everyone! I saw the experimental `partysync` module and was wondering if it could support an incremental state sync protocol.

I'm imagining something similar to https://github.com/colyseus/schema. It's a library that basically automatically syncs JS classes to client listeners. It's very optimized, serializing and emitting only compressed binary deltas of any changes of state.

For example you can have a class like the following server side, which would sync the player object to all clients whenever a property changes:
```
export class Player extends Schema {
@type("string") name: string;
@type("number") x: number;
@type("number") y: number;
}

const player = new Player()
```
This makes the developer experience of making realtime multiplayer games really seamless, as all your state can be replicated on both the server and client with minimal overhead.

There are some great docs going into more detail here: https://docs.colyseus.io/state.

However, Colyseus schema doesn't have an integration with Durable Objects yet. So having sync functionality like this built into `partykit/partysync` with a tight integration to Durable Objects would be great to enable apps like realtime multiplayer video games!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.