Checklist #
What to check before calling your host or game done. The example pages (examples/) pass all of these; the tests
(npm test) check most of them for the helpers themselves.
A host #
A game that says hello gets an answer : host, then (for what you offer) player, the character or
sprite-status: "ready", and can-save. A game that says hello again is answered again.
Saying hello again doesn't reset a game's allowances (saves and characters per load, one save at a time).
Only you start a new load: call host.reset() when you load the frame again.
Records are checked for size and depth before the player is asked (the kit refuses over 64 KB or 32 levels
deep; your own lexicon check comes after).
You offer only what you do. Leave out a function and the kit leaves that part out of offers.
Who's playing follows your sign-in : call playerChanged() when someone signs in, signs out or switches
accounts. Check the game hears each change, and hears nothing when nothing changed.
Players can stay anonymous if you let them hide from games: player() returns null, and the game hears
"no one".
The character is the player's own , with the frame size from its source (not the sheet divided by a guess),
and its entry passed on unchanged.
Only a game's own tile may save, and only into its own collections : save.collections(tile) returns []
for any other tile, including copies of the game published elsewhere.
You take the game's address and version from what you loaded , never from the game, and put them in the
record (game).
You check the record against the game's lexicon before asking the player; invalid if it doesn't pass.
You ask the player, outside the tile , before writing anything, and send asking while you wait.
declined, not-allowed, invalid, failed each come back when they should, and a failure doesn't leave the
game waiting.
open-record opens only what you saved for that game, that load. Try another address: nothing happens.
open-profile goes where you decide , and you check with the player before leaving the page. The request
arrives as a message, not as a click on your page, so window.open() straight away is stopped as a pop-up: show
your own question with a link or button the player clicks (as examples/host.html does). The same goes for
open-record.
Through the tile loader, not just a plain iframe. The kit answers in whichever way the game spoke; try both.
A game #
It plays with no host at all (open its index.html on its own): no buttons for things nobody offers.
It shows a feature only once it's offered (host.offers(…), host.canSave(collection)).
It works with hosts from before the kit , which don't send host or player (the client works out what's
offered from their other answers).
It handles who's playing changing mid-game , including to no one.
It uses the character's frame size as given , and reads entry defensively: fields can come and go.
A character arriving mid-round is used from the next round (so a round is played with one character).
It saves only its own fields , into its own collection, with its own lexicon published, and says what happened
for each outcome (declined, not-allowed, invalid, failed).
One save at a time , and the save button can't be pressed twice for the same result.
A profile link falls back to a plain link when the host doesn't offer open-profile.
Checkable results (if you want them): the rules that decide a score kept apart from the screen, fixed steps,
randomness seeded (not Math.random() or the clock mid-play), and the player's inputs recorded as data, so a
saved result can be replayed and checked. Cosmic Junkyard's scripts/check-run.mjs is one example.