Stack, Snake and Hop re-tessellate rounded rectangles every frame
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Refactorización
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- game-dev, performance
Línea de trabajo
Start by reading the drawing code in games/stack/scenes/GameScene.ts, games/snake/scenes/GameScene.ts, and games/hop/scenes/GameScene.ts, then compare it with the sparkTexture example in shared/ui.ts. Run npm run dev and use a Performance trace to check how frame time changes as the Stack board fills or the Snake grows. The issue is done when drawing cost no longer measurably grows with board fill or snake length and the visuals remain unchanged; run npm run typecheck and npm run build.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Three games clear a Graphics object and redraw every cell or segment with fillRoundedRect each frame. Phaser's WebGL Graphics renderer tessellates each arc with a fixed step and does not cache geometry, so cost grows with board fill and snake length.
Where
games/stack/scenes/GameScene.ts:458-497,games/stack/scenes/GameScene.ts:500-512(three rounded rects per cell)games/snake/scenes/GameScene.ts:437-452,games/snake/scenes/GameScene.ts:404-412(two per segment plus three colour objects)games/hop/scenes/GameScene.ts:396-435
Details
Estimated from the Phaser 3.90 source, not measured in a browser:
- A rounded rect is about 400 points and 400 triangles.
- Stack with about 100 visible cells: about 300 paths and 120,000 point allocations per frame.
- Snake at length 50: about 40,000 allocations and triangles per frame.
Impact
Likely GC pauses and dropped frames on phones and low-end laptops, worst when the Stack board is full or the snake is long, which is when timing matters most.
Steps to reproduce
- Play Stack until the board is half full, or Snake to length 50.
- Record a Performance trace and compare scripting time and minor GC frequency with the start of the run.
Suggested fix
Pre-render one white cell texture with generateTexture (as sparkTexture in shared/ui.ts already does) and draw cells as pooled tinted Images, or stamp into a RenderTexture updated only when the board changes. Cache Snake's gradient colours per length. A cheaper stopgap is fillRect for the glow and highlight layers.
Acceptance criteria
- Frame time in Stack and Snake does not grow measurably with board fill or snake length
- Visuals are unchanged
Getting started
- Relevant files:
games/stack/scenes/GameScene.ts,games/snake/scenes/GameScene.ts,games/hop/scenes/GameScene.ts,shared/ui.ts - Run locally:
npm install, thennpm run dev - Checks:
npm run typecheckandnpm run build(there is no test suite yet) - Related docs:
README.md
Filed by repo-audit/full-audit at b001f5d. Severity: medium. Effort: M. audit-key: performance|games/stack/scenes/GameScene.ts|drawCell
- Lenguaje dominante
- TypeScript
- Estrellas
- 3
- Forks
- 3
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TMHSDigital/GH-Arcade
-
enhancement good first issue severity: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
TMHSDigital/GH-Arcade#50 ·
-
enhancement good first issue severity: medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
TMHSDigital/GH-Arcade#47 ·
-
documentation good first issue severity: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
TMHSDigital/GH-Arcade#34 ·
-
documentation good first issue severity: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
TMHSDigital/GH-Arcade#33 ·
-
dependencies good first issue severity: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
TMHSDigital/GH-Arcade#27 ·
Todos los issues de TMHSDigital/GH-Arcade
Issues similares
-
automated-triage type/bug type/ci
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
📦 expo-router Android contributor: external needs review sdk-58 severity: medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
expo/expo#53436 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Translate the READMEAbiertodocumentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
asasemahmed/openboard#68 ·
Los mantenedores suelen responder en 1 día
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Document PowerShell shell semantics and read-only Bash deduplication in Built-in Tools referenceAbiertodocumentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100