thedivergentai/gd-agentic-skills

godot-navigation-pathfinding

Expert blueprint for AI pathfinding (tower defense, RTS, stealth) using NavigationAgent2D/3D, NavigationServer, avoidance, and dynamic navigation mesh generation.

First seen Feb 10, 2026

Installation

$ npx skills add thedivergentai/gd-agentic-skills --skill godot-navigation-pathfinding

Summary

  • Expert blueprint for AI pathfinding (tower defense, RTS, stealth) using NavigationAgent2D/3D, NavigationServer, avoidance, and dynamic navigation mesh generation.
  • Use when implementing enemy AI, NPC movement, or obstacle avoidance.
  • Keywords NavigationAgent2D, NavigationRegion2D, pathfinding, NavigationServer, avoidance, baking, NavigationObstacle.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from thedivergentai/gd-agentic-skills · top by installs.

npx skills add thedivergentai/gd-agentic-skills

Browse all from thedivergentai/gd-agentic-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 678
License LICENSE
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 12,896 B
  • docs SUMMARY.md 385 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 298 installs

SKILL.md

NEVER Do in Navigation & Pathfinding

  • NEVER set targetposition before awaiting physics frame — NavigationServer not ready in ready()? Path fails silently. MUST calldeferred() then await gettree().physics_frame.
  • NEVER use NavigationRegion2D.bakenavigationpolygon() at runtime — Synchronous baking freezes game for 100+ ms. Use NavigationServer.bakefromsourcegeometrydata_async() for stutter-free updates.
  • NEVER forget to check isnavigationfinished() — Calling getnextpath_position() after reaching target = stale path, AI walks to old position.
  • NEVER use avoidanceenabled without setting radius — Default radius = 0, agent passes through others. Set navagent.radius = collision_shape.radius for proper avoidance.
  • NEVER poll target_position every frame for chase AI — Setting target 60x/sec = path recalculation spam. Use timer (0.2s intervals) or distance threshold for updates.
  • NEVER assume path exists — Target unreachable (blocked by walls)? getnextpathposition() returns invalid. Check istarget_reachable() or validate path length.
  • NEVER use heavy node-based navigation for thousands of simple entities — Use NavigationServer3D/2D RIDs directly to bypass node overhead.
  • NEVER call getpath() every frame — Use querypath() with reused NavigationPathQueryResult objects to prevent massive heap allocation and GC pressure.
  • NEVER leave 'enter_cost' at 0 for high-penalty areas — Use costs to make AI prefer logical paths (roads over water) instead of just shortest geometric distance.
  • NEVER ignore agentsetavoidance_callback — Always use the callback for safe velocity computation to avoid synchronization issues and "jittery" movement.

Decision Tree → Scripts

MANDATORY for the chosen path. Do NOT Load editor-intro / Official Docs bootstrap recipes from this skill body (use Reference links when you need first-time region setup).

Need Script
Runtime / procedural bake without hitch MANDATORY [asyncdynamicbaking.gd](scripts/asyncdynamicbaking.gd)
Agent stuck / jitter recovery MANDATORY [agentstuckdetection.gd](scripts/agentstuckdetection.gd)
High-count RVO without nodes MANDATORY [lowlevelavoidance.gd](scripts/lowlevelavoidance.gd)
Moving platforms / dynamic regions [dynamicnavmanager.gd](scripts/dynamicnavmanager.gd)
RID-only maps/regions [servernavigationsetup.gd](scripts/servernavigationsetup.gd)
Reused path query objects [memoryoptimizedqueries.gd](scripts/memoryoptimizedqueries.gd)
Terrain enter/travel costs [terraincostmanager.gd](scripts/terraincostmanager.gd)
Projectiles as RVO obstacles [movingobstacleserver.gd](scripts/movingobstacleserver.gd)
Links (jump/teleport/elevator) [navlinktraversal.gd](scripts/navlinktraversal.gd)
Walk / fly / swim layers [layermasknavigation.gd](scripts/layermasknavigation.gd)
Crowd formation offsets [groupavoidanceformations.gd](scripts/groupavoidanceformations.gd)
Server RVO crowd agent (node-less) [crowdagent3d.gd](scripts/crowdagent3d.gd)
Dynamic navmesh carve (impact holes) [navmeshcarver3d.gd](scripts/navmeshcarver3d.gd)
Bake-time benchmark [navmeshprofiler.gd](scripts/navmeshprofiler.gd)
Smart agent wrapper [smartnavigationagent.gd](scripts/smartnavigationagent.gd)

