跳到正文
cccskills
免费在 GitHub 公开

godot-performance-optimization

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.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(15)

  • SKILL.md11.9 KB
  • references/migration-notes.md4.9 KB
  • references/profiler-budgets-and-prewarm.md1.8 KB
  • scripts/custom_monitor_profiler.gd1.4 KB
  • scripts/custom_performance_monitor.gd2.3 KB
  • scripts/low_level_physics_query.gd1.6 KB
  • scripts/manual_culling_logic.gd1.4 KB
  • scripts/multimesh_foliage_manager.gd2.5 KB
  • scripts/multimesh_optimizer.gd1.5 KB
  • scripts/navigation_agent_optimization.gd1.4 KB
  • scripts/object_pool_system.gd1.7 KB
  • scripts/rendering_server_direct.gd1.6 KB
  • scripts/shared_resource_strategy.gd1.3 KB
  • scripts/texture_array_batching.gd1.4 KB
  • scripts/worker_thread_pool_manager.gd1.5 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

NEVER Do in Performance Optimization

  • NEVER optimize without profiling first — "I think physics is slow" without data? Premature optimization. ALWAYS use Debug → Profiler (F3) to identify actual bottleneck [20].
  • NEVER use print() in release builds — print() every frame = file I/O bottleneck + log spam. Use @warning_ignore or conditional if OS.is_debug_build(): [21].
  • NEVER ignore VisibleOnScreenNotifier2D for off-screen entities — Enemies processing logic off-screen = wasted CPU. Disable set_process(false) when screen_exited [22].
  • NEVER instantiate nodes in hot loops — for i in 1000: var bullet = Bullet.new() = 1000 allocations. Use object pools, reuse instances [23].
  • NEVER use get_node() in _process() — Calling get_node("Player") 60x/sec = tree traversal spam. Cache in @onready var player := $Player [24].
  • NEVER forget to batch draw calls — 1000 unique sprites = 1000 draw calls. Use TextureAtlas (sprite sheets) + MultiMesh for instanced rendering [25].
  • NEVER block the main thread for heavy operations — Avoid OS.delay_msec() or long synchronous data processing. Use WorkerThreadPool to keep framerates steady.
  • NEVER use complex collision shapes for physics queries — High-poly convex shapes are expensive to resolve. Prefer simplified primitives (Circle, Rectangle, Box).
  • NEVER forget to disconnect local lambda signals — Anonymous lambdas connected to global signals can cause memory leaks if the capturing object is freed.
  • NEVER use large textures without VRAM compression — VRAM is limited. Use S3TC/BPTC for desktop (DirectX/Vulkan) and ETC2 for mobile. Note: Disable compression for Pixel Art to avoid artifacts [13].
  • NEVER perform tree modifications during physics steps — Adding/removing nodes during _inter_ray or _physics_process can lock the physics server. Use call_deferred.
  • NEVER skip shader pre-warming in the Compatibility renderer — Unlike Forward+, OpenGL lacks Ubershaders. Pre-instantiate every mesh/VFX in front of the camera for 1 frame behind a loading screen to avoid hitches [21].

Debug → Profiler (F3)

Tabs:

  • Time: Function call times
  • Memory: RAM usage
  • Network: RPCs, bandwidth
  • Physics: Collision checks

Profiler-Tab Decision Tree

Open Debug → Profiler first. MANDATORY load only the script for the hot tab/symptom.

Do NOT Load every perf script for a single hitch.

Profiler / symptomLikely causeScript
Time — same script hotAlloc / get_node / processobject_pool_system.gd, cache @onready; custom_monitor_profiler.gd
Time — off-screen AI/VFXProcess while invisibleMANDATORY manual_culling_logic.gd
Memory — climbs over timeLeaks / unique resourcesshared_resource_strategy.gd; pair with debugging orphan tools
Physics — collision spikesQuery/node RayCast spamMANDATORY low_level_physics_query.gd
GPU / draw callsUnique sprites/meshesMANDATORY multimesh_optimizer.gd / multimesh_foliage_manager.gd / texture_array_batching.gd
SceneTree overhead at scaleCanvas/mesh item spamMANDATORY rendering_server_direct.gd
Main-thread hitch (gen/parse)Sync heavy workMANDATORY worker_thread_pool_manager.gd
Crowd path spikesNav agents same framenavigation_agent_optimization.gd
Custom game metricsMissing monitorscustom_performance_monitor.gd

