# Open-source packages

Canonical: https://pocketrts.com/packages/

TypeScript libraries for multiplayer rooms, synchronized simulations, and grid-based strategy games. Explore the code and try the demos in your browser.

## @pocketrts/net

Host a room, join by code, and exchange messages over WebRTC.

[npm](https://www.npmjs.com/package/@pocketrts/net)

[Source code](https://github.com/baijunjie/pocketrts/tree/main/packages/net)

[Try demo](https://pocketrts.com/demos/netplay/)

[Run locally](https://github.com/baijunjie/pocketrts/tree/main/apps/netplay-demo)

On the demo page, create a room as Player A and join with its code as Player B. Chat, then press Leave as Player A and watch Player B take over as host.

## @pocketrts/lockstep

Advance the same simulation on every peer and compare checksums to detect divergence.

[npm](https://www.npmjs.com/package/@pocketrts/lockstep)

[Source code](https://github.com/baijunjie/pocketrts/tree/main/packages/lockstep)

[Try demo](https://pocketrts.com/demos/lockstep/)

[Run locally](https://github.com/baijunjie/pocketrts/tree/main/apps/lockstep-demo)

Three simulated players run one match in a single page, with no server. Freeze, cut off, or desync a player and watch the host react.

## @pocketrts/determinism

Reproduce calculations, random sequences, and state checksums from the same inputs.

[npm](https://www.npmjs.com/package/@pocketrts/determinism)

[Source code](https://github.com/baijunjie/pocketrts/tree/main/packages/determinism)

[Try demo](https://pocketrts.com/demos/determinism/)

[Run locally](https://github.com/baijunjie/pocketrts/tree/main/apps/determinism-demo)

## @pocketrts/grid

Find paths, trace sight lines, and arrange units into formations on a grid.

[npm](https://www.npmjs.com/package/@pocketrts/grid)

[Source code](https://github.com/baijunjie/pocketrts/tree/main/packages/grid)

[Try demo](https://pocketrts.com/demos/grid/)

[Run locally](https://github.com/baijunjie/pocketrts/tree/main/apps/grid-demo)

