Skip to content

Runnable examples ​

Four small plots. Each one lints clean, builds, type-checks against plot/sdk/host.d.ts, and runs in the headless room with the base game's rules (Bedwars as a mod on the Team Minigame runtime, plot/samples/team-minigame). Commands run from servers/inventery/. The full samples (Team Minigame with Bedwars and Spleef as game mods, the story dungeon, the glTF level, Hidden Roles) are in plot/samples/. The Run column is what follows node docs/developers/examples/run.mjs docs/developers/examples/<example>; Bedwars runs the runtime with the example as its mod instead.

ExampleKindShowsRun
lanternsmoda block, an item, a recipe, a world event listener (quickstart)--place lanterns:lantern@5,0,4 --break 5,0,4 --seconds 1
bedwarsmodBedwars as a game mod on the Team Minigame runtime: a map as data, the kit, beds as each team's respawn status, generators, a shop through the runtime's buttons, the base game's beds, PvP, drops and pickup filtered (guide)run.mjs plot/samples/team-minigame --mods docs/developers/examples/bedwars --lobby 2 --players 2 --break 28,21,13 --hit
dungeonruntimean NPC per party, dialogue, a door, a boss you tap to hit, a profile that follows the player (guide)--seconds 2
arenaruntime30 Hz, input, lag-compensated hits, tracers, a duel's equal start (guide)--players 2 --fire
sh
node plot/sdk/lint.mjs docs/developers/examples/bedwars
node plot/sdk/build.mjs plot/samples/team-minigame       # the runtime the Bedwars mod runs on
node plot/sdk/build.mjs docs/developers/examples/bedwars
node docs/developers/examples/run.mjs plot/samples/team-minigame --mods docs/developers/examples/bedwars \
  --lobby 2 --players 2 --break 28,21,13 --hit            # a round: ana breaks blue's bed, then hits bob out
npx tsc -p docs/developers/examples/tsconfig.json     # type-checks all four

run.mjs puts the plot at [0, -16, 0] to [32, 64, 32] (--size 48,96,48 for a bigger one) in a headless room with the base game's rules, loads one package, or a runtime with its mods (--mods, like a monument's entry in the plots config; --lobby N overrides the runtime's lobby size), walks players in from the west, waits (12 s by default, long enough for the entry protection and a start countdown), does the actions as the first player (who steps up next to the block first: the base rules check reach; --hit swings at the second player until they die), and prints each lobby (players, locked, counting down, suspended) and each player's position, plot health, inventory, and the UI and chat they received.

build.mjs writes dist/ inside the example's folder (ignored by git).