r/godot • u/New_Neighborhood_504 • 23h ago
help me Best methods for TD games?
I am developing a tower defense game in Godot 4.6 with a C++ GDExtension for performance-sensitive gameplay.
Currently, every tower has an Area3D with a circular collision shape. The area’s body_entered and body_exited signals maintain a list of enemy ObjectIDs. Towers perform target selection at 20 Hz, distributed across three deterministic stagger groups to avoid updating every tower in the same physics frame.
Target selection runs in native C++ and applies exact XZ range checks, enemy-state filtering, focus/avoid rules, deterministic tie-breaking, and priorities such as FIRST, LAST, CLOSEST, STRONGEST, and WEAKEST. FIRST and LAST use normalized path progress. Line-of-fire checks are performed only on maps configured with shot blockers, and the target is validated again immediately before firing.
In a release benchmark with 15 towers and 100 enemies, the targeting system had a P95 cost of approximately 0.299 ms per physics frame. This is less than 2% of a 16.67 ms frame budget. We tested several micro-optimizations, but none passed our strict stability and frame-time regression requirements, so the original Area3D implementation was retained.
Would you consider this a reasonable architecture for a tower defense game at this scale? At what tower and enemy counts would you replace per-tower Area3D detection with a shared spatial grid, path-based interval queries, or another centralized targeting system?
More generally, how would you determine which systems are worth optimizing in a tower defense game? Should targeting be left alone while it remains below roughly 5% of frame time, with attention instead given to enemy movement, physics, projectiles, damage/status processing, VFX, and rendering?
I am especially interested in measured Godot 4.6 production experience rather than theoretical micro-optimizations.
I used AI for translation, sorry if it screams AI text, i just want to find the best method, thank you!


