Logo de Godot Optimization

Godot Optimization

Comunidade
jame581
godot-optimization

Use when optimizing Godot games — profiler, draw calls, physics tuning, memory management, and common bottlenecks

Visão geral

Publicado porjame581
RepositórioGodotPrompter
Nome da habilidadegodot-optimization
Estrelas
808
Forks
47
Arquivos incluídos
4
LicençaMIT
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Arquivos incluídos: 4

    Scripts, templates e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente para leitura e nunca são executados.

  • Código aberto

    Publicada por jame581 no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Godot Optimization no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/jame581/GodotPrompter/tree/master/skills/godot-optimization
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jame581/GodotPrompter.git /tmp/GodotPrompter
mkdir -p .claude/skills
cp -r /tmp/GodotPrompter/skills/godot-optimization .claude/skills/godot-optimization
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Godot Optimization em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Godot Optimization automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Godot Optimization não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

Godot Optimization

This skill covers performance optimization for Godot 4.3+ projects in both GDScript and C#. It covers the built-in profiler, draw call reduction, physics tuning, GDScript performance patterns, memory management, object pooling, and a reference table of common bottlenecks.

Related skills: godot-debugging for systematic debugging and profiling, godot-code-review for performance review checklist, export-pipeline for release build optimization, physics-system for collision shapes, layers, and physics body types, 2d-essentials for 2D mesh optimization, particle performance, and draw order tuning, multithreading for moving work off the main thread, mobile-development for mobile performance budgets.


1. Using the Profiler

Frame Time Budget

At 60 fps, the entire frame (update, physics, rendering) must complete in 16.6 ms. At 30 fps the budget is 33.3 ms. Any single system that consumes the majority of that budget is a bottleneck.

Target FPSFrame budget
1208.3 ms
6016.6 ms
3033.3 ms

Reading Profiler Output

Open Debugger > Profiler, click Start, play through the scenario you want to measure, then click Stop.

  • Frame Time — total wall-clock time for that frame in milliseconds.
  • Self — time spent inside that function excluding callees. This is the primary hotspot indicator. A function with a high Self time is doing expensive work directly.
  • Total — time including all callees. Useful for identifying expensive subtrees.
  • Calls — call count per frame. A function called thousands of times per frame (even if each call is cheap) can dominate the frame.
  • Click any function name to jump to its source in the script editor.
gdscript
# Manual micro-benchmark for a specific block
var start := Time.get_ticks_usec()
_run_expensive_operation()
var elapsed := Time.get_ticks_usec() - start
print("_run_expensive_operation: %d µs" % elapsed)

C#:

csharp
// Manual micro-benchmark using Stopwatch (high-resolution timer)
using System.Diagnostics;

var sw = Stopwatch.StartNew();
RunExpensiveOperation();
sw.Stop();
GD.Print($"RunExpensiveOperation: {sw.Elapsed.TotalMilliseconds:F3} ms");

// Alternative using Godot's built-in timer (microsecond precision)
long start = (long)Time.GetTicksUsec();
RunExpensiveOperation();
long elapsed = (long)Time.GetTicksUsec() - start;
GD.Print($"RunExpensiveOperation: {elapsed} µs");

Monitors Tab

Debugger > Monitors shows real-time engine metrics while the game is running. Click a monitor name to open a live graph. Key monitors to watch:

MonitorWhat to watch for
Time > FPSBelow target — frame budget overrun
Time > ProcessHigh — _process() callbacks are expensive
Time > Physics ProcessHigh — _physics_process() or physics sim is expensive
Render > Total Draw CallsAbove ~500 (mobile) or ~2 000 (desktop) — needs batching
Render > Video RAMSteadily growing — unfreed textures or meshes (memory leak)
Object > Object CountGrowing across scene reloads — nodes are not being freed
Physics 3D > Active BodiesLarge count in simple scenes — bodies not sleeping
gdscript
# Query any monitor at runtime from code
var fps := Performance.get_monitor(Performance.TIME_FPS)
var draw_calls := Performance.get_monitor(Performance.RENDER_TOTAL_DRAW_CALLS_IN_FRAME)
var video_ram := Performance.get_monitor(Performance.RENDER_VIDEO_MEM_USED)
print("FPS: %d | Draw calls: %d | VRAM: %.1f MB" % [fps, draw_calls, video_ram / 1_048_576.0])

