AI & Navigation

Implement game AI in Godot 4 with NavigationServer pathfinding and state machines.

Updated Feb 15, 2026
One-click install
npx skills add https://github.com/ftnilsson/agent-cli --skill ai-navigation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: AI & Navigation
Source: https://github.com/ftnilsson/agent-cli/tree/main/godot-development/skills/11-ai-and-navigation
Command: npx skills add https://github.com/ftnilsson/agent-cli --skill ai-navigation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to implementing sophisticated AI behaviors in Godot 4, focusing on efficient pathfinding and dynamic decision-making for game characters.

Core Features & Use Cases

  • Pathfinding: Utilizes Godot's NavigationServer and NavigationAgent for robust 2D and 3D pathfinding.
  • Behavioral Logic: Implements state machines and provides examples for behavior trees to manage complex AI decision-making.
  • Navigation Setup: Covers the creation and configuration of NavigationRegion2D/3D and NavigationAgent2D/3D.
  • Use Case: Create intelligent enemies that can patrol, chase the player, avoid obstacles, and react realistically to their environment.

Quick Start

Configure a NavigationRegion2D and add a NavigationAgent2D to your character scene, then set the agent's target position to guide movement.

Frequently Asked Questions about AI & Navigation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up pathfinding for game AI in Godot 4?

To set up pathfinding in Godot 4, configure a NavigationRegion2D or 3D for your level geometry, then attach a NavigationAgent to your character scene and set its target position to guide movement.

What is the best way to manage complex AI decision-making in Godot?

State machines and behavior trees are the best ways to manage complex AI decision-making in Godot, allowing characters to dynamically switch between behaviors like patrolling, chasing, and reacting to their environment.

Does this AI navigation approach work for both 2D and 3D Godot games?

Yes, this AI navigation approach works for both 2D and 3D Godot games by utilizing the NavigationServer alongside NavigationAgent2D and NavigationAgent3D for robust pathfinding and obstacle avoidance.

How do I make enemies avoid obstacles while chasing the player in Godot?

You make enemies avoid obstacles while chasing the player by using Godot's NavigationAgent, which handles pathfinding and dynamic avoidance through the NavigationServer to navigate around environmental hazards.

When should I use behavior trees instead of state machines for game AI?

You should use behavior trees instead of state machines when your game AI requires more complex decision-making hierarchies, as behavior trees allow for layered prioritized logic compared to the simpler state transitions of state machines.