---
url: /streams/demos/territory-wars.md
description: Multiplayer territory capture game built with Yjs CRDTs on Durable Streams.
---

# Territory Wars

Multiplayer territory capture game built with [Yjs](https://yjs.dev) CRDTs on [Durable Streams](/streams/). Read the [blog post](/blog/2026/04/07/yjs-durable-streams-on-electric-cloud) for more details.

## How it works

Built with [`y-durable-streams`](https://www.npmjs.com/package/@durable-streams/y-durable-streams) on [Durable Streams](/streams/). Game state is managed via [StreamDB](/blog/2026/03/26/stream-db). The game board is a Yjs Y.Map where each cell is a last-writer-wins register. Players move to claim cells and enclose territory. Player presence is tracked via ephemeral awareness streams with built-in TTL that garbage-collects stale state from disconnected players.

Watch on YouTube: [y-durable-streams. A Yjs provider built on top of Durable Streams.](https://www.youtube.com/watch?v=r3i25BGom0s)