C#:

csharp
// Query any monitor at runtime from code
double fps = Performance.GetMonitor(Performance.Monitor.TimeFps);
double drawCalls = Performance.GetMonitor(Performance.Monitor.RenderTotalDrawCallsInFrame);
double videoRam = Performance.GetMonitor(Performance.Monitor.RenderVideoMemUsed);
GD.Print($"FPS: {fps:F0} | Draw calls: {drawCalls:F0} | VRAM: {videoRam / 1_048_576.0:F1} MB");

2. Draw Call Optimization

Every distinct mesh, sprite, or canvas item that cannot be batched with its neighbours costs one draw call. Reducing draw calls is one of the highest-leverage optimisations, especially on mobile — wrap 2D groups sharing a texture in CanvasGroup, keep unique-material count low, atlas sprites, and cull off-screen work.

See references/draw-calls.md for the full recipes (CanvasGroup batching constraints, shared shader-parameter materials, texture atlases, VisibleOnScreenNotifier2D/3D culling, and 3D LOD swapping).


3. Physics Optimization

Physics tuning hinges on minimising broadphase work and avoiding mesh colliders on moving bodies. Trim collision masks to only the layers each body actually needs, replace ConcavePolygonShape3D with primitives on anything that moves, and prefer Area2D/3D over per-frame raycasts for overlap detection.

See references/physics-tuning.md for the full recipes (layer/mask bit examples, collision-shape cost table, Engine.physics_ticks_per_second tuning, Area-vs-raycast patterns).


4. GDScript Performance

Hot-path GDScript wins come from eliminating per-frame allocations, comparing StringName instead of String, using typed arrays / PackedArrays, and preload-ing resources at class scope. The same allocation discipline applies to C# (with List<T> in place of typed Array[T] and static readonly StringName fields).

