Skip to content

spood/PCGPathfinding

Repository files navigation

PCGPathfinding

An A* pathfinding implementation that can be used with PCG (Procedural Content Generation) to generate custom splines.

Project is made in Unreal 5.2

PCG Graph

Demonstration

Explanation

  1. Surface Sampler generates a grid of points with settings:
  • Points Per Squared Meter = 1.0
  • Point Extents = (500,500,500)
  • Looseness = 0.0
  1. 2 Get Actor Data nodes find an object with tag "Start" and "End"
  2. PCG Get Start End Points goes through each point on the sampled grid (from step 1) and adds attributes for DistanceToStart and DistanceToEnd and outputs them.
  3. Select the smallest DistanceToStart and DistanceToEnd and passes them as points to the BPCG Pathfinding node
  4. BPCG Pathfinding does some magic to calculate the shortest path between the start and end in the A* pathfinding and outputs it as Points
  5. These Points are passed to Create Spline

Demonstration Video

demo.webm

Blueprints

Feel free to inspect the blueprints without having to open the project:

PCG_Pathfinding (ExecuteWithContext) https://blueprintue.com/blueprint/m-o5o5_1/

PCG_GetStartEndPoints (ExecuteWithContext) https://blueprintue.com/blueprint/6nzzw6e9/

PCG_GetStartEndPoints (PointLoopBody) https://blueprintue.com/blueprint/lnuqqy4n/

About

An A* pathfinding implementation with PCG (Procedural Content Generation) to generate custom splines in unreal engine between two points

Topics

Resources

License

Stars

Watchers

Forks