# A Live WebGPU Planet With No Backend — Powered by GenosDB

Most database demos are to-do lists. I wanted to find out what happens when you
put one under *real* load — so I built a planet.

**OVGrid** is a cube-sphere planet you explore as an avatar, right in your
browser: procedural terrain, weather, vegetation, day/night, real-time
multiplayer presence, and land you can own and trade on-chain. It runs at
real scale on **WebGPU**.

**▶ Play it live (no install, no account): https://world.ovgrid.com**

But the rendering isn't the interesting part. The interesting part is that
**there is no backend.** No game server, no API, no socket server. A single
distributed database — [GenosDB](https://github.com/estebanrfp/gdb) — drives the
entire live state of the world. This post is about how that works.

---

## First, the planet: Floating Origin

A planet is 795 km in radius. GPUs work in 32-bit floats, which run out of
precision long before you get that big — geometry jitters, z-fighting explodes,
the avatar shakes. The fix is **Floating Origin**:

- The CPU holds every world coordinate in **Float64** (full precision).
- Each frame, positions are rebased **relative to the camera** and only the
  small camera-relative deltas are handed to the GPU as **Float32**.

The camera is effectively always at the origin, so the numbers the GPU sees stay
tiny and precise — jitter-free all the way down to street-level LOD. A dynamic
quadtree on the cube-sphere subdivides terrain near you, and a GPU-baked height
grid gives exact ground for collision and physics. (Full write-up:
[floating-origin-guide.md](https://github.com/estebanrfp/ovgrid/blob/main/docs/floating-origin-guide.md).)

That's the foundation. Now the twist.

---

## The twist: a database is the backend

Live multiplayer worlds usually need a server: something authoritative that
clients connect to, that holds state and relays updates. OVGrid has none. Instead,
every client runs **GenosDB**, a serverless, peer-to-peer, real-time graph
database, and the world *is* the database.

Here's the capability map:

| What you see in the world | What GenosDB is doing |
|---|---|
| Other players appear as animated avatars at the right position, altitude and animation | **P2P presence** over WebRTC (`GenosRTC`), synced ~12 times a second — no game server |
| The land map and the marketplace update live as data changes | **Reactive reads** (`db.map`) — the UI subscribes to a query and re-renders on every change |
| Land and assets you own, read instantly even offline | **On-chain mirror** — Polygon is the source of truth, GenosDB caches it for fast, offline, reactive reads |
| Sign in with biometrics or a seed phrase; actions are signed | **Decentralized identity + RBAC** via the Security Manager (WebAuthn / BIP39) |

### Reactive reads: the UI never polls

The land map and the on-chain marketplace are *different frontends* that read the
*same database the same way* — a live query with a callback that fires on every
change, whether the change came from this peer or another:

```js
// Subscribe once. The callback re-fires whenever matching data changes —
// locally OR from a remote peer. No polling, no manual refresh.
db.map({ query: { type: 'parcel' } }, ({ id, value, action }) => {
  renderLandMap()   // re-render the 3D world on each change
  // ...and the marketplace subscribes to the very same data
})
```

Broadcasting your avatar is just a write:

```js
// Position, yaw and animation, ~12 Hz. Peers receive it and animate your avatar.
db.put({ type: 'presence', pos, yaw, anim }, `presence_${myId}`)
```

### The pattern I'm proudest of: the read layer never changes

A parcel of land might be **claimed locally** (instant, optimistic) or **minted
on-chain** (an ERC-1155 token on Polygon). Two completely different write paths —
one is a local DB op, the other is a blockchain transaction confirmed over
minutes.

And yet the world reads **both the same way**: a `db.map` subscription. A sync
layer mirrors the chain into GenosDB, so the 3D client never waits on an RPC, never
hits the chain on the render path, and works offline. The blockchain is the source
of truth; **GenosDB is the abstraction that makes it feel instant.**

---

## What "no server" actually means

The honest question is: if there's no backend, how do peers find each other?

- **Transport:** WebRTC data channels, peer-to-peer.
- **Signaling:** [Nostr](https://nostr.com) relays — a decentralized signaling
  layer, so there's no central matchmaking server either.
- **Conflict resolution:** a Hybrid Logical Clock orders concurrent writes
  deterministically, so peers converge without a coordinator.

The result: open two browser tabs, walk around in one, and your avatar appears and
moves in the other — with nothing running in between but the open internet.

---

## It's open source — and it documents itself

OVGrid is fully public:

**→ https://github.com/estebanrfp/ovgrid**

A couple of things worth a look:

- Every tunable in the world — terrain noise, cloud layers, ocean, lighting,
  weather, vegetation — is documented parameter-by-parameter in
  [`docs/configuration/`](https://github.com/estebanrfp/ovgrid/tree/main/docs/configuration).
- The repo is indexed by [DeepWiki](https://deepwiki.com/estebanrfp/ovgrid), so you
  can *ask the codebase questions* in natural language.

If you've ever wanted to see a serverless, P2P, real-time database do something
harder than a to-do list — go fly around a planet, then read how a single DB holds
it all together.

**Play:** https://world.ovgrid.com · **Code:** https://github.com/estebanrfp/ovgrid · **Database:** https://github.com/estebanrfp/gdb

