5 minutes
Download a Runnable Scene
TL;DR: With
npm run devrunning,bjs download scene coin-arena --alldropsscene.jsonandmanifest.jsonintopublic/scenes/coin-arena/and opens?scene=/scenes/coin-arena/scene.json. The scene is data. YourPickupSystemandDropSystemturn it into a game; take them out ofmain.tsand it is a level you can walk around and nothing more.
In the ECS course you built a coin arena by hand and opened it with ?scene=/scenes/coin-arena.json. The same arena is in the catalog as a free scene. This lesson pulls it down with one command and watches it run.
Scene options
download scene is a subcommand with its own options:
The help says "component name" because most catalog scenes show off one component. The name really maps to an asset key: coin-arena is the asset scene-coin-arena. So this is the same token-then-file download as last lesson, with a fixed place to land. --all also fetches the components and model files the scene lists. The arena uses only built-in components and no model files, so here it adds nothing, but a scene built on catalog components needs it.
Download it into the running game
Start the dev server in one terminal:
In a second terminal, pull the scene:
The CLI found your dev server on port 3000, the port in vite.config.js, and opened the preview in your browser. The address is the ?scene= override from ECS Lesson 5, URL-encoded. Drive the capsule into a few coins with WASD. Your console prints what your own listener from the ECS course prints:
New coins keep dropping from the pool, one a second.
What landed
Two files:
scene.json is the level: entities and their components by name, the same file you wrote by hand. manifest.json is the list --all reads:
components names catalog components the scene needs, and assets names model and sound files. Both are empty, because every component in the arena is built into the arcade package. A scene that used Lifetime would list it, and --all would download it the way Lesson 4 did.
The coins counted because my-game's src/main.ts still has the two lines you added in ECS Lessons 6 and 7:
Break it: the same scene without your systems
Put // in front of both lines in src/main.ts and save. The page reloads on the same address with the whole arena, but the capsule goes straight through the coins, the console prints no coins lines, and no new coins drop. Every component name in the file still resolves, since they all ship in the arcade package. Nothing is left that says what touching a coin means. A downloaded scene carries data. The rules that make it a game are code in the project that loads it. Take the // back out.
Break it: no dev server, wrong name
Stop the server and download again. The files land, but there's no game to open, so the CLI prints the address instead of opening it:
A name with no scene behind it stops after the first request:
Unlike a plain bjs download, the scene form doesn't retry the name as a component. A scene is always an asset.
So far everything came from the marketplace. The next lesson gets source without it: the built-in components already in your node_modules.
Next: Eject a Built-In Component: arcade eject copies a component and everything it depends on into src/components/, where your copy runs instead of the package's.