this post was submitted on 21 Jun 2026
29 points (93.9% liked)

Godot

7689 readers
48 users here now

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

founded 3 years ago
MODERATORS
 

Godot's AStarGrid2D is a ten-minute read and a month of gotchas. The API page is small, you skim it, and then your path comes back empty, your units cut through wall corners, or your weighted swamp gets ignored. None of it is a bug. It's the gap between knowing the method names and knowing which handful of settings actually decide the behavior.

The five that get almost everyone:

  • You forget update(). Change the region or cell size, skip the rebuild, and you get an empty array with no error.
  • update() wipes your point data. It clears every solid cell and weight, so you have to set those after you call it.
  • Diagonal corner-cutting. DIAGONAL_MODE_ALWAYS lets units squeeze diagonally between two walls. You usually want ONLY_IF_NO_OBSTACLES.
  • jumping_enabled silently ignores weight scale. Turn on JPS and your weighted terrain stops mattering. It's in the docs. People still lose an afternoon to it.
  • Manhattan overestimates with diagonals. On an 8-direction grid it counts a diagonal as two steps, so your "shortest" path isn't. Reach for Octile.

So I wrote the reference I actually wanted (every property and method, the gotcha attached to each, version-honest across Godot 4.0 → 4.7, checked against the official docs and the C++ source), and built an interactive sandbox for the parts you have to see: drag the goal, paint solid and weighted cells, flip diagonal modes, toggle jumping, and watch the path recompute live. (It's a browser illustration of how AStarGrid2D behaves, not the engine itself running in a tab.)

Full reference and the sandbox: https://vav-labs.com/blog/astargrid2d-complete-reference/

If any of it's wrong or out of date for your version, tell me. The API moved across Godot 4.x, and I'd rather fix it than leave you debugging my mistake.

you are viewing a single comment's thread
view the rest of the comments
[–] Vav_Labs@programming.dev 2 points 5 hours ago

Fair suspicion in 2026. AI can write it! , which is exactly why I built the sandbox instead of leaving this as a wall of advice. The useful part is meant to be testable version specific AStarGrid2D behavior, reproduced gotchas, and an interactive grid you can poke at. If you see a specific mistake, vague claim, or Godot-version mismatch, point me to it and I’ll fix it.