See references/cpu-bottlenecks.md for the full recipes (cached group queries, reused vector locals, &"..." literals, PackedVector2Array, static typing, preload vs load, plus C# parity blocks).


5. Memory Management

Watch Performance.MEMORY_STATIC and OBJECT_COUNT across scene reloads — steady growth means leaked references. Resources loaded by path are cached and shared; call .duplicate() when you need per-instance mutation. Always prefer queue_free() for nodes; free() inside a self-emitted signal will crash.

See references/memory-management.md for the full recipes (Performance singleton queries, ResourceLoader cache semantics, queue_free vs free table, plus the full GDScript and C# object pool implementations for bullets/effects/particles).


6. Common Bottlenecks

ProblemDiagnosis toolFix
Too many draw callsDebugger > Monitors Render > Total Draw Calls; Viewport > Debug > Draw Calls overlayUse CanvasGroup for 2D batching; merge meshes for 3D; use texture atlases; reduce unique materials
Heavy GDScript in _processProfiler > Self column shows script functions at topMove logic to _physics_process (runs less often), cache queries, avoid per-frame allocations, consider C# for tight loops
Excessive signal connectionsProfiler shows signal dispatch overhead; manually audit get_signal_connection_list()Remove redundant connections; prefer polling over per-frame signals for high-frequency data; use CONNECT_ONE_SHOT for fire-and-forget
Unoptimised TileMapProfiler shows TileMap._process or high draw call countSplit into fewer layers; use a single atlas texture per layer; disable use_parent_material if not needed; use TileMapLayer (Godot 4.3+) instead of legacy TileMap
Large uncompressed texturesMonitors Render > Video RAM is high; check Import dock for texture settingsEnable texture compression (VRAM Compressed) in the Import dock; use mipmaps; halve resolution of assets not viewed up-close
Too many active physics bodiesMonitors Physics 3D > Active Bodies is high; slow _physics_process in ProfilerEnable sleeping on RigidBody3D (can_sleep = true); lower physics tick rate; replace distant bodies with fake animations; use layers/masks to narrow collision checks
String operations in hot pathsProfiler shows String allocation functions; high GC pressureReplace String comparisons with StringName (&"..."); avoid String formatting in _process; build strings once and cache
instantiate() in hot pathsProfiler shows PackedScene.instantiate with high Self timeImplement object pooling (see references/memory-management.md); preload scenes at startup; spawn during loading screens rather than during gameplay

7. Top Anti-Patterns

  • Allocating in _process — new Arrays, Dictionaries, Strings, or Vector constructors per frame. Cache the container, mutate fields in place. See references/cpu-bottlenecks.md.
  • Mesh colliders on moving bodies — ConcavePolygonShape3D on a CharacterBody3D or RigidBody3D. Use a capsule, box, or convex hull instead. See references/physics-tuning.md.
  • Unique materials per instance — material_override = SomeMaterial.new() in _ready() breaks batching. Share one material; vary via shader parameters. See references/draw-calls.md.
  • load() in hot paths — calling load("res://...") from _process or _physics_process. Use const X := preload(...) at class scope. See references/cpu-bottlenecks.md.
  • instantiate() + queue_free() for short-lived objects — bullets, hit effects, particles. Pool them. See references/memory-management.md.

8. Checklist

Work through this list before shipping or when investigating a performance complaint.

Profiler

  • Run the Profiler during the most demanding gameplay scenario.
  • Confirm no single function's Self time exceeds 30% of the frame budget.
  • Confirm total frame time stays under budget (16.6 ms at 60 fps).

Draw Calls

  • Draw call count is within target (≤500 mobile, ≤2 000 desktop).
  • 2D sprite groups that share a texture are wrapped in CanvasGroup.
  • Textures are atlas-packed where possible; duplicate materials are eliminated.
  • Off-screen nodes use VisibleOnScreenNotifier2D/3D to pause processing.
  • 3D meshes have LOD enabled via import settings or manual swap logic.

Physics

  • Collision layers and masks are minimal — no body checks layers it never needs.
  • No moving body uses ConcavePolygonShape — replaced with capsule, box, or convex.
  • Physics tick rate is appropriate for the game type (30 Hz may be fine for turn-based or top-down).
  • Area2D/3D is used for overlap detection instead of per-frame raycasts.
  • RigidBody3D nodes have can_sleep = true where applicable.

GDScript

  • No Array, Dictionary, or String is allocated inside _process or _physics_process.
  • All hot-path string comparisons use StringName (&"...").
  • All arrays in hot paths are typed (Array[T] or PackedArray).
  • All function parameters and return types in hot paths are statically typed.
  • All scene and resource references use preload at class scope, not load per frame.

Memory

  • Performance.get_monitor(Performance.MEMORY_STATIC) is stable between scene reloads.
  • Resources that require per-instance mutation are .duplicate()d.
  • All node removals use queue_free() unless synchronous teardown is explicitly required.

Object Pooling

  • Bullets, hit effects, particles, and other frequently spawned objects use a pool.
  • Pool initial size is large enough to avoid runtime growth during normal gameplay.
  • Pooled objects reset all state on reactivation (position, velocity, signals).

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA Godot Optimization faz?

Use when optimizing Godot games — profiler, draw calls, physics tuning, memory management, and common bottlenecks

Por que usar Godot Optimization no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Godot Optimization é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Godot Optimization no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/jame581/GodotPrompter/tree/master/skills/godot-optimization. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Godot Optimization?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Godot Optimization?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Godot Optimization com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Godot Optimization é gratuita?

Sim. A habilidade é publicada no GitHub por jame581 sob a licença MIT. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