All skills
thedivergentai avatar

/godot-performance-optimization

@9d6e91e

Expert blueprint for performance profiling and optimization (frame drops, memory leaks, draw calls) using Godot Profiler, object pooling, visibility culling, and bottleneck identification. Use when diagnosing lag, optimizing for target FPS, or reducing memory usage. Keywords profiling, Godot Profiler, bottleneck, object pooling, VisibleOnScreenNotifier, draw calls, MultiMesh.

Use this Skill: https://skilld.dev/gh/thedivergentai/gd-agentic-skills/godot-performance-optimization

This session only. Nothing lands on disk.

referencesprofiler-budgets-and-prewarm.md

≈449 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Profiler budgets and pre-warm

AStar/path time-slicing, shader pre-warm, VRAM compression tables. Prefer navigation_agent_optimization.gd and object_pool_system.gd in hot paths.

Common Optimizations

Object Pooling

var bullet_pool: Array[Node] = []

func get_bullet() -> Node:
    if bullet_pool.is_empty():
        return Bullet.new()
    return bullet_pool.pop_back()

func return_bullet(bullet: Node) -> void:
    bullet.hide()
    bullet_pool.append(bullet)

Visibility Notifier


### AStar-Throttler (Pathfinding Budget)
Spreading pathfinding costs over multiple frames to prevent frame-time spikes.
- **Implementation**:
    ```gdscript
    var _query_queue: Array[Callable] = []
    const TIME_BUDGET_USEC := 1000 # 1ms budget

    func _process(_delta):
        var start_time := Time.get_ticks_usec()
        while not _query_queue.is_empty() and (Time.get_ticks_usec() - start_time) < TIME_BUDGET_USEC:
            var query = _query_queue.pop_front()
            query.call()
    ```

### Shader-Preloading (Zero-Hitch Strategy)
- **Forward+ / Mobile**: Godot 4.4+ uses **Ubershaders** for automatic precompilation. Ensure scenes are instantiated at least once (even if invisible) at load-time to trigger pipeline detection [19].
- **Compatibility (OpenGL)**: Place a hidden `Camera3D` looking at a small area containing every unique mesh and material in your project for 1 frame during the loading screen [20].

### VRAM Compression Guide
- **S3TC (Desktop)**: Best for high-quality textures on Windows/Linux/macOS.
- **BPTC (Desktop)**: Superior quality for HDR and normal maps; slightly higher VRAM usage.
- **ETC2 (Mobile)**: The standard for Android/iOS; ensure textures are opaque where possible for maximum compatibility [13].

Source: SKILL.md on GitHub

1 warning16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill provides a collection of standard Godot GDScript templates and documentation for performance optimization. No malicious patterns, data exfiltration, or prompt injection attempts were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    3/3 files flagged

Signed by skilld at 9d6e91e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 2 months ago

README badge

README badge for thedivergentai/gd-agentic-skills/godot-performance-optimization