All guides
#games#vesta#nostr#dice#kind-2390

Vesta: settlements, trade, and dice nobody rolls

Vesta is a settlement-building game running inside an Obelisk channel. The rules come from an upstream package we track rather than fork, the dice are derived from the event log instead of rolled by a player, and every client checks every move.

4 min read
A Vesta island with dice derived from the event logA hexagonal island of forest, brick, wool, grain and ore tiles with numbered dice tokens and player settlements, beside the line of the Nostr event log the dice roll is derived from: nobody at the table rolls their own numbers.1058694Nobody rolls their own dicethe numbers come out of the event logentropy = 3f9c…a12 : 14 4 + 3 = 7…and every client derives the sameroll from the same log.

What it is

Vesta (Expanding Settlements Through Accord) is a build-and-trade game for 2 to 4 players on a hex island. Settle corners, connect them with roads, upgrade to cities, trade resources, and race to the victory-point target while a robber parks itself on whichever tile hurts most.

If you have played the classic of the genre, you already know it. What is worth reading about is what changes when the table has no referee.

Vesta board in Obelisk: a hexagonal island of resource tiles with numbered dice tokens, player settlements and roads on the edges, a robber on the desert, and each player’s hand and victory points below.
A Vesta table in Obelisk: the island, each player's hand and points, and controls that only offer moves the engine will actually accept.

The rules are not ours

Vesta is a tracked dependency, not a fork:

"vesta": "github:fchurca/vesta#semver:^0"

Upstream (fchurca/vesta) keeps a core module that is already pure (createGame(seed) builds a board, applyMove(state, move) returns the next one), which happens to be exactly the contract an Obelisk game engine has to satisfy. So nothing in Obelisk encodes a Vesta rule. Our code translates vocabularies: their player index becomes our seat id, their move.player is replaced by whoever signed the event.

npm update vesta pulls their rule changes. That is the whole upgrade path.

Three things a relay forces

1. A move may not name its own player. Upstream's client is hot-seat: everyone shares a keyboard, so a move carrying player: 2 is harmless. Over a relay it is an impersonation primitive. Here, the seat comes from the signature: you cannot publish a move "as" somebody else.

2. Every client validates every move. Upstream splits the rules (canBuildSettlement) from the doing (placeSettlement) and lets its UI call the guard first. Over a relay there is no UI in the path: a modified client publishes straight to the socket. So the guards run on every client, for every move, before it is applied. Without that, you could publish a settlement onto an occupied corner and everyone would agree you owned it.

3. Dice cannot be self-reported. This is the interesting one.

Where the numbers come from

Upstream's roll-dice move carries its own values, because the player rolling is the player everybody is watching. Put that on a relay and the roller picks their own resources.

So Obelisk ignores whatever values a move claims and derives the roll from the log:

entropy = <id of the last accepted event> : <turn index>
dice    = mulberry32(xmur3(entropy))

Both inputs are fixed before the roller publishes anything, so grinding your own event changes nothing: your event is not an input. And because it is a pure function of the log, every client derives the same two numbers without exchanging a message about it.

Seats, and playing two people from one laptop

A seat is not a pubkey. The start event freezes a seat list that looks like this:

["start", {"seats": [
  {"id": "<pubkey-a>",   "by": "<pubkey-a>", "label": "Ana"},
  {"id": "<pubkey-a>#1", "by": "<pubkey-a>", "label": "Beto"},
  {"id": "<pubkey-b>",   "by": "<pubkey-b>", "label": "Cami"}
]}]

id is what the engine treats as a player; by is the account allowed to publish its moves. Two seats sharing a by are two people at one machine: separate players, separate resources, one keyboard and one signature. Seat order is turn order, and seats can be renamed before the start.

The host can only seat accounts that actually joined, so nobody gets dragged into a match by a host filling rows.

No turn clock, by default

Obelisk's clock is per action, and a Vesta turn is many actions: roll, build, trade, end. A 45-second timer would guillotine people mid-thought, so Vesta tables default to no clock. If you do set one, a timeout ends that seat's turn rather than removing the player: Vesta has no elimination, and deleting a player would rewrite everyone else's board.

Resuming a saved game

Upstream exports a game record: {startState, turns, endState}. Drop that file into the table options when you create a table and the game starts from endState instead of a fresh island. A serialized state is around 4 KB, which fits comfortably in one event.

When a table resumes a save, the seat rows are fixed to the saved players in the saved order, each showing the name it had. The host assigns each saved player to an account, rather than the mapping being implicit in the row order.

What the UI will and will not offer you

Every button is gated by the engine's own validator, and the board highlights exactly the spots upstream calls legal. That is deliberate: a rejected move over a relay is silent (there is no error message coming back from anywhere), so if the interface offered an illegal move you would click it and simply watch nothing happen.

For the curious

Everything travels as kind 2390 events in the channel's NIP-29 group and is replayed by deriveSession. The sequencing upstream keeps in its client (flipping setup steps, handing out second-round resources, deciding when the robber may move) happens deterministically on every replay instead, under a namespaced key inside the state so it survives a round-trip through upstream's reducers. The details are in docs/features/games.md.

A cell going critical on a Chain Reaction boardA dark grid of cells holding red, lime and cyan orbs. One cell is bursting and sending an orb into each of its four neighbours, the cascade that gives Chain Reaction its name, played over a Nostr relay in Obelisk.One orb over the limitevery neighbour takes one,and may burst in turnkind 2390 {"op":"move","cell":11}the cascade is replayed,never publishedseat 1seat 2seat 3

Chain Reaction, played on a relay

the small one: one click, one cascade

Two Stacker wells trading garbage linesTwo ten-column wells of falling coloured blocks side by side. A completed line in the left well sends grey garbage rows into the right one: the only thing that crosses the Nostr relay in a real-time Obelisk Stacker match.Clear a line……and somebody else digsop: attack lines 3 · hole 6 Every board runs locally at sixty frames a second; only the consequences are published.

Stacker: real-time falling blocks over Nostr

real time, and the lines you clear land on somebody else

How Obelisk worksOn a usual chat platform, your account, your data and the rules live on the company's server, between you and your community. In Obelisk you sign each message with your own key and it goes straight to your community's relay, a NIP-29 relay: Obelisk runs a public one, and anyone can run their own. The Obelisk app only signs and shows.A USUAL CHAT PLATFORMYoumessageThe company's serveryour account · your data · its rulesYour communityOBELISKYou, with your keysigned messageYour community's relayObelisk's relayor your ownYour communityUse Obelisk's relay or run your own: your community depends on no one.

How Obelisk works

the relay-only architecture underneath