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

Aperta
#36 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
57/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
3
Fork
3
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/GH-Arcade

Tutte le issue di TMHSDigital/GH-Arcade

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.