Chase / Retarget Rule (never contradict NEVER)

Do not assign target_position every physics frame. Retarget on a timer (~0.2s) or when the chased body moves beyond a distance threshold:

# Threshold retarget — not per-frame path spam
const RETARGET_DIST := 1.5
var _last_target: Vector3

func _physics_process(_delta: float) -> void:
    var desired := prey.global_position
    if desired.distance_to(_last_target) >= RETARGET_DIST:
        nav_agent.target_position = desired
        _last_target = desired
    if nav_agent.is_navigation_finished():
        return
    var next := nav_agent.get_next_path_position()
    velocity = (next - global_position).normalized() * speed
    move_and_slide()

Available Scripts

[asyncdynamicbaking.gd](scripts/asyncdynamicbaking.gd)

bakefromsourcegeometrydata_async — parse on main, bake off-thread.

[agentstuckdetection.gd](scripts/agentstuckdetection.gd)

Distance-over-time stall detection and recovery.

[lowlevelavoidance.gd](scripts/lowlevelavoidance.gd)

Server-side RVO agents + avoidance callbacks.

[dynamicnavmanager.gd](scripts/dynamicnavmanager.gd)

Runtime navmesh updates for moving platforms.

[servernavigationsetup.gd](scripts/servernavigationsetup.gd)

Node-less maps/regions via NavigationServer RIDs.

[memoryoptimizedqueries.gd](scripts/memoryoptimizedqueries.gd)

Reuse path query parameter/result objects.

[terraincostmanager.gd](scripts/terraincostmanager.gd)

entercost / travelcost for preferred routes.

[movingobstacleserver.gd](scripts/movingobstacleserver.gd)

Dynamic RVO obstacles without full rebake.

[navlinktraversal.gd](scripts/navlinktraversal.gd)

NavigationLink jump/teleport/elevator handling.

[layermasknavigation.gd](scripts/layermasknavigation.gd)

Multi-domain navigation layers (walk/fly/swim).

[groupavoidanceformations.gd](scripts/groupavoidanceformations.gd)

Leader-relative offsets to reduce clumping.

[smartnavigationagent.gd](scripts/smartnavigationagent.gd)

Production NavigationAgent wrapper patterns.

Expert Pointers

  • Prefer Official Docs intros for first NavigationRegion bake UI; this skill owns async bake, server RVO, costs, and stuck recovery.
  • Thousands of simple agents → RID server path ([servernavigationsetup.gd](scripts/servernavigationsetup.gd) + [lowlevelavoidance.gd](scripts/lowlevelavoidance.gd)), not one NavigationAgent node each.
  • Crowd RVO / carve / bake benchmark samples → [crowdagent3d.gd](scripts/crowdagent3d.gd), [navmeshcarver3d.gd](scripts/navmeshcarver3d.gd), [navmeshprofiler.gd](scripts/navmeshprofiler.gd)

Deep dives (on demand)

  • 2D/3D chase, patrol, avoidance signals → [agent-movement-patterns.md](references/agent-movement-patterns.md)
  • Server RVO crowds, projected carving, bake benchmarks → [expert-nav-architectures.md](references/expert-nav-architectures.md)

Reference

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

Official Documentation

Related Skills

Prerequisites

  • godot-characterbody-2d — Path corners become CharacterBody velocity via moveandslide; agent scripts assume a body parent.
  • godot-2d-physics — Collision layers/shapes still block bodies; navmesh is not a physics substitute for walls and triggers.
  • godot-physics-3d — 3D agents share the same split: NavigationServer paths vs RigidBody/CharacterBody collision and slopes.

Complements

Downstream / consumers

  • godot-genre-rts — Unit move commands and RVO crowds consume NavigationAgent/Server patterns directly.
  • godot-genre-tower-defense — Lane/path enemies and dynamic blockers depend on regions, costs, and obstacle updates.
  • godot-genre-stealth — Guard patrols and investigate points are NavigationAgent routes gated by detection state.
  • godot-combat-system — Engage/kite/flank movement issues new targets and stuck recovery on top of paths.
  • godot-monte-carlo-balancer — Simulate chase reachability, travel-time bands, and crowd pressure when tuning AI difficulty.

Master

  • godot-master — Library router and mirrored module entry for this Domain Skill.