Available Scripts

object_pool_system.gd

MANDATORY for hot-path spawn/despawn — reuse, do not invent Array pop pools inline.

manual_culling_logic.gd

VisibilityNotifier-driven process disable for CPU-heavy off-screen entities.

rendering_server_direct.gd

RenderingServer canvas/mesh path when SceneTree overhead dominates.

low_level_physics_query.gd

Direct space-state queries vs hundreds of RayCast nodes.

worker_thread_pool_manager.gd

WorkerThreadPool offload for heavy jobs.

multimesh_optimizer.gd / multimesh_foliage_manager.gd

Hardware instancing for dense meshes/foliage.

texture_array_batching.gd

Texture2DArray batching to cut material switches.

shared_resource_strategy.gd

Shared vs local-to-scene memory tradeoffs.

navigation_agent_optimization.gd

Staggered path updates for crowds.

custom_monitor_profiler.gd / custom_performance_monitor.gd

Performance.get_monitor / custom monitors for game-specific spikes.

Expert Pointers (keep short)

  • Compatibility renderer: pre-warm pipelines (hidden camera + unique meshes/materials one frame). Forward+/Mobile: Ubershaders still need instantiate-once detection.
  • VRAM: S3TC/BPTC desktop, ETC2 mobile; skip compression for pixel art.
  • AStar/path budgets belong in navigation_agent_optimization.gd — do not paste thrashy queue snippets as the golden path.

Deep dives (on demand)

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing to a peer domain — do not preload the whole lattice.

Official Documentation

Related Skills

Prerequisites

Complements

Downstream / consumers

  • godot-adapt-desktop-to-mobile — resolution/shader fallbacks and battery modes that apply these budgets on weaker GPUs.
  • godot-export-builds — export presets and renderer choices where compression and Compatibility pre-warm matter.
  • godot-genre-open-world — chunk streaming and HLOD systems that consume MultiMesh, culling, and thread-pool patterns at scale.

Master

  • godot-master — library router and mirrored module entry for cross-skill discovery.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Bevy ECS skill for 2D sprite animation. Keywords: Bevy, sprite, animation, AnimationPlayer, AnimationClip, 2D.

中文简介正在准备中。当前显示原文说明。

thedivergentai/Game-Dev-Agentic-Skills8782026年10月17日 更新

Spawn and tune Bevy 0.20 directional, point, and spot lights, cascade shadows, distance fog, and a nearest-light shadow budget. Use when a 3D scene needs a sun, local lights, or fog on the camera. Keywords: DirectionalLight, PointLight, SpotLight, CascadeShadowConfig, DistanceFog, bevy_light.

中文简介正在准备中。当前显示原文说明。

thedivergentai/Game-Dev-Agentic-Skills8782026年10月17日 更新

Bevy ECS skill for PBR materials. Keywords: Bevy, StandardMaterial, PBR, material, ExtendedMaterial.

中文简介正在准备中。当前显示原文说明。

thedivergentai/Game-Dev-Agentic-Skills8782026年10月17日 更新

Bevy ECS skill for 3D level assembly. Keywords: Bevy, level, scene, mesh, world, ECS.

中文简介正在准备中。当前显示原文说明。

thedivergentai/Game-Dev-Agentic-Skills8782026年10月17日 更新

Bevy ECS skill for abilities. Keywords: Bevy, ability, cooldown, ECS, gameplay.

中文简介正在准备中。当前显示原文说明。

thedivergentai/Game-Dev-Agentic-Skills8782026年10月17日 更新

Rewrite Bevy 2D actors and cameras into 3D meshes and Camera3d while keeping gameplay components. Use when a Bevy 2D game should gain a perspective camera, mesh draw, and a planar velocity lifted onto XZ. Keywords: Camera2d, Camera3d, Sprite, Mesh3d, StandardMaterial, WishVelocity.

中文简介正在准备中。当前显示原文说明。

thedivergentai/Game-Dev-Agentic-Skills8782026年10月17日 更新

查看 thedivergentai 的全部技能

报告此技能的问题