Compare commits

...

2 Commits

Author SHA1 Message Date
Brian Fertig d41183c1fa Remove cyberpunk overlay from game scene
The CRT/glitch dressing (scanlines, vignette, glitch burst) was visually distracting during gameplay. Strip the CyberOverlay import, creation, update, and destroy calls from GameScene and drop the now-unused `theme.gameScene` config block.
2026-09-03 18:47:54 -06:00
Brian Fertig 3f2779e790 Fix CyberOverlay sweep and glitch bar x-offsets to use screen-space coor
The overlay was drawing the sweep image and glitch burst bars at negative-x offsets (e.g. `-w/2`) as if in a centered coordinate system, but Phaser graphics/images live in scene space starting at 0. This shifted the sweep left by half the viewport and clipped the glitch bars off-screen. Anchor them to `0` / `w/2` so they align with the visible area.
2026-09-03 18:43:10 -06:00
3 changed files with 4 additions and 47 deletions

View File

@ -32,11 +32,5 @@
"duration": [110, 340],
"slices": [2, 6],
"maxOffset": 12
},
"gameScene": {
"overlay": true,
"scanlineAlpha": 0.1,
"vignetteAlpha": 0.45,
"burstOnEntry": true
}
}

View File

@ -8,7 +8,6 @@ import { formatSystemReport } from '../galaxy/SystemReport.js';
import { Ship } from '../entities/Ship.js';
import { Planet } from '../entities/Planet.js';
import { Starfield } from '../visuals/Starfield.js';
import { CyberOverlay } from '../visuals/CyberOverlay.js';
const FONT_FALLBACK = "'Segoe UI', 'Helvetica Neue', Arial, sans-serif";
const HEADER_FONT = () => fontStack('header', FONT_FALLBACK);
@ -43,14 +42,6 @@ export class GameScene extends Phaser.Scene {
this.cameraFollowShip = config.get('game.camera.followShip', true);
this.cameraFollowRate = config.get('game.camera.followRate', 3.0); // 1/s
// The shared cyberpunk dressing (scanlines, vignette, occasional
// glitch burst) — the same overlay the menu uses, dialed down.
this.overlay = this.createThemeOverlay();
if (this.overlay && config.get('theme.gameScene.burstOnEntry', true)) {
// One arrival glitch when we cut in from the menu.
this.time.delayedCall(350, () => this.overlay?.trigger(320, 0.8));
}
// We are, after all, in a system. Show the player which one. (This
// also establishes the galaxy — and its seed — for what follows.)
this.createSystemHud();
@ -162,39 +153,12 @@ export class GameScene extends Phaser.Scene {
line(`seed ${this.galaxy.seed}`, { fontFamily: fam, fontSize: '11px', color: '#3d476b' });
}
/**
* The shared CRT/glitch overlay for this scene (data/theme.json
* gameScene + overlay/glitch). Dialed down vs. the menu: fainter
* scanlines, lighter vignette dressing, not the star of the show.
*/
createThemeOverlay() {
const theme = config.section('theme', {});
const gs = config.section('theme.gameScene', {});
if (gs.overlay === false) return null;
const overlay = theme.overlay ?? {};
return new CyberOverlay(this, {
scanline: {
pitch: overlay.scanline?.pitch ?? 3,
alpha: gs.scanlineAlpha ?? overlay.scanline?.alpha ?? 0.1,
},
grid: overlay.grid
? { cell: overlay.grid.cell ?? 48, alpha: (overlay.grid.alpha ?? 0.05) * 0.6 }
: undefined,
vignette: overlay.vignette
? { alpha: gs.vignetteAlpha ?? overlay.vignette.alpha ?? 0.4 }
: undefined,
sweep: overlay.sweep,
glitch: theme.glitch,
});
}
update(_time, delta) {
// Phaser v4 (Giedi): the engine does not step the scene's TimeClock or
// TweenManager — drive them here or delayedCall/addEvent/tweens never
// fire. (Same quirk as MenuScene.update; verified Sept 2026.)
this.time.update(_time, delta);
this.tweens.update();
this.overlay?.update(_time, delta);
this.ship.update(_time, delta);
// The home world is solid: the ship may come within the clearance in
// data/planets.json of its rim, but never closer (or through it).
@ -253,6 +217,5 @@ export class GameScene extends Phaser.Scene {
shutdown() {
this.starfield?.destroy();
this.overlay?.destroy();
}
}

View File

@ -110,7 +110,7 @@ export class CyberOverlay {
const band = Math.max(20, Math.round(this.cfg.sweep.band));
this.sweepBand = band;
this.sweep = scene
.add.image(0, 0, T.sweep)
.add.image(w / 2, 0, T.sweep)
.setOrigin(0.5)
.setScrollFactor(0)
.setDepth(d + 2)
@ -223,14 +223,14 @@ export class CyberOverlay {
const color = palette[(Math.random() * palette.length) | 0];
const alpha = 0.06 + Math.random() * 0.18;
bars.fillStyle(color, alpha);
bars.fillRect(-w / 2 + dx - 24, y, w + 48, barH);
bars.fillRect(dx - 24, y, w + 48, barH);
}
// One wider "displacement band" so the burst reads at a glance.
const bandY = Math.random() * h;
bars.fillStyle(0x04060d, 0.55);
bars.fillRect(-w / 2 - 24, bandY, w + 48, 14 + Math.random() * 22);
bars.fillRect(-24, bandY, w + 48, 14 + Math.random() * 22);
bars.fillStyle(0x00e5ff, 0.22);
bars.fillRect(-w / 2 - 24, bandY - 2, w + 48, 2);
bars.fillRect(-24, bandY - 2, w + 48, 2);
const die = (this.lastTime ?? this.scene.time.now) + this.burstDur + 60;
this.slices.push({ g: bars, die });