-
Notifications
You must be signed in to change notification settings - Fork 0
CLI
The sim binary wraps Vite and the engine's plugins. Your game defines these scripts
(the starter does this for you):
{
"scripts": {
"dev": "sim dev",
"build": "sim build",
"editor": "sim editor",
"preview": "sim preview",
"check": "sim check"
}
}Starts the Vite dev server with HMR. Serves the game at / and the Content Editor at
/editor. The editor's data API (/editor/api/*) reads and writes your data/*.json.
Produces a single self-contained dist/index.html via vite-plugin-singlefile — all JS
and CSS inlined, console/debugger stripped, CSS minified. No editor is included in the
production build.
Same as sim dev, but also prints the editor URL for convenience.
Serves a production build locally to sanity-check the single-file output.
Validates content referential integrity — every reference in your data (item ids, location
ids, scene ids, …) must resolve to something that exists. Prints each issue as
source: references unknown <kind> '<id>' and exits non-zero if any are found. It also
warns about data files that are referenced but missing. Run it in CI.
The CLI resolves @chemicalluck/engine from your project's node_modules, so a game always
builds against the engine version it depends on. Nothing is hard-coded to a global install.
Drop a sim.config.js (or .mjs) in your project root to extend the build. All fields are
optional:
export default {
// Extra Vite plugins, appended after the engine's.
plugins: [],
// Extra resolve aliases, merged over the defaults (`~` → ./src).
alias: {},
// Extra gamePlugin slot specs (advanced — custom convention files).
extraSlots: [],
// Arbitrary Vite InlineConfig, merged last.
vite: {},
};You never need a vite.config.ts — the CLI assembles the full Vite config (React, Tailwind,
the game plugin, the editor plugin, single-file build) for you.
Built with the sim framework · Edit these docs in docs/wiki/ and run docs/sync-wiki.sh.
sim
Building a game
Reference