Neon Runner: storage write and new Text per coin, HUD redrawn each frame

Offen
#36 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
57/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv

Rechercherichtung

Start with games/runner/scenes/GameScene.ts at lines 361–376 and 533–539, then read shared/achievements.ts around addCounter and shared/ui.ts around floatText. Run npm run typecheck and npm run build after tracing coin collection and distance HUD updates. Done means active play causes no storage writes while counters still persist if the tab closes mid-run.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

performance severity: low

Summary

Collecting a coin serialises and writes the whole trophy save and creates a new floating Text. The distance HUD text changes 32 to 77 times per second, so its canvas is redrawn and re-uploaded on almost every frame.

Where

  • games/runner/scenes/GameScene.ts:361-376, games/runner/scenes/GameScene.ts:533-539
  • shared/achievements.ts:122-128 (addCounter persists on every call)
  • shared/ui.ts:70-73 (floatText)

Impact

A six-coin row at top speed is six Text creations and six synchronous storage writes in under a quarter of a second, likely visible as hitches on phones. Astro has the same per-event write at a lower rate. Not measured.

Suggested fix

Keep counters in memory and persist on game over and on visibilitychange (or debounce persist()), pool a few float-text objects or show one "+N" per row, and update the distance text every 100ms or every 5m.

Acceptance criteria

  • No storage write happens during active play
  • Counters still persist if the tab is closed mid-run

Getting started

  • Relevant files: games/runner/scenes/GameScene.ts, shared/achievements.ts, shared/ui.ts
  • Run locally: npm install, then npm run dev
  • Checks: npm run typecheck and npm run build (there is no test suite yet)
  • Related docs: README.md

Filed by repo-audit/full-audit at b001f5d. Severity: low. Effort: S. audit-key: performance|games/runner/scenes/GameScene.ts|collectCoins

Vorherrschende Sprache
TypeScript
Sterne
3
Forks
3
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/GH-Arcade

Alle Issues in TMHSDigital/GH-Arcade

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.