poorvith-mp/skills-gamedev/game-performance
Claude Code and agent skill by poorvith-mp/skills-gamedev
- community
Checking that the SKILL.md file is still in the repository.
Hit frame budget: draw calls, batching, GC spikes, LOD strategy and in-engine profiling. Use when profiling frame times, draw calls, GPU bottlenecks, or memory.
Install
npx vskill@latest install poorvith-mp/skills-gamedev/game-performanceSKILL.md
game-performance
Core Philosophy
Game performance optimization is not randomly running Unity's profiler the night before release and guessing which scripts to tweak. Real-time rendering is an unyielding mathematical budget. At 60 frames per second, the entire game engine—CPU game logic, AI pathfinding, physics simulation, audio processing, GPU vertex transformation, rasterization, and post-processing—has strictly 16.66 milliseconds to finish. At 120 FPS, that budget shrinks to 8.33 milliseconds. Hitting frame budgets requires identifying bottlenecks, managing garbage collection allocations, and optimizing draw calls.
4-Step Real-Time Performance & Profiling Architecture
Step 1: The Frame Budget Breakdown (16.66ms @ 60 FPS)
- The Dual-Engine Budget (CPU vs GPU):
- CPU Budget (Target: $\le 10text{ms}$):
- Game Logic & Scripts: $\le 4text{ms}$
- Physics Simulation: $\le 3text{ms}$
- Render Thread / Draw Call Preparation: $\le 3text{ms}$
- GPU Budget (Target: $\le 14text{ms}$):
- Shadow Maps & Geometry Passes: $\le 4text{ms}$
- Shading & Lighting Passes: $\le 6text{ms}$
- Post-Processing & UI: $\le 4text{ms}$
- Diagnose the Bottleneck First:
- CPU-Bound: GPU utilization is $< 85\%$; frame time drops when adding AI entities or physics objects.
- GPU-Bound: GPU utilization is $99–100\%$; frame time drops when increasing screen resolution, shadow quality, or particle density.
Step 2: CPU Optimization & Garbage Collection (GC) Defense
- Zero-Allocation in the Hot Loop:
- In Unity / C#, executing
newinsideUpdate(),FixedUpdate(), orLateUpdate()allocates heap memory, triggering non-deterministic Garbage Collection spikes that cause visible micro-stutters. - Golden Rules:
- Cache component references in
Awake()orStart()(never callGetComponent()inUpdate). - Pre-allocate reusable collections (
List<T>, arrays); uselist.Clear()instead ofnew List<T>(). - Implement Object Pooling for all ephemeral entities (bullets, particles, sound effects, damage numbers).
Step 3: GPU Optimization: Draw Calls, Batching & Overdraw
- Draw Call Consolidation:
- Target: Maximum 500–1,000 draw calls per frame on mobile; 2,000–3,000 on PC/consoles.
- Techniques:
- Static Batching: Combine non-moving geometry sharing materials into single meshes.
- GPU Instancing: Render 1,000 identical meshes (trees, grass, projectiles) in a single draw call.
- Texture Atlasing: Combine multiple prop textures into a single 4K atlas to share a single material.
- Overdraw & Fill-Rate Defense:
- Transparent particles (smoke, fire, fog) stacked on top of each other force the GPU to shade the same screen pixel 10 times.
- Enable Occlusion Culling to prevent rendering objects hidden behind solid walls.
Step 4: Level of Detail (LOD) & Distance Culling
- The 3-Tier LOD Ramp:
- LOD 0 (0–15m): 100% mesh triangles (Hero detail).
- LOD 1 (15–40m): 40% mesh triangles (Simplified bevels, removed micro-props).
- LOD 2 (> 40m): 10% mesh triangles (Basic silhouette).
- Billboard / Impostor (> 100m): 2D flat quad facing camera.
Deliverable Format: Performance Budget & Profiling Report (PERFORMANCE-BUDGET.md)
Worked Example: Eliminating Garbage Collection Spikes in Unity
- Symptom: Game suffered a 60ms freeze every 8 seconds during heavy combat.
- Profiler Trace: Identified that spawning bullet impacts allocated 45KB of heap per frame, triggering Unity's garbage collector.
- Remediation: Implemented a generic pre-allocated
ObjectPool<T>storing 100 reusable bullet impacts. - Outcome: GC allocations dropped to 0 B per frame in combat; frame rate locked at a solid 60 FPS.
Verification Checklist
- [ ] Total frame time stays under 16.66ms (60 FPS) or 8.33ms (120 FPS) on target baseline hardware.
- [ ] Hot loop methods (
Update(),FixedUpdate()) generate strictly 0 B of GC allocation. - [ ] Total draw calls stay within platform limits (<= 1,000 mobile / <= 3,000 PC).
- [ ] Object pooling implemented for all high-frequency entities (projectiles, particles).
- [ ] Level of Detail (LOD) and Occlusion Culling configured and verified.
Anti-Patterns
- Optimizing in the Dark: Guessing what is slow without running a frame profiler (Unity Profiler, Unreal Insights, RenderDoc).
- `GetComponent()` in `Update()`: Calling expensive scene hierarchy searches 60 times per second per entity.
- Uncontrolled Alpha Blending: Spawning 1,000 giant transparent smoke particles covering the entire screen.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/game-performance/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/poorvith-mp/skills-gamedev/game-performance)