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
- Make the manager's
entrya menu scene with"plugins": ["loader", "scenemanager", "ui"], so it takes every connection. - 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 (toand each button'swith). - Give the menu no
world.predict; put it on each play scene instead. - When the page is still on the menu
full.afterseconds after a press, show the definition'sfullline: the play scene had no free slot.
Entering play
- Hold each choice on the
playerprefab asnull(side,pick), withconnandboarded. - In the
arriveact, write the seat number toconn, and take each choice only while its field isnulland only when the definitions name it. - Make every play scene
suspend: true, with nothing that refuses a seat once the round has started.
Taking over a thing
- Spawn the full cast whether anyone is in or not, each thing driven by its own brain.
- The
playerrow holds a thing withtake; the thing's kind asksholderOfeach step and lets its brain drive when nobody holds it. When the seat leaves, the brain takes over again. - 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.
- Have the page send a
boardact when its entry show ends; the seat takes its thing then. - Have every rule that steers the cast skip a thing that has a holder.
Losing the thing
- At once: in
before, a seat that hasboardedand 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
- Give each thing two fields:
factionfor how it looks,teamfor who its friends are. Every friend-or-foe check comparesteam. - In a free-for-all, set
teamtop<player row id>when the seat takes the thing, and place astartper slot.
The end of a round
- 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 theplayerrow's side. - When
overForcrossesresultsSeconds, the round's rule sends every seat to the menu withgoandp.data.conn. - Name an
enteract on the round kind in the scene'sscenesentry. When the entering seat is the onlyplayerrow, it ends what the round made and spawns the round again fromw.world.scenemanager.actors. - A pause modal with a
keyoffers resume and the menu; closing the tab ends theplayerrow.
Checking it
- In rule tests, move seats with real
gomessages 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. - Test that every side and slot, boarding with no input, stays in the play area and hits nothing.
- Test that seats go to the menu at
resultsSeconds, and that a seat entering alone afterwards finds a fresh round.