Logo Godot Navigation Ai

Godot Navigation Ai

Cộng đồng
EL4CTEO
godot-navigation-ai

Pathfinding and game AI in Godot 4.7 (2D and 3D) - NavigationRegion/NavigationAgent, navmesh baking at runtime, avoidance, links and obstacles, NavigationServer queries, AStarGrid2D/AStar3D for grids and graphs, enemy state machines, behavior trees, utility AI, perception (sight, hearing), LimboAI and Beehave. Use for enemies, NPCs, pathfinding or AI behavior.

Tổng quan

Nhà phát hànhEL4CTEO
Kho mãgodot-skills
Tên kỹ nănggodot-navigation-ai
Sao
60
Bản fork
6
Tệp đi kèm
1
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 1 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được EL4CTEO công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Godot Navigation Ai trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/EL4CTEO/godot-skills/tree/main/skills/godot-navigation-ai
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/EL4CTEO/godot-skills.git /tmp/godot-skills
mkdir -p .claude/skills
cp -r /tmp/godot-skills/skills/godot-navigation-ai .claude/skills/godot-navigation-ai
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Godot Navigation Ai trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Godot Navigation Ai ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Godot Navigation Ai với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Navigation and AI (4.7)

Navigation nodes and servers are marked experimental in 4.7: the API works, but check names with api_lookup.py (e.g. NavigationAgent3D), never from memory. 2D has its own server since 4.5 (NavigationServer2D).

Pick the tool

NeedUse
Characters walking on free-form 2D/3D levelsNavigationRegion2D/3D (navmesh) + NavigationAgent2D/3D per unit
Square/hex-like grids: tactics, roguelikes, tower defenseAStarGrid2D (no navmesh, no baking)
Waypoint graphs, road networks, flying nodes, room graphsAStar3D/AStar2D with your own points
Tile levelsTileMapLayer with navigation polygons on tiles (navigation_enabled) or bake a NavigationRegion2D over it
Jumps, ladders, teleports, doors between regionsNavigationLink2D/3D (start/end, bidirectional, costs)
Moving things others must avoidNavigationObstacle2D/3D (avoidance_enabled; affect_navigation_mesh/carve_navigation_mesh for baking)

Navmesh setup and baking

  • 3D: add NavigationRegion3D → new NavigationMesh → set agent_radius, agent_height, agent_max_climb, agent_max_slope to match your character → Bake. cell_size/cell_height must match the map (navigation/3d/default_cell_size) or you get edge-merge warnings.
  • Source geometry: geometry_parsed_geometry_type = meshes, static colliders or both; geometry_source_geometry_mode = children of the region, or a group (geometry_source_group_name). Colliders are cheaper to parse than visual meshes.
  • 2D: NavigationRegion2D → NavigationPolygon; draw an outline or bake from colliders/meshes; agent_radius shrinks it.
  • Runtime rebake (doors, destructible walls, procedural levels): region.bake_navigation_mesh() (threaded by default; listen to bake_finished). For many chunks use NavigationServer3D.parse_source_geometry_data() on the main thread, then bake_from_source_geometry_data_async(). Parsing must happen on the main thread; baking can be threaded.
  • Several regions merge when their edges overlap or are within edge_connection_margin. Use navigation_layers (bitmask) for unit types: e.g. layer 1 ground units, layer 2 large units, layer 3 swimmers.
  • enter_cost/travel_cost on regions and links make paths prefer or avoid areas (roads cheap, swamp expensive).

Agent loop (the part people get wrong)

  1. Set agent.target_position when the goal changes (not every frame; each set re-queries the path).
  2. Every physics frame: if agent.is_navigation_finished(): return, then next := agent.get_next_path_position() and steer toward it.
  3. Without avoidance: set velocity and move_and_slide(). With avoidance: assign the desired velocity to agent.velocity, then move in the velocity_computed(safe_velocity) handler.
  4. The map is empty on the first physics frame. Await one frame (await get_tree().physics_frame) or check NavigationServer3D.map_get_iteration_id(agent.get_navigation_map()) > 0 before the first query.
  • path_desired_distance/target_desired_distance: raise them if agents orbit waypoints. path_height_offset (3D) fixes agents whose origin is far above the navmesh.
  • Signals: target_reached, navigation_finished, waypoint_reached, link_reached (play a jump or climb animation, then continue).
  • is_target_reachable() tells you when the final position isn't the target (blocked goal). get_final_position() is where the agent will stop.
  • Avoidance (RVO) only steers velocities; it never changes the path. Tune radius, neighbor_distance, max_neighbors, time_horizon_*, max_speed, avoidance_layers/avoidance_mask and avoidance_priority. use_3d_avoidance only for flying units.
  • Debug: Debug menu → Visible Navigation, and agent.debug_enabled = true.

Direct queries (no agent)

  • Paths: NavigationServer3D.map_get_path(map, from, to, optimize, layers), or query_path(NavigationPathQueryParameters3D, NavigationPathQueryResult3D) for costs, region filters, path_postprocessing and simplification.
  • Closest point: map_get_closest_point(map, p) snaps clicks and spawns to the navmesh. Random wander target: map_get_random_point(map, layers, uniformly).
  • Map RID: get_world_3d().navigation_map (3D), get_world_2d().navigation_map (2D).
  • Thousands of units: skip agents, query paths for groups (flow-field or shared path to a leader) and use AStarGrid2D on a coarse grid. See godot-performance.

AStarGrid2D essentials

region = Rect2i(...), cell_size, diagonal_mode, default_compute_heuristic, then update() before use (after changing region, size or cell shape). Then set_point_solid(cell), set_point_weight_scale(cell, cost), fill_solid_region(rect). Paths: get_id_path(from, to, allow_partial_path) (cells) or get_point_path (positions). allow_partial_path = true returns the closest reachable path when the goal is blocked. Not thread-safe: query from one thread.

AI architecture

Size of behaviorUse
3–8 states (idle, patrol, chase, attack, flee)enum state machine in the enemy script, or node states (see godot-architecture)
Reusable, designer-tweaked, many enemy typesbehavior tree: LimboAI or Beehave, or the small tree in the reference
Many competing goals (needs, tactics, squad AI)utility AI: score every action, pick the best, re-score on a timer
  • Decide slowly, move every frame. Run perception and decisions on a Timer (0.1–0.5 s, randomized per unit to spread load); keep steering in _physics_process.
  • Perception: sight = distance check, then angle (forward.dot(dir) > cos(half_fov)), then one raycast for line of sight (cheapest first). Hearing = an autoload/global signal noise_made(position, radius) that nearby AIs check. Keep a last_known_position and search there after losing the target.
  • Use groups (get_tree().get_nodes_in_group(&"player")) or an injected target. Don't hard-code node paths across scenes.
  • Animation follows AI state; AI never waits on animation timing except through signals (animation_finished) or AnimationTree conditions.

Addons (install with godot-addons)

  • LimboAI (1.8.x for 4.6+/4.7): behavior trees + hierarchical state machines with an editor, debugger and blackboard. It ships as a GDExtension (GDScript/C# usable) or an engine module.
  • Beehave (2.9.x supports 4.7): behavior trees as nodes in the scene, pure GDScript, with a debug view. Prefer plain code for small games; use an addon when designers edit trees or you have 10+ behaviors.

Agents, avoidance, runtime baking, grid A*, state machine, perception, behavior tree and utility AI code (compiled by the tests): references/patterns.md

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Godot Navigation Ai làm được gì?

Pathfinding and game AI in Godot 4.7 (2D and 3D) - NavigationRegion/NavigationAgent, navmesh baking at runtime, avoidance, links and obstacles, NavigationServer queries, AStarGrid2D/AStar3D for grids and graphs, enemy state machines, behavior trees, utility AI, perception (sight, hearing), LimboAI and Beehave. Use for enemies, NPCs, pathfinding or AI behavior.

Vì sao nên dùng Godot Navigation Ai trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Godot Navigation Ai là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Godot Navigation Ai trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/EL4CTEO/godot-skills/tree/main/skills/godot-navigation-ai. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Godot Navigation Ai?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Godot Navigation Ai với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Godot Navigation Ai với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Godot Navigation Ai có miễn phí không?

Có. Kỹ năng này được EL4CTEO phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