Runner sun, Snake bonus star and Stack previews allocate every frame
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 72/100
- Issue 类型
- 重构
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- game-dev, performance
调研方向
Read the render paths in games/runner/scenes/GameScene.ts and games/snake/scenes/GameScene.ts, then inspect drawMini in games/stack/scenes/GameScene.ts. Compare the per-frame allocations with the suggested caching or reuse approaches in the issue. Run npm test and use npm run dev to check the three screens; done means all three paths avoid per-frame allocations while their visuals stay unchanged.
由索引模型根据 Issue 内容生成。
描述
Summary
Three render paths allocate new objects on every frame for values that do not change from frame to frame. Each one is small, but together they add steady garbage on phones.
Where
games/runner/scenes/GameScene.ts(render, the synthwave sun): each frame builds twoPhaser.Display.Colorobjects withValueToColorand interpolates a third for each of the 12 sun bands, although the band colors never change.games/snake/scenes/GameScene.ts(starPoints, called fromrenderwhile a bonus star is up): a new array of 10Phaser.Math.Vector2each frame.games/stack/scenes/GameScene.ts(drawMini): for the hold piece and every next-piece preview, each frame builds a cell array and four mapped arrays forMath.min/Math.max, although a piece type's preview layout never changes.
Details
Runner's sun, for example:
const c = Phaser.Display.Color.Interpolate.ColorWithColor(
Phaser.Display.Color.ValueToColor(NEON.yellow),
Phaser.Display.Color.ValueToColor(NEON.pink),
11,
i,
);
Impact
Low. This is extra minor-GC pressure for as long as each screen is up. It is the same class of cost as the items in #107.
Suggested fix
- Runner: compute the 12 band colors once into a module constant.
- Snake: reuse one points array and set its entries in place, or bake the star once (the rotation could then be the Image's rotation).
- Stack: cache each piece type's preview cells and offsets in a
Mapthe first time it is drawn.
Acceptance criteria
- None of the three paths allocates per frame.
- Visuals are unchanged.
Getting started
- Relevant files: the three scenes above
- How to run tests:
npm test; run a game withnpm run dev
Related: #107
Filed by repo-audit/fix-issues at b2a3ff6. Severity: low. Effort: S. audit-key: performance|games/runner/scenes/GameScene.ts|sun-colors
- 主要语言
- TypeScript
- 星标
- 3
- 派生
- 3
- 平均合并
- 10 小时 22 分钟
- 30 天内合并 PR
- 6
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TMHSDigital/GH-Arcade 的其他 Issue
-
enhancement help wanted severity: low
难度 4/5 3-5 天 新手友好度 55/100
TMHSDigital/GH-Arcade#139 ·
维护者通常 1 天内回复
-
enhancement help wanted severity: medium
难度 4/5 3-5 天 新手友好度 56/100
TMHSDigital/GH-Arcade#127 ·
维护者通常 1 天内回复
-
enhancement help wanted severity: medium
难度 4/5 3-5 天 新手友好度 48/100
TMHSDigital/GH-Arcade#126 · 1 条评论 ·
维护者通常 1 天内回复
-
accessibility enhancement severity: low
难度 4/5 3-5 天 新手友好度 40/100
TMHSDigital/GH-Arcade#114 ·
维护者通常 1 天内回复
-
enhancement severity: low
难度 4/5 3-5 天 新手友好度 35/100
TMHSDigital/GH-Arcade#113 ·
维护者通常 1 天内回复
查看 TMHSDigital/GH-Arcade 的全部 Issue
相似的 Issue
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)未关闭
难度 2/5 1-3 小时 新手友好度 62/100
microsoft/playwright#44289 ·
维护者通常 1 天内回复
-
good first issue
难度 2/5 半天 新手友好度 65/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
blamechris/chroxy#9272 ·
维护者通常 1 天内回复
-
no-repo-link tool-submission
难度 1/5 1 小时以内 新手友好度 66/100
BraveOPotato/NoSignups#2458 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
drmrd/vernacular#1061 ·
维护者通常 1 天内回复