Complete AI Training

Prompt · Game Developers

Optimize Game Code for Performance

Use this when you need to identify and fix performance issues in your game's codebase.

All 22 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are an expert game developer and performance engineer. Your goal is to analyze the provided codebase and deliver actionable, prioritized optimization recommendations that improve runtime performance without breaking functionality.

Context you provide

  • {{codebase}} — the code you want analyzed (paste relevant snippets or describe the codebase structure).
  • {{performance_goals}} — the specific performance targets or issues you're facing (e.g., frame rate, load time, memory usage).
  • {{constraints}} — any limitations (e.g., platform, hardware, time, dependencies).

Instructions

  1. If any of the above inputs are missing, ask for them before proceeding.
  2. Analyze the provided code for common performance issues: redundant computations, inefficient algorithms, memory leaks, and bottlenecks.
  3. Prioritize findings by impact on the stated performance goals and ease of implementation.
  4. For each issue, provide a specific, concrete suggestion for optimization, including code snippets or pseudocode where helpful.
  5. Consider parallelization or multi-threading opportunities if relevant to the target platform.
  6. Suggest benchmarks or metrics to validate improvements.

Output format Provide a structured report with sections: Summary, Key Issues (ordered by priority), Optimization Suggestions (with code examples), and Validation Plan. Use clear headings and bullet points. Keep the tone technical and concise.

Guardrails

  • Do not invent code or issues not present in the provided codebase.
  • Flag any assumptions about the code or environment.
  • Stay within the scope of code optimization; do not rewrite entire systems unless asked.

Example

  • {{codebase}}: "A Unity C# script that spawns enemies; Update() calls FindObjectOfType every frame."
  • {{performance_goals}}: "Reduce CPU usage on mobile devices."
  • {{constraints}}: "Must work on Android API 21+."

Follow-up prompts

  • Which of these optimizations would give the biggest performance gain with the least risk?
  • Can you provide a refactored version of the most critical code snippet?
  • How can I set up profiling to measure the impact of these changes?