Skip to content

Flashlight/darkness render path drops FPS until battery dies #2

Description

@jeffdarcy

Observed during public GitHub Pages testing on a PC: frame rate was around 30 FPS while the game was running with the flashlight active, then jumped to about 120 FPS when the flashlight died.

Likely cause:

  • The flashlight battery reaching zero disables the expensive lighting path: DarknessSystem.stampLight() returns early, renderBeamFx() returns early, and the active reveal/beam work decays.
  • While the light is active, each frame pushes multiple reveal stamps, caps/maintains up to 96 stamps, redraws soft erase circles with 14 rings each, erases them from a screen-sized render texture, and draws beam haze/vignette graphics.
  • On a 1080p / high-refresh monitor this can become fill-rate and render-texture heavy, so the observed jump to 120 FPS after battery death is a strong signal that the flashlight/darkness pass is the bottleneck.

Files to inspect:

  • src/systems/DarknessSystem.ts
  • src/systems/FlashlightSystem.ts
  • data/performance_budget.json

Acceptance target:

  • Instrument real FPS in dev/public QA builds.
  • Keep flashlight-on gameplay near the desktop target instead of ~30 FPS on a 1080p PC.
  • The FPS delta between flashlight active and battery-dead states should be small enough that the flashlight state is not the dominant performance cliff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions