- Boot the game from a static server with no build step (Phaser 4 vendored in lib/) - Main menu (New Game button) and GameScene where clicking makes the ship fly there - All tunables live in data/*.json (game/menu/ship), loaded via manifest + Config singleton - Ship behavior driven by arcade physics (thrust, drag, maxSpeed, arrival) with a Node test harness (dev/ship-behavior.test.mjs) and a dev smoke page that boots straight into GameScene - Project conventions documented in docs/PROJECT_NOTES.md; README rewritten to describe layout, run instructions, and dev tools |
||
|---|---|---|
| data | ||
| dev | ||
| docs | ||
| js | ||
| lib | ||
| README.md | ||
| index.html | ||
README.md
Orbit
A procedurally generated space RPG in the spirit of Privateer, in top-down 2D. Built with Phaser 4 as plain ES6 modules — no build step, no package managers required to run.
Run it
Any static file server works (Python, Node, Caddy, nginx, …):
cd orbit
python3 -m http.server 8080
# → http://localhost:8080
Must be served over http(s) — opening
index.htmlviafile://won't work, because the game uses ES modules andfetches its JSON config.
Current state — v0.1 foundation
- Main menu with a New Game button
- Game screen with a basic top-down ship: click anywhere to fly there
- Config-driven setup: every tunable value lives in
data/*.json
Project layout
orbit/
├── index.html # boots the game
├── data/ # ← ALL tunable config (edit these freely)
│ ├── manifest.json # which config files exist
│ ├── game.json # dimensions, colors, starfield, …
│ ├── menu.json # menu text, colors, button layout
│ └── ship.json # ship feel: thrust, drag, maxSpeed, …
├── lib/ # vendored third-party libs (Phaser 4.2.1)
├── js/
│ ├── main.js # entry point: load config → boot Phaser
│ ├── config/ # Config singleton, ConfigLoader, game config
│ ├── scenes/ # MenuScene, GameScene (thin, orchestration)
│ ├── entities/ # Ship (own behavior)
│ ├── ui/ # MenuButton (reusable)
│ ├── visuals/ # Starfield (decorative)
│ ├── utils/ # small helpers (Color)
│ └── vendor/ # shim to the vendored Phaser
└── docs/PROJECT_NOTES.md # ← project conventions: read this
Conventions (short version)
- Config in JSON. If a value might change, it goes in
data/, not code. Add a file = one line indata/manifest.json. - One class per file, ES modules, scenes stay thin, entities own their
behavior. Details in
docs/PROJECT_NOTES.md. - Phaser is imported only via
js/vendor/phaser.js(one-file version swap).
Dev tools
node dev/ship-behavior.test.mjs # runs the real Ship.update() loop in Node
dev/test-game.html boots straight into the GameScene (no menu click),
handy for manual testing of the flight feel.
Phaser
Phaser 4.2.1 is vendored at lib/phaser.min.js (UMD build, MIT license —
see lib/PHASER_LICENSE.md). No internet or npm needed at runtime.