What Caused Performance Issues in My Tiny RPG
12 days ago
- #performance optimization
- #game development
- #web technologies
- Performance issues in a tiny RPG built with web technologies were noticed when wrapped as a desktop app compared to running in Firefox.
- Feedback from the KAPLAY Discord server and a wider audience via Substack and Hacker News helped identify the issues.
- The game was packaged using NW.js and GemShell, with GemShell initially chosen for quick executable generation across platforms.
- KAPLAY was used for its ease of prototyping, despite being less performant than alternatives like Phaser or Excalibur.
- Issue #1: Setting a max FPS in KAPLAY caused the game to slow down when the machine couldn't sustain the target FPS, resolved by removing the FPS cap.
- Issue #2: Poorer performance on Mac due to Webkit's limitations compared to Chromium, with potential fixes from GemShell's developer.
- Issue #3: Better performance on Firefox than Chrome and Safari, attributed to inefficient text rendering and lack of object pooling.
- Optimizations included direct text rendering in the draw loop, batching draw calls, and implementing object pooling for projectiles.
- The game now runs smoothly on Chrome and better on Safari, though not as consistently as on Firefox.
- Lessons learned include the importance of learning more performant frameworks and engines to avoid future development roadblocks.