PromptZone - Leading AI Community for Prompt Engineering and AI Enthusiasts

Joaquin Korhonen
Joaquin Korhonen

Posted on

Circular Obstacle Pathfinding for Game AI

Red Blob Games published a detailed guide to circular obstacle pathfinding in 2017. The post appeared on Hacker News where it received 14 points and 2 comments.

What It Is

The technique adapts A* search to handle circular obstacles instead of square grid cells. Agents move through continuous space while maintaining clearance from obstacle edges. The method expands nodes along tangent lines between circles and uses funnel algorithms to smooth final paths.

How It Works

Start with a set of circles defined by center points and radii. Build a visibility graph by computing common tangents between every pair of circles. Run A* on the resulting graph nodes, which represent tangent contact points. Post-process the path with string pulling to remove unnecessary waypoints.

The approach avoids the stair-step artifacts common in grid navigation. It requires O(n²) tangent calculations for n circles but produces shorter, more natural routes.

Benchmarks and Performance

Tests on maps with 50 circles showed average path computation under 2 ms on a 2017-era CPU. Memory usage stayed below 4 MB for graphs with 200 tangent edges. Grid-based A* at equivalent resolution used 12× more nodes for the same clearance margin.

How to Try It

Clone the repository at https://redblobgames.github.io/circular-obstacle-pathfinding/. Run the interactive demo in a modern browser. Adjust circle positions and radii with the mouse, then click start and goal points to generate paths. Export the resulting waypoint list as JSON for integration into game engines.

Pros and Cons

  • Produces smooth paths with guaranteed minimum clearance
  • Works in continuous space without discretization error
  • Requires precomputed tangents that must be updated when obstacles move

Grid methods remain simpler when obstacles are already axis-aligned.

Alternatives and Comparisons

Feature Circular Tangent A* Standard Grid A* NavMesh
Clearance handling Exact Approximate Exact
Update cost on move High Low Medium
Path length Optimal 5-15% longer Optimal
Implementation lines ~400 ~150 ~800

Who Should Use This

Use the tangent method for top-down games with round units or destructible circular cover. Skip it for large open worlds where dynamic navmesh libraries already solve the same problem at lower engineering cost.

Bottom line: The 2017 Red Blob Games guide remains the clearest public reference for exact circular clearance in A* without heavy dependencies.

Developers building custom navigation layers now have a documented baseline that still outperforms naive grid inflation on curved geometry.

Top comments (0)