import Phaser from './vendor/phaser.js'; import { config } from './config/Config.js'; import { ConfigLoader } from './config/ConfigLoader.js'; import { createGameConfig } from './config/GameConfig.js'; import { MenuScene } from './scenes/MenuScene.js'; import { GameScene } from './scenes/GameScene.js'; import { SurfaceScene } from './scenes/SurfaceScene.js'; import { installBuildDiag } from './dev/BuildDiag.js'; import { installNavDiag } from './dev/NavDiag.js'; import { awaitFonts } from './utils/Fonts.js'; /** * Orbit — entry point. * * 1. Load config JSON (data/manifest.json → data/*.json) * 2. Initialize the global config singleton * 3. Build the Phaser game config and attach the scenes * 4. Boot */ async function boot() { const data = await ConfigLoader.load(); config.init(data); console.info('orbit — config loaded', Object.keys(data).join(', ')); // Read-only console diagnostics (orbitDiag / orbitDiagBrief). See // js/dev/BuildDiag.js — it also self-logs a one-line report whenever // the Build console opens. installBuildDiag(); // The SYSTEM category's NAV chart (orbitNav / orbitNavBrief). See // js/dev/NavDiag.js — which NAV points of the current system are still // undiscovered, i.e. why the jumpgate tech may still be locked. installNavDiag(); await awaitFonts(); console.info('orbit — fonts ready (or timed out)'); const gameConfig = createGameConfig(); gameConfig.scene = [MenuScene, GameScene, SurfaceScene]; const game = new Phaser.Game(gameConfig); // Handy for console debugging. window.game = game; window.config = config; console.info( `%c${config.get('game.name', 'Orbit')} %c${config.get('game.version', '')}`, 'font-weight:bold;font-size:14px', 'color:#8fa0c9', ); } // --------------------------------------------------------------------- // Boot. `?combat` boots this SAME normal game with the combat demo live // (GameScene._wantsCombatDemo: the hostile pack spawns when the player // starts, the deck swaps for the combat bar while combat is live — // js/combat/CombatSystem.js + js/ui/CombatBar.js). The standalone range // is its own page: combat.html (or the dev server's /combat — // js/combat/main.js → the WASD arena). function showBootError(err) { console.error(err); const pre = document.createElement('pre'); pre.style.cssText = 'color:#ff9b9b;font:14px/1.6 monospace;padding:2rem;white-space:pre-wrap;margin:0'; pre.textContent = `Failed to start Orbit:\n${(err && (err.stack || err.message)) || err}`; document.body.appendChild(pre); } boot().catch(showBootError);