Expert knowledge of Godot performance optimization, profiling, bottleneck identification, and optimization techniques. Use when helping improve game performance or analyzing performance issues.
View on GitHubSelect agents to install to:
npx add-skill https://github.com/Zate/cc-godot/blob/main/plugins/gd/skills/godot-optimization/SKILL.md -a claude-code --skill godot-optimizationInstallation paths:
.claude/skills/godot-optimization/You are a Godot performance optimization expert with deep knowledge of profiling, bottleneck identification, and optimization techniques for both 2D and 3D games.
# Performance Profiling
## Built-in Godot Profiler
**Accessing the Profiler:**
- Debug → Profiler (while game is running)
- Tabs: Frame, Monitors, Network, Visual
**Key Metrics to Watch:**
- **FPS (Frames Per Second)**: Should be 60 for smooth gameplay (or 30 for mobile)
- **Frame Time**: Should be <16.67ms for 60 FPS
- **Physics Frame Time**: Physics processing time
- **Idle Time**: Non-physics processing time
## Performance Monitors
```gdscript
# Enable performance monitoring in code
func _ready():
# Available monitors
Performance.get_monitor(Performance.TIME_FPS)
Performance.get_monitor(Performance.TIME_PROCESS)
Performance.get_monitor(Performance.TIME_PHYSICS_PROCESS)
Performance.get_monitor(Performance.MEMORY_STATIC)
Performance.get_monitor(Performance.MEMORY_DYNAMIC)
Performance.get_monitor(Performance.OBJECT_COUNT)
Performance.get_monitor(Performance.OBJECT_NODE_COUNT)
Performance.get_monitor(Performance.RENDER_OBJECTS_IN_FRAME)
Performance.get_monitor(Performance.RENDER_VERTICES_IN_FRAME)
# Display FPS counter
func _process(_delta):
var fps = Performance.get_monitor(Performance.TIME_FPS)
$FPSLabel.text = "FPS: %d" % fps
```
# Common Performance Bottlenecks
## 1. Too Many _process() Calls
**Problem:**
```gdscript
# BAD: Running every frame when not needed
func _process(delta):
check_for_enemies() # Expensive operation
update_ui()
scan_environment()
```
**Solution:**
```gdscript
# GOOD: Use timers or reduce frequency
var check_timer: float = 0.0
const CHECK_INTERVAL: float = 0.5 # Check twice per second
func _process(delta):
check_timer += delta
if check_timer >= CHECK_INTERVAL:
check_timer = 0.0
check_for_enemies()
# Or disable processing when not needed
func _ready():
set_process(false) # Enable