diff --git a/CHANGELOG.md b/CHANGELOG.md index a7ad4a4..48da9ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. -## [Unreleased] +## [1.35.0] - 2026-11-14 ### Added @@ -11,10 +11,11 @@ All notable changes to this project will be documented in this file. ### Changed -- Lance is now your main gun from sector 3 on, and Scatter and Seekers are special guns you use on a charge. Press Q (or the swap button on touch screens) to go Lance → Scatter → Seekers → Lance. A special gun runs down a charge meter: a full meter lasts 10 seconds, and when it empties you go back to Lance on your own, with the gun's name flashing over your ship. The meter only refills on Lance, over 30 seconds, and every enemy you destroy tops it up a little. You need a fifth of the meter to leave Lance; below that Q just clicks. Switching between the special guns, or back to Lance, always works. +- Lance is now your main gun from sector 3 on, and Scatter and Seekers are special guns you use on a charge. Press Q (or the swap button on touch screens) to go Lance → Scatter → Seekers → Lance. A special gun runs down a charge meter: a full meter lasts 8 seconds, and when it empties you go back to Lance on your own, with the gun's name flashing over your ship. The meter only refills on Lance, over 40 seconds, and every enemy you destroy tops it up a little (half a percent). You need a fifth of the meter to leave Lance; below that Q just clicks. Switching between the special guns, or back to Lance, always works. - The meter starts full at the start of every sector and after you respawn or load a checkpoint. Pausing and hit-stops never run it down. - The HUD shows the current gun and its charge under your reserve ships from sector 3: amber while a special gun drains it, cyan while Lance refills it. The touch swap button shows the same charge along its foot. Sectors 1 and 2 are unchanged: standard gun, no meter, and Q does nothing. -- `bun run balance:bosses` measures every boss with Lance only; its `--guns` option is gone. +- Seven bosses have less hull now that Lance is the main gun: Marshal Vectra 505 → 440, Reef Stalker 625 → 550, Bastion Bulwark 520 → 460, Choir Regent 1040 → 830, Umbral Ark 1320 → 1170, Hive Maelstrom 1645 → 1580, Omega Null 1300 → 1230. Pyre Herald and every par time are unchanged. Spending the charge whenever the meter is full kills each boss a little under par; never pressing Q stays close to par, so the boss speeds up but never walls you. +- `bun run balance:bosses` measures three gun policies: Lance only, and Scatter or Seekers spent whenever the meter is full. `--guns lance,scatter,seekers` picks policies and `--runs N` repeats each fight; a summary table shows each sector's mean kill time against par, the run-to-run spread, deaths and the share of the fight flown on a special gun. ### Removed diff --git a/README.md b/README.md index 3301d54..499f873 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ Playable here: | | | |---|---| -| ![Main menu](docs/screenshots/menu.webp) | ![A sector 3 fight with the Scatter gun](docs/screenshots/sector-3-scatter.webp) | -| ![Choosing a main gun at the refit bay](docs/screenshots/ship-system-pick.webp) | ![The refit bay between sectors](docs/screenshots/refit-bay.webp) | -| ![A sector 4 fight with the Lance gun](docs/screenshots/sector-4-lance.webp) | ![The first boss, Pyre Herald](docs/screenshots/first-boss.webp) | +| ![Main menu](docs/screenshots/menu.webp) | ![A sector 3 fight with Scatter out on the charge](docs/screenshots/sector-3-scatter.webp) | +| ![The card that introduces the special guns](docs/screenshots/special-guns-card.webp) | ![The refit bay between sectors](docs/screenshots/refit-bay.webp) | +| ![A sector 4 fight with the Lance, the main gun](docs/screenshots/sector-4-lance.webp) | ![The first boss, Pyre Herald](docs/screenshots/first-boss.webp) | ## Quick start @@ -119,7 +119,7 @@ Bought during the planet intermission screen using score as currency: - **Fire Rate** — improves firing speed - **Shield** — increases hit absorption - **AEGIS Picket** — installs and overclocks automatic flank-defense turrets -- **Lance and special guns** — from sector 3 the ship flies Lance, a piercing gun. Q (or the touch swap button) switches to Scatter or Seekers for as long as a charge meter lasts: a full meter gives 10 seconds, then the gun returns to Lance. On Lance the meter refills over time and a little with every kill, and you need a fifth of it to switch again. The meter starts full every sector and after every respawn or checkpoint load. A short card at the refit bay after sector 2 explains all this +- **Lance and special guns** — from sector 3 the ship flies Lance, a piercing gun. Q (or the touch swap button) switches to Scatter or Seekers for as long as a charge meter lasts: a full meter gives 8 seconds, then the gun returns to Lance. On Lance the meter refills over 40 seconds and a little with every kill, and you need a fifth of it to switch again. The meter starts full every sector and after every respawn or checkpoint load. A short card at the refit bay after sector 2 explains all this - **Ship systems** — free picks after sectors 5 and 8 that change how the ship plays: a support system (Magnet, Surge Core, Wingman) and a doctrine (Overdrive, Bulwark, Salvager). Picks can be changed freely at any later refit bay, and mid-run from the pause panel - **A different run every time** — each run has its own sky and may fly sectors mirrored; RETRY replays the same run, NEW RUN starts a fresh one diff --git a/docs/level-design.md b/docs/level-design.md index 0a855f5..0ed1d24 100644 --- a/docs/level-design.md +++ b/docs/level-design.md @@ -24,13 +24,13 @@ shields recharge on every respawn. Levels 5–10 add payoff without adding player inputs: - **AEGIS Picket** becomes purchasable after Level 4. Its fixed flank turrets trim chaff with flat-damage bolts while the main gun remains the dominant damage source. Pickets never target bosses. -- **Main guns** (`config/shipSystems.ts`): sectors 1–2 fly the standard bolt and have no gun input, so the opening stays a gentle introduction. From sector 3 the home gun is Lance; Scatter and Seekers are special guns borrowed on a charge, not picks. Each gun trades single-target damage for one strength and scored inside the standard gun's run-to-run spread in sector 5. Q or the touch swap key steps Lance → Scatter → Seekers → Lance. One meter, `SPECIAL_GUN_CHARGE`, counted on the gameplay clock, pays for the specials: it drains while one is selected (a full meter lasts 10 s) and returns the gun to Lance at empty; on Lance it refills over 30 s plus a bonus per enemy destroyed; leaving Lance needs at least 0.2 of it, while moving between specials or back to Lance is always allowed. It starts full every sector and after every respawn or checkpoint load, and is never saved. Feedback is a name flash over the ship and a short swap sound on every change (including the automatic return), the quiet click when leaving Lance is refused, each gun's own shot look (the profile's `look`), and the HUD's gun row under the reserve ships: the gun's name and a charge bar that burns amber while a special drains and refills cyan on Lance, with a tick at the threshold. The touch swap key mirrors the bar along its foot. The guns are taught, never picked: the refit bay after sector 2 opens on a one-button SPECIAL GUNS ONLINE card (`planetIntermission/specialGunIntro.ts`, shown on every visit to that bay and no other), and sector 3 only points at the swap until the first one there (`ShipSystemsRuntime.isSwapHintPending`): a `Q SPECIAL GUN` label beside the charge bar on a keyboard, a pulsing ring around the touch swap key. +- **Main guns** (`config/shipSystems.ts`): sectors 1–2 fly the standard bolt and have no gun input, so the opening stays a gentle introduction. From sector 3 the home gun is Lance; Scatter and Seekers are special guns borrowed on a charge, not picks. Each gun trades single-target damage for one strength and scored inside the standard gun's run-to-run spread in sector 5. Q or the touch swap key steps Lance → Scatter → Seekers → Lance. One meter, `SPECIAL_GUN_CHARGE`, counted on the gameplay clock, pays for the specials: it drains while one is selected (a full meter lasts 8 s) and returns the gun to Lance at empty; on Lance it refills over 40 s plus 0.005 per enemy destroyed; leaving Lance needs at least 0.2 of it, while moving between specials or back to Lance is always allowed. It starts full every sector and after every respawn or checkpoint load, and is never saved. Feedback is a name flash over the ship and a short swap sound on every change (including the automatic return), the quiet click when leaving Lance is refused, each gun's own shot look (the profile's `look`), and the HUD's gun row under the reserve ships: the gun's name and a charge bar that burns amber while a special drains and refills cyan on Lance, with a tick at the threshold. The touch swap key mirrors the bar along its foot. The guns are taught, never picked: the refit bay after sector 2 opens on a one-button SPECIAL GUNS ONLINE card (`planetIntermission/specialGunIntro.ts`, shown on every visit to that bay and no other), and sector 3 only points at the swap until the first one there (`ShipSystemsRuntime.isSwapHintPending`): a `Q SPECIAL GUN` label beside the charge bar on a keyboard, a pulsing ring around the touch swap key. - **Ship systems** are free one-of-three picks at the refit bay after sectors 5 and 8. They change how the ship plays rather than how hard it hits. A system works without input; the only input is changing one. Once a slot has a pick the player may change it to another option of that slot: freely at every later refit bay (the picks sit beside the upgrade cards and reopen the pick dialog, which Escape dismisses) and mid-run from the pause panel's SYSTEMS tab. The current pick is saved with the run. - **Run variation** comes from one seed per run (`systems/runVariation.ts`, `systems/gameplayRandom.ts`). It decides the wave choices, whether each sector is mirrored left to right, and the sky. Two rules keep scores comparable: the sky is looks only, and the only layout change is the mirror, which is as hard by symmetry. Never vary wave order, enemy counts or timing by seed. RETRY keeps the seed; NEW RUN draws a new one. Enemies, asteroids and wormholes each draw from their own seeded stream, so one cannot shift another's choices; how far a run gets through a stream still depends on play. Enemy jitter and pickup drops stay unseeded because they depend on how the fight goes. - **Marked Aces** are sparse authored variants of existing enemies. Their gilded treatment signals 2× durability, 4× score, and exactly one guaranteed power-up. - **Boss volleys are telegraphed.** For the last 400 ms before every volley the boss's core swells and its hardpoints flash white. Bosses have no stun or bonus-damage window; fights are paced by the wind-up and each attack's cooldown. - **Boss fights are authored rotations.** A boss's whole fight lives in its level file (`BossConfig`): phases start at hull thresholds (any number of them), and each phase steps through an ordered list of attacks, each with its own cooldown, never picked at random. An attack can send the boss to an anchor first (`x` a share of the screen width, `y` pixels from the top) and holds the volley until it arrives, so a safe spot does not stay safe. Shared building blocks live in `entities/enemies/boss/volleys.ts`: arcs, aimed arcs, spirals, escort summons, a wall with one gap, an aimed burst, and a beam that reuses the hazard beam and its telegraph. A shielded attack keeps the hull closed from the previous volley until it fires, and only then. -- **Boss hull is authored, not scaled.** Upgrades shorten boss fights; nothing raises boss hull. Each boss has a par time (45-70 s) and a hull tuned so the sector's representative ship meets it with the measurement bot (`bun run balance:bosses`, which states the ship). Past par, cooldowns shrink evenly to 25% faster over 30 s; the wind-up keeps its length. The sector 3 boss does not escalate. A kill under par pays 200 points per whole second left. Fight time is the boss's gameplay clock, so pause and hit-stop never count. +- **Boss hull is authored, not scaled.** Upgrades shorten boss fights; nothing raises boss hull. Each boss has a par time (45-70 s) and a hull tuned with the measurement bot (`bun run balance:bosses`, which states the ship): flying the sector's representative ship and spending the special-gun charge on Scatter or Seekers whenever the meter is full, it kills every boss in 85-100% of par without dying, and on Lance alone it stays within about 5% past par. The policies spend about a quarter of each fight on a special gun. Past par, cooldowns shrink evenly to 25% faster over 30 s; the wind-up keeps its length. The sector 3 boss does not escalate. A kill under par pays 200 points per whole second left. Fight time is the boss's gameplay clock, so pause and hit-stop never count. - **Max-chain Overdrive** reduces the main-gun cooldown by 15% while the existing chain multiplier remains at x5. It adds no input and ends immediately when the chain falls. These systems must preserve Lane-Reading, avoid persistent HUD panels, and remain independently removable through upgrade/config gates. diff --git a/docs/screenshots/first-boss.webp b/docs/screenshots/first-boss.webp index f617f5c..6fb27e5 100644 Binary files a/docs/screenshots/first-boss.webp and b/docs/screenshots/first-boss.webp differ diff --git a/docs/screenshots/menu.webp b/docs/screenshots/menu.webp index fe638cc..50f963f 100644 Binary files a/docs/screenshots/menu.webp and b/docs/screenshots/menu.webp differ diff --git a/docs/screenshots/refit-bay.webp b/docs/screenshots/refit-bay.webp index 04e6fc2..d72eb59 100644 Binary files a/docs/screenshots/refit-bay.webp and b/docs/screenshots/refit-bay.webp differ diff --git a/docs/screenshots/sector-3-scatter.webp b/docs/screenshots/sector-3-scatter.webp index 6900be2..12a1cc8 100644 Binary files a/docs/screenshots/sector-3-scatter.webp and b/docs/screenshots/sector-3-scatter.webp differ diff --git a/docs/screenshots/sector-4-lance.webp b/docs/screenshots/sector-4-lance.webp index fd6bb4f..4d8db11 100644 Binary files a/docs/screenshots/sector-4-lance.webp and b/docs/screenshots/sector-4-lance.webp differ diff --git a/docs/screenshots/ship-system-pick.webp b/docs/screenshots/ship-system-pick.webp deleted file mode 100644 index 73eef39..0000000 Binary files a/docs/screenshots/ship-system-pick.webp and /dev/null differ diff --git a/docs/screenshots/special-guns-card.webp b/docs/screenshots/special-guns-card.webp new file mode 100644 index 0000000..58184b2 Binary files /dev/null and b/docs/screenshots/special-guns-card.webp differ diff --git a/package.json b/package.json index ebda8c3..2f34bfb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "space-explorer", - "version": "1.34.0", + "version": "1.35.0", "author": "Douwe de Vries", "license": "MIT", "private": true, diff --git a/scripts/balance/bossFights.ts b/scripts/balance/bossFights.ts index 4930d3d..6dd46c3 100644 --- a/scripts/balance/bossFights.ts +++ b/scripts/balance/bossFights.ts @@ -5,24 +5,37 @@ * * bun run balance:bosses * bun run balance:bosses --sectors 6 --port 4302 + * bun run balance:bosses --guns scatter --runs 3 * bun run balance:bosses --invulnerable # time to kill even where the bot would die * * Starts its own dev server (the browser harness is dev-only), jumps straight to each boss with the * sector's representative ship, and lets `startBossFight` in the browser harness fly a fixed bot: it * holds a low line under the boss and steps away from shots that will cross it. Every boss sector flies - * Lance; the bot never spends the special-gun charge. Fights run in real - * time on the gameplay clock (no speed-up), several at once in separate pages; `seconds` is gameplay - * time from the boss alarm to the kill, so pauses and hit-stops do not count. + * Lance, and each fight follows one gun policy (`--guns`, all three by default): + * - `lance` never presses swap, the floor a player who ignores the special guns meets. + * - `scatter` / `seekers` spend the charge the way a decent player would: once the boss has taken its + * first hit, every time the meter is full on Lance, press swap until that gun is up (Seekers is two + * presses away) and ride it until the empty meter hands Lance back. + * The bot reads the meter from the harness snapshot and presses Q like a player, a few times a second. + * Fights run in real time on the gameplay clock (no speed-up), several at once in separate pages; + * `seconds` is gameplay time from the boss alarm to the kill, so pauses and hit-stops do not count. */ import { chromium, type Browser } from '@playwright/test'; import { createServer } from 'vite'; import type { BossFightReport } from '../../src/browserHarness'; +import { getLevelConfig } from '../../src/config/LevelsConfig'; import { getUpgradeByKey, getUpgradeProgressionLimit, type UpgradeKey } from '../../src/config/UpgradesConfig'; const BOSS_SECTORS = [3, 4, 5, 6, 7, 8, 9, 10]; +const GUN_POLICIES = ['lance', 'scatter', 'seekers'] as const; +type GunPolicy = (typeof GUN_POLICIES)[number]; +/** How often the bot looks at the meter: a player glancing at the HUD, not a frame-perfect script. */ +const POLICY_POLL_MS = 250; interface Options { sectors: number[]; + guns: GunPolicy[]; + runs: number; parallel: number; limitSeconds: number; invulnerable: boolean; @@ -41,6 +54,11 @@ function parseOptions(argv: readonly string[]): Options { .map((part) => part.trim()); return { sectors: list('--sectors')?.map(Number) ?? BOSS_SECTORS, + guns: (list('--guns') ?? [...GUN_POLICIES]).map((gun) => { + if (!GUN_POLICIES.includes(gun as GunPolicy)) throw new Error(`--guns: unknown policy ${gun}`); + return gun as GunPolicy; + }), + runs: Number(flag('--runs') ?? 1), parallel: Number(flag('--parallel') ?? 4), limitSeconds: Number(flag('--limit') ?? 240), invulnerable: argv.includes('--invulnerable'), @@ -60,13 +78,22 @@ function representativeUpgrades(sector: number): string { return levels.join(','); } +/** Whether the policy presses swap now, given the gun and meter the HUD shows. */ +function wantsSwap(policy: GunPolicy, gun: { id: string; charge: number }): boolean { + if (policy === 'lance') return false; + if (gun.id === 'lance') return gun.charge >= 1; + // On the way to Seekers the swap passes Scatter; once on the policy's gun, ride it out. + return gun.id !== policy; +} + interface FightResult extends BossFightReport { sector: number; + gun: GunPolicy; /** Frames per second the page held; the bot needs a real frame rate to dodge like a player. */ fps: number; } -async function fight(browser: Browser, baseUrl: string, sector: number, options: Options) { +async function fight(browser: Browser, baseUrl: string, sector: number, gun: GunPolicy, options: Options) { const context = await browser.newContext({ viewport: { width: 1280, height: 720 } }); const page = await context.newPage(); try { @@ -92,19 +119,27 @@ async function fight(browser: Browser, baseUrl: string, sector: number, options: const deadline = Date.now() + (options.limitSeconds + 30) * 1000; let report: BossFightReport | null = null; while (Date.now() < deadline) { - await page.waitForTimeout(1_000); - report = await page - .evaluate(() => window.__SPACE_EXPLORER_BROWSER_HARNESS__?.readBossFight() ?? null) - .catch(() => report); - const gameOver = await page - .evaluate(() => window.__SPACE_EXPLORER_BROWSER_HARNESS__?.snapshot().activeScenes.includes('GameOver')) - .catch(() => false); - if (!report || report.killed || gameOver || report.seconds > options.limitSeconds) break; + await page.waitForTimeout(POLICY_POLL_MS); + const state = await page + .evaluate(() => { + const harness = window.__SPACE_EXPLORER_BROWSER_HARNESS__!; + const snapshot = harness.snapshot(); + return { + report: harness.readBossFight(), + gun: snapshot.gun, + gameOver: snapshot.activeScenes.includes('GameOver'), + }; + }) + .catch(() => null); + if (state) report = state.report; + if (!state || !report || report.killed || state.gameOver || report.seconds > options.limitSeconds) break; + const bossHit = report.bossMaxHp > 0 && report.bossHp < report.bossMaxHp; + if (bossHit && state.gun && wantsSwap(gun, state.gun)) await page.keyboard.press('KeyQ'); } if (!report) throw new Error(`Sector ${sector}: no fight report`); const frames = await page.evaluate(() => window.__SPACE_EXPLORER_BROWSER_HARNESS__!.renderStats.read().frames); const fps = frames / ((Date.now() - startedAt) / 1000); - return { ...report, sector, fps } satisfies FightResult; + return { ...report, sector, gun, fps } satisfies FightResult; } finally { await context.close(); } @@ -121,7 +156,9 @@ async function main(): Promise { if (!address || typeof address === 'string') throw new Error('Dev server did not report a port'); const baseUrl = `http://127.0.0.1:${address.port}`; - const queue = [...options.sectors]; + const queue = options.sectors.flatMap((sector) => + options.guns.flatMap((gun) => Array.from({ length: options.runs }, () => ({ sector, gun }))) + ); const results: FightResult[] = []; // Without the GPU, headless Chromium renders the game at about 10 fps and the bot reacts too late. const browser = await chromium.launch({ @@ -130,9 +167,9 @@ async function main(): Promise { }); try { const workers = Array.from({ length: Math.max(1, options.parallel) }, async () => { - for (let sector = queue.shift(); sector !== undefined; sector = queue.shift()) { - const result = await fight(browser, baseUrl, sector, options); - console.error(`sector ${result.sector}: ${result.seconds.toFixed(1)} s`); + for (let next = queue.shift(); next !== undefined; next = queue.shift()) { + const result = await fight(browser, baseUrl, next.sector, next.gun, options); + console.error(`sector ${result.sector} ${result.gun}: ${result.seconds.toFixed(1)} s`); results.push(result); } }); @@ -142,11 +179,12 @@ async function main(): Promise { await server.close(); } - results.sort((a, b) => a.sector - b.sector); + results.sort((a, b) => a.sector - b.sector || GUN_POLICIES.indexOf(a.gun) - GUN_POLICIES.indexOf(b.gun)); console.log(`Boss fights${options.invulnerable ? ' (invulnerable bot)' : ''}`); console.table( results.map((result) => ({ sector: result.sector, + gun: result.gun, upgrades: representativeUpgrades(result.sector), 'kill s': result.killed ? Number(result.seconds.toFixed(1)) : `- (${Math.round(result.seconds)})`, 'boss hp': result.killed ? 0 : `${Math.round(result.bossHp)}/${result.bossMaxHp}`, @@ -154,6 +192,7 @@ async function main(): Promise { 'hull hits': result.hullHits, 'shield hits': result.shieldHits, deaths: result.deaths, + special: `${Math.round(specialShare(result) * 100)}%`, phases: result.phases.join(' '), 'peak shots': result.peakShots, hits: Object.entries(result.hitsBySource) @@ -162,7 +201,41 @@ async function main(): Promise { fps: Math.round(result.fps), })) ); + console.log('Per sector and gun policy (kill times of killed fights only)'); + console.table(summarize(results)); console.log(JSON.stringify(results)); } +function specialShare(result: FightResult): number { + return result.seconds > 0 ? result.specialGunSeconds / result.seconds : 0; +} + +/** Mean kill time against par, its run-to-run spread, deaths and time on a special gun. */ +function summarize(results: readonly FightResult[]) { + const groups = new Map(); + for (const result of results) { + const key = `${result.sector} ${result.gun}`; + groups.set(key, [...(groups.get(key) ?? []), result]); + } + return [...groups.values()].map((group) => { + const { sector, gun } = group[0]!; + const par = getLevelConfig(sector).boss!.parSeconds; + const kills = group.filter((result) => result.killed).map((result) => result.seconds); + const mean = kills.length > 0 ? kills.reduce((sum, seconds) => sum + seconds, 0) / kills.length : NaN; + const share = group.reduce((sum, result) => sum + specialShare(result), 0) / group.length; + return { + sector, + gun, + runs: group.length, + killed: kills.length, + 'mean kill s': Number(mean.toFixed(1)), + spread: kills.length > 0 ? `${Math.min(...kills).toFixed(1)}-${Math.max(...kills).toFixed(1)}` : '-', + par, + '% of par': Math.round((mean / par) * 100), + deaths: group.reduce((sum, result) => sum + result.deaths, 0), + special: `${Math.round(share * 100)}%`, + }; + }); +} + await main(); diff --git a/src/browserHarness/bossFightProbes.ts b/src/browserHarness/bossFightProbes.ts index 65979e4..e3286e7 100644 --- a/src/browserHarness/bossFightProbes.ts +++ b/src/browserHarness/bossFightProbes.ts @@ -3,6 +3,7 @@ import type { Boss } from '@/entities/enemies/Boss'; import { FLIGHT_CONFIG } from '@/config/flightConfig'; import { stepFlight } from '@/systems/flight/flightModel'; import type { Player } from '@/entities/Player'; +import type { MainGunId } from '@/config/shipSystems'; import type { EnemyPool } from '@/systems/EnemyPool'; import { GAME_SCENE_EVENTS } from '@/systems/GameSceneEvents'; import type { DamageSource, PlayerFatalResult, PlayerHitResult } from '@/systems/PlayerDamage'; @@ -23,6 +24,8 @@ export interface BossFightReport { peakShots: number; bossHp: number; bossMaxHp: number; + /** Gameplay seconds of the fight flown on a special gun (Scatter or Seekers). */ + specialGunSeconds: number; } interface BossFightScene extends Phaser.Scene { @@ -31,6 +34,7 @@ interface BossFightScene extends Phaser.Scene { levelManager: { distance: number; getLevelConfig(): { levelDistance: number; bossTriggerProgress: number } }; gameplayClock: { now: number; delta: number }; boss: Boss | null; + shipSystems: { getGun(): MainGunId | null }; inputManager: { cursors: Record<'left' | 'right' | 'up' | 'down', Phaser.Input.Keyboard.Key>; }; @@ -197,9 +201,12 @@ export function createBossFightProbes(game: Phaser.Game) { peakShots: 0, bossHp: 0, bossMaxHp: 0, + specialGunSeconds: 0, }; report = fight; let spawnedAt = 0; + // Hit-stop and pause freeze the gameplay clock, so time is counted from its advances. + let lastNow = scene.gameplayClock.now; const botMemory: BotMemory = { goalX: null, bossX: null }; if (options.invulnerable) scene.player.shields = 0; @@ -232,7 +239,13 @@ export function createBossFightProbes(game: Phaser.Game) { fight.bossMaxHp = boss.maxHp; } fight.peakShots = Math.max(fight.peakShots, scene.enemyPool.getEnemyBulletGroup().countActive(true)); - if (fight.spawned && !fight.killed) fight.seconds = (scene.gameplayClock.now - spawnedAt) / 1000; + const now = scene.gameplayClock.now; + if (fight.spawned && !fight.killed) { + fight.seconds = (now - spawnedAt) / 1000; + const gun = scene.shipSystems.getGun(); + if (gun === 'scatter' || gun === 'seekers') fight.specialGunSeconds += (now - lastNow) / 1000; + } + lastNow = now; if (options.bot) steerBot(scene, botMemory); }; const bindings: Array<[string, (...args: never[]) => void]> = [ diff --git a/src/config/levels/definitions/crownOfRings.ts b/src/config/levels/definitions/crownOfRings.ts index b97e07c..46e5b94 100644 --- a/src/config/levels/definitions/crownOfRings.ts +++ b/src/config/levels/definitions/crownOfRings.ts @@ -44,7 +44,7 @@ export const CROWN_OF_RINGS_LEVEL: LevelConfig = { hasBoss: true, boss: { name: 'Umbral Ark', - maxHp: 1320, + maxHp: 1170, parSeconds: 62, escalatesPastPar: true, phaseChangePauseMs: 300, diff --git a/src/config/levels/definitions/deepSpaceInferno.ts b/src/config/levels/definitions/deepSpaceInferno.ts index 0e69e9a..44b0ed2 100644 --- a/src/config/levels/definitions/deepSpaceInferno.ts +++ b/src/config/levels/definitions/deepSpaceInferno.ts @@ -33,7 +33,7 @@ export const DEEP_SPACE_INFERNO_LEVEL: LevelConfig = { hasBoss: true, boss: { name: 'Reef Stalker', - maxHp: 625, + maxHp: 550, parSeconds: 52, escalatesPastPar: true, phaseChangePauseMs: 280, diff --git a/src/config/levels/definitions/ghostlightVeil.ts b/src/config/levels/definitions/ghostlightVeil.ts index b705af8..674236b 100644 --- a/src/config/levels/definitions/ghostlightVeil.ts +++ b/src/config/levels/definitions/ghostlightVeil.ts @@ -46,7 +46,7 @@ export const GHOSTLIGHT_VEIL_LEVEL: LevelConfig = { hasBoss: true, boss: { name: 'Choir Regent', - maxHp: 1040, + maxHp: 830, parSeconds: 58, escalatesPastPar: true, phaseChangePauseMs: 260, diff --git a/src/config/levels/definitions/obsidianMaw.ts b/src/config/levels/definitions/obsidianMaw.ts index 42251fb..6d13e1e 100644 --- a/src/config/levels/definitions/obsidianMaw.ts +++ b/src/config/levels/definitions/obsidianMaw.ts @@ -54,7 +54,7 @@ export const OBSIDIAN_MAW_LEVEL: LevelConfig = { hasBoss: true, boss: { name: 'Hive Maelstrom', - maxHp: 1645, + maxHp: 1580, parSeconds: 65, escalatesPastPar: true, phaseChangePauseMs: 280, diff --git a/src/config/levels/definitions/terminusBlack.ts b/src/config/levels/definitions/terminusBlack.ts index 4e3672a..0b746eb 100644 --- a/src/config/levels/definitions/terminusBlack.ts +++ b/src/config/levels/definitions/terminusBlack.ts @@ -51,7 +51,7 @@ export const TERMINUS_BLACK_LEVEL: LevelConfig = { hasBoss: true, boss: { name: 'Omega Null', - maxHp: 1300, + maxHp: 1230, parSeconds: 70, escalatesPastPar: true, phaseChangePauseMs: 240, diff --git a/src/config/levels/definitions/warzoneCorridor.ts b/src/config/levels/definitions/warzoneCorridor.ts index 842f9d6..8af69a4 100644 --- a/src/config/levels/definitions/warzoneCorridor.ts +++ b/src/config/levels/definitions/warzoneCorridor.ts @@ -46,7 +46,7 @@ export const WARZONE_CORRIDOR_LEVEL: LevelConfig = { hasBoss: true, boss: { name: 'Marshal Vectra', - maxHp: 505, + maxHp: 440, parSeconds: 50, escalatesPastPar: true, phaseChangePauseMs: 280, diff --git a/src/config/levels/definitions/wreckfieldRun.ts b/src/config/levels/definitions/wreckfieldRun.ts index 5734ad2..b6a67ac 100644 --- a/src/config/levels/definitions/wreckfieldRun.ts +++ b/src/config/levels/definitions/wreckfieldRun.ts @@ -47,7 +47,7 @@ export const WRECKFIELD_RUN_LEVEL: LevelConfig = { hasBoss: true, boss: { name: 'Bastion Bulwark', - maxHp: 520, + maxHp: 460, parSeconds: 60, escalatesPastPar: true, phaseChangePauseMs: 300, diff --git a/src/config/shipSystems.ts b/src/config/shipSystems.ts index 1367ae6..20d0622 100644 --- a/src/config/shipSystems.ts +++ b/src/config/shipSystems.ts @@ -209,12 +209,19 @@ export function getNextMainGun(gun: MainGunId): MainGunId { * - `minToLeaveLance`: leaving Lance needs at least this much; below it the swap is refused. Moving * between the special guns, or back to Lance, is always allowed. * The meter starts full every sector and after every respawn or checkpoint load, and is never saved. + * + * Tuned so the special guns stay a short boost, not the gun you fly. With `bun run balance:bosses`, a bot + * that swaps whenever the meter is full spent 17-29% of each boss fight on a special gun (one window in + * the short sector 3-4 fights, two in the longer ones). Over the first 40 s of sectors 3-5 (autofire, + * sweeping ship, same swap rule) it spent 20-35% and scored about what the standard gun did; at 0.01 per + * kill the meter refilled fast enough for a second window and scores ran well above it. The first guess + * (10 s drain, 30 s refill, 0.02 per kill) gave 26-39% in boss fights. */ export const SPECIAL_GUN_CHARGE = { fromLevel: 3, - drainMs: 10_000, - refillMs: 30_000, - perKill: 0.02, + drainMs: 8_000, + refillMs: 40_000, + perKill: 0.005, minToLeaveLance: 0.2, } as const;