Making a game

Session flow

The loop around play: a menu, a choice, joining, respawn, results and a fresh round.

The loop around play: a menu, a choice, entering a running scene, taking over a thing, losing it, the results, and back to the menu. There is no lobby or waiting for a start; a seat joins a scene as it is.

The menu

  1. Make the manager's entry a menu scene with "plugins": ["loader", "scenemanager", "ui"], so it takes every connection.
  2. Draw it as one kind's look on a modal ui panel. Its button sends plugins.scenemanager.go(<scene>, <choice>), the scene and choice read off the menu kind's definition (to and each button's with).
  3. Give the menu no world.predict; put it on each play scene instead.
  4. When the page is still on the menu full.after seconds after a press, show the definition's full line: the play scene had no free slot.

Entering play

  1. Hold each choice on the player prefab as null (side, pick), with conn and boarded.
  2. In the arrive act, write the seat number to conn, and take each choice only while its field is null and only when the definitions name it.
  3. Make every play scene suspend: true, with nothing that refuses a seat once the round has started.

Taking over a thing

  1. Spawn the full cast whether anyone is in or not, each thing driven by its own brain.
  2. The player row holds a thing with take; the thing's kind asks holderOf each step and lets its brain drive when nobody holds it. When the seat leaves, the brain takes over again.
  3. On the first take, bring in a new thing for the seat, placed by its slot, and end one free thing of that class and side, so the count stays the same.
  4. Have the page send a board act when its entry show ends; the seat takes its thing then.
  5. Have every rule that steers the cast skip a thing that has a holder.

Losing the thing

  • At once: in before, a seat that has boarded and holds nothing boards again.
  • By choosing: show a screen with a button per class, each sending board(<class>), and one to the menu.

Teams and the free-for-all

  1. Give each thing two fields: faction for how it looks, team for who its friends are. Every friend-or-foe check compares team.
  2. In a free-for-all, set team to p<player row id> when the seat takes the thing, and place a start per slot.

The end of a round

  1. The round's row counts overFor, the seconds since it ended. Each page shows the results while the row says it is over, coloured by the player row's side.
  2. When overFor crosses resultsSeconds, the round's rule sends every seat to the menu with go and p.data.conn.
  3. Name an enter act on the round kind in the scene's scenes entry. When the entering seat is the only player row, it ends what the round made and spawns the round again from w.world.scenemanager.actors.
  4. A pause modal with a key offers resume and the menu; closing the tab ends the player row.

Checking it

  1. In rule tests, move seats with real go messages from the menu: a full scene leaves the seat on the menu, a seat joining mid-round holds a thing of its class and the count is unchanged, and a seat that leaves hands its thing back to the brain.
  2. Test that every side and slot, boarding with no input, stays in the play area and hits nothing.
  3. Test that seats go to the menu at resultsSeconds, and that a seat entering alone afterwards finds a fresh round.