/** * Dev-only smoke test: boots the game directly into the GameScene * (skipping the menu), so the flight scene can be screenshotted/checked * without clicking "New Game". * * python3 -m http.server 8080 * firefox --headless --screenshot shot.png \ * --window-size=1280,720 http://localhost:8080/dev/test-game.html * * Dev hooks (URL params, dev only — ignored by the game itself): * ?ship=, teleport the ship to a world position after boot * (screenshots of far-off states — e.g. the off-screen * compass arrows pointing back at the home world). * ?near= fly the ship to (edge-to-edge) from the first * system planet — screenshots the discovery moment * (rim ping + toast) with the world in view. */ import Phaser from '../js/vendor/phaser.js'; import { config } from '../js/config/Config.js'; import { ConfigLoader } from '../js/config/ConfigLoader.js'; import { createGameConfig } from '../js/config/GameConfig.js'; import { GameScene } from '../js/scenes/GameScene.js'; const data = await ConfigLoader.load(); config.init(data); const gameConfig = createGameConfig(); const shipParam = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('ship') : null; const nearParam = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('near') : null; gameConfig.scene = [GameScene]; const game = new Phaser.Game(gameConfig); window.game = game; console.info('smoke: game booted into GameScene'); if (shipParam) { const [sx, sy] = shipParam.split(',').map(Number); if (Number.isFinite(sx) && Number.isFinite(sy)) { setTimeout(() => { const s = game.scene.getScene('GameScene'); s.ship.setPosition(sx, sy); s.cameras.main.setScroll(sx - s.scale.width / 2, sy - s.scale.height / 2); console.info(`smoke: ship teleported to (${sx}, ${sy})`); }, 500); } } if (nearParam) { const px = Number(nearParam) || 400; setTimeout(() => { const s = game.scene.getScene('GameScene'); const p = s.systemPlanets[0]; if (!p) return; // Place the ship on the planet→origin axis, `px` (edge-to-edge) off // the rim — inside the discovery distance, with the world in view. const ang = Math.atan2(-p.y, -p.x); const sx = p.x + Math.cos(ang) * (p.radius + px); const sy = p.y + Math.sin(ang) * (p.radius + px); s.ship.setPosition(sx, sy); s.cameras.main.setScroll(sx - s.scale.width / 2, sy - s.scale.height / 2); console.info(`smoke: ship parked ${px}px off ${p.discoveryName}'s rim`); }, 500); }