# crumbleFloorRound
**Crumble Floor: a last-one-standing party show round for partyShowKit. Every tile you stand on shakes, turns red and falls away, so keep moving, hop the holes, and be the last one standing.** For 2 to 8 contestants, people and computer players together, in 1 to 2 minutes; the floor grows when more than 4 play. Three arenas, three tunings, computer players at three skill levels, its own music and sounds, and the same tiles falling at the same moment on every machine.
Version **0.1.3** (`require("crumbleFloorRound.round").VERSION`, and `version` in `package.yaml`).
## Install
Install `crumbleFloorRound.package` from the ZeroMind panel (search "crumble floor last one standing"), or by its guid with `zeromind.installAsset`. It brings what it is built on: **platformsKit** (the TileGrid the floor is made of), **Trapline** (the kill zone you fall into, in event mode) and **juiceKit** (screen shake and squash). Your world also needs **partyShowKit**, which runs the show the round plays in; the round does not pin it, so the game installs it and updates it freely.
## Kits used
| Kit | Version | How |
|---|---|---|
| platformsKit | 1.7.1 | a dependency: the TileGrid floor |
| Trapline | 1.6.3 | a dependency: the kill zone in event mode |
| juiceKit | 1.3.1 | a dependency: shake and squash |
| partyShowKit | 1.0.4 to 1.0.7 (named Showrunner in 1.0.6) | not a dependency: the game installs it; the show, contestants, bots, scores and standings |
## Practise solo
This world's own main scene practises the round: press Play. In your own world, register the round (below) and call `practice` in `build.luau`: `bots` takes 1 to 7, so `bots = 7` practises a full field of 8; `arena` is `candy`, `neon` or `frost`; `tuning` is `gentle`, `standard` or `chaotic`; `botLevel` is `easy`, `normal` or `hard`. With Showrunner 1.0.6 the module is `showrunner.api` instead of `partyShowKit.api`.
## 2 to 8 contestants
Everyone starts on the 4.5 m ring around the middle (3.4 m between neighbours with 8, every spot on a tile). With 2 to 4 contestants the floor is exactly as in the tunings below; above 4 it gains 3 columns and 3 rows for every 4 more contestants, so 8 play on 15 or 16 tiles across (about half as many tiles again), each keeping about as much floor as before. The floor widens to about 35 m across and the pit, the set and the lights move out with it; the Bench of Shame stays clear of the edge. The show kit draws the standings, all 8 rows.
## First example: drop it into a partyShowKit show
At the end of `scenes/main.scene/entrypoint.luau` (it runs on every machine, which is where rounds are registered):
```lua
local Show = require("partyShowKit.api")
Show.registerRound(require("crumbleFloorRound.round"))
```
and at the end of `content()` in `scenes/main.scene/build.luau`, either practise the round on its own:
```lua
require("partyShowKit.api").practice("crumbleFloor", { arena = "candy", tuning = "standard", bots = 3 })
```
or put it in a whole show with your other rounds:
```lua
require("partyShowKit.api").setup({ rounds = { "crumbleFloor", "tagTheBeacon" }, botLevel = "normal" })
```
Press **Play**. A title card explains the round, the 3-2-1 runs, and the floor starts to go under everyone's feet. Fall through every floor and you watch the rest from the Bench of Shame beside the arena. The last one standing ranks first. Keep the floor of your scene clear where the show builds its arenas: the round builds its own floor at the stage.
## How to play
- Every tile you step on shakes and turns to its warning colour, blinking faster, then drops.
- Keep moving to tiles that are still whole, and jump over the holes.
- In the standard and chaotic tunings there are floors under the top one: fall through and you land on the next. Fall through the last one and you are out.
- The round ends when one contestant is left, or when time runs out (everyone still standing shares the top place).
Controls are the show's: move with WASD, the arrow keys, the left stick or the touch stick; jump with Space, the A button or the touch Jump button.
## Arenas
| id | title | what it is |
|---|---|---|
| `candy` | Lollipop Lagoon | Candy hexagon tiles in five sweet colours over a fizzy cartoon sea (with a shark), giant striped lollipops and gumdrop islands. |
| `neon` | Hex Hyperdrive | Glowing glass hexagon panels over an endless violet void, rings of neon light and glowing pylons. |
| `frost` | Floe Frenzy | Square ice floes, white and pale blue, over freezing water among icebergs, with an aurora behind. |
Every arena has a title arch with the round's name, four light towers aimed at the floor and the Bench of Shame where knocked-out contestants watch.
## Tunings
| id | floors | tiles across | warning | random collapses | the last stretch |
|---|---|---|---|---|---|
| `gentle` | 1 | 13 | 2.0 s | none | from 70 s, one tile every 2.5 s |
| `standard` | 2 | 12 | 1.3 s | one tile every 4 s | from 60 s, one every 1.4 s |
| `chaotic` | 3 | 12 | 0.8 s | two tiles every 1.2 s | from 40 s, every 0.5 s |
A show's tuning table is merged over these, so `practice("crumbleFloor", { tuning = "standard" })` with your own `tuning` numbers changes only what you name (`layers`, `cols`, `rows`, `wait`, `randomEvery`, `randomBurst`, `suddenAfter`, `suddenEvery`).
## Computer players
Bots look ahead over the tiles around them for ones that will still be there when they arrive, prefer tiles with whole neighbours (room to escape), the middle of the floor and room from the others, and step one tile at a time toward the best place they found, hopping a hole when they must.
| level | looks ahead | thinks every | blunders | holds a cracking tile |
|---|---|---|---|---|
| easy | 1 tile | 0.75 s | 28% of decisions | never |
| normal | 2 tiles | 0.4 s | 8% | until 1.05 s of warning are left |
| hard | 3 tiles | 0.15 s | never | until 0.85 s are left |
Holding a cracking tile saves floor, which is how a good player outlasts the others. Measured on the standard floor (two floors, 12 across), three hard bots against each other lasted 35 s and 51 s for third and second place, and the winner longer still; an idle contestant who never moves is out in under 5 s. The planner is `crumbleFloorRound.brain` (`B.plan(view, opts)`), pure and testable.
## Multiplayer
The floor is a platformsKit `TileGrid` that every machine builds from the same settings, keyed by the round's seed, so every machine sees the same tile shake and drop at the same moment; a player who joins late gets every break so far, and the next host carries on if the host leaves. Each machine breaks tiles under its own player; the host breaks them under computer players (`touchedBy = "any"`) and makes the random collapses. Falls are a Trapline `KillZone` in event mode under the lowest floor: every machine hears the fall, the host knocks the contestant out. Music, sounds and screen shake are made on each machine.
## Phones, tablets and the browser
A floor of up to about 300 tiles costs about 0.2 ms of script a frame (platformsKit 1.7 measured 300 tiles at no change in engine CPU): two plain meshes and one collider per tile, three shared materials, work only for tiles that are shaking or falling. The set is built from plain shapes with no textures. Touch controls come from the show.
Measured with 8 contestants (0.1.3, you and 7 hard computer players, chaotic Lollipop Lagoon: three floors of 15 by 15, 12 s mid-round on the desktop app): engine CPU 9.8 ms mean, p95 12.3 ms, 62 fps. Biggest costs: 8 character controllers 1.4 ms, the TileGrid 1.0 ms, the show 0.9 ms.
## The contract fields it uses
`id = "crumbleFloor"`, `title`, `blurb`, `howTo`, `kind = "survival"`, `seconds = 100`, `spawnRadius = 4.5`, `benchDistance = 25`, `arenas`, `tunings`, `controls`, `image` (the card picture, `card.texture`, resolved in the round module so it works wherever the package is installed; a show that knows the field shows it on the round picker and title cards, one that does not ignores it), and `build(ctx)`, `start(ctx)`, `update(ctx, dt)`, `botThink(ctx, c, dt)`, `stop(ctx)`. From `ctx` it reads `arena`, `origin`, `tuning`, `tuningId`, `seed`, `random`, `isHost`, `time`, `contestants` (`id`, `name`, `body`, `out`, `level`, `skill`), `me()`, and calls `knockOut`, `setScore` (seconds survived), `announce`, `moveBot` and `jumpBot`.
## Modules
- `crumbleFloorRound.round`: the round table (what you register).
- `crumbleFloorRound.arenas`: the three arenas: `A.ORDER`, `A.byId[id]` (title, blurb, floor settings, kill zone look, colours) and `A.dress(root, id, opts)`.
- `crumbleFloorRound.brain`: the computer players' planner: `B.LEVELS`, `B.level(skill)`, `B.score`, `B.plan`.
## Sounds and music
Original, made for this round: a bouncy game show theme that loops while the round runs, and a crack, a crumble, a fall and a whoosh (when you jump). Under `crumbleFloorRound.package/audio/`.
## Guides
- **How to make a falling tiles last one standing minigame** (`crumbleFloorRound.package/guides/how-to-make-a-falling-tiles-last-one-standing-minigame`): adding this round to a party game, choosing arenas and tunings, and how its floor, falls and computer players are built from platformsKit and Trapline, so you can make your own.
## Tests
`zero tests run crumbleFloorRound` in edit mode: the round's contract fields, every arena and tuning, building every arena in every tuning (floors, layers, the kill zone in event mode under the lowest floor, the set), a full round with a stand-in show (start, the floor turning on, random collapses on the host, a body in the pit knocked out, scores, stop taking everything down), the computer players' planner (never a gone tile, a step always to a neighbour, room to escape preferred, blunders, looking ahead, the way out when every tile is cracking), the bot driver walking and holding, 8 contestants (the show kit's own contract check reached by a built name, the floor growing for a crowd, a bigger floor for 8 fake contestants with every start spot on a tile and the bench clear, a step planned for each of 8 fake computer players), the audio, the version in three places and no long dashes in the docs. The tests build everything they need themselves and leave nothing behind.
## Known limits
- Bot bodies: a computer player is simulated on a body of its own that its show pawn follows, so a fall is matched to the contestant standing where the fallen body is.
- Three hard bots on one floor use it up quickly; for longer rounds pick `gentle` or give the tuning more `cols` and `rows`.
## Version history
### 0.1.3
- 2 to 8 contestants: above 4 the floor gains 3 columns and 3 rows for every 4 more contestants (`R.forCrowd(tuning, n)`, counted when the round builds), so 8 play on about half as many tiles again with the set, the pit and the lights moving out with the floor; 2 to 4 play exactly as before. Tests check it with 8 fake contestants, plus the show kit's own contract check reached by a built name (`partyShowKit`, then `showrunner`).
- The README says how to practise solo (up to 7 computer players) and lists the kits with versions. Practice-played with 7 hard computer players: all 8 seated, standings show 8 rows; engine CPU 9.8 ms mean, p95 12.3 ms.
- The world moved to @builtin eb50477.
### 0.1.2
- The round carries a card picture: `image` on the round table is `card.texture`, a 1280x720 shot of Lollipop Lagoon mid-round with contestants and crumbling tiles, so a show's round picker and title cards show the round itself. Checked against partyShowKit 1.0.4, which this kit still does not name as a dependency or require in any shipped file (the game installs partyShowKit).
### 0.1.1
- Every module and sound now carries its description, and the hard computer players step one tile at a time toward the best tile they find (they used to walk straight at a far tile and break the floor on the way): on the standard floor they now last 35 to 51 s against each other instead of about 15.
### 0.1.0
- First release: three arenas, three tunings, computer players at three levels, original music and sounds, a gallery scene, tests and a how-to guide.