patrickz.aiLet’s talk ↗

Build apps / Project lab

Model private information in multiplayer

Separate public room state from private player information.

About 60 minutesSome experienceUses a coding agentRead free · No sign-up

Before you start

A chat assistant and a paper or local prototype with two fictional players. No access to private source is required.

Why this lesson exists

The archived card-game case study is useful for a general trust-boundary exercise. No access to its private source is needed.

Do the exercise

  1. Set your boundary

    Stay offline for the first version: one pass-and-play round for two fictional players, plus a table of every fact and who may see it (player A, player B, everyone, server only). Add rooms and realtime only after that table is agreed.

  2. Play one offline round

    Build an offline pass-and-play round for two fictional players.

  3. Separate public and private state

    Define public and private state as separate schemas.

  4. List who may see each fact

    Make a table of every fact and who may see it: player A, player B, everyone or server only.

Next sessions, not today

  • Rooms and join codes Add rooms and join codes so two devices can share a round.
  • Seat tokens Assign each seat an unguessable token.
  • Server-side hands Move private-hand creation to the server.
  • Realtime updates Add realtime updates for public state, then test with two ordinary browser sessions, not only one developer account.

A prompt to adapt

Replace the bracketed parts with your own details.

Help me model private information in a two-player card game, in a new practice folder or on paper. Stay offline for the first version: one pass-and-play round for two fictional players, plus a table of who may see each fact. No rooms, join codes, seat tokens, server-side hands or realtime updates yet. If code is involved, list the setup commands before changing files. Then work in three checkpoints and, after each, tell me how to check it:
1. An offline pass-and-play round.
2. Public and private state defined as separate schemas.
3. A table of every fact and who may see it: player A, player B, everyone or server only.
Then show the exact data each player would receive and confirm neither contains the other hand. My game in one sentence: [rules]. My tool: [a language you know, or paper].

More prompts to adapt ↗

Run this experiment

Draw the data returned to each player. Confirm neither response contains the other hand. Add reconnect and round reset without broadening that visibility.

Check your result

Use evidence from your output. A confident explanation from the AI is not enough.

If it isn’t working

A hidden UI element does not protect data already sent to a browser. Private values must stay out of unauthorized responses.

Where this came from

Adapted from an archived project architecture write-up. Its repository is private; this lesson uses only a general practice scenario and requires no private source code. Project coverage.

Prepared September 2026. Tools and interfaces change; use current official setup instructions. Session lengths are estimates.

KEEP GOING

Your next useful step

Browse all 57 guides ↗