Demo of random Map Generation, Pathfinding and Steering

I just uploaded some recent work to my youtube channel:

Hope you enjoy!

4 Likes

Hi @Finite_State

You mean is this Surface(2D) AI/Finding OR Volume(3D) AI/Finding in Script Canvas? which? C++ or Lua?
I saw your algorithm in this video, so Is Surface(2D) AI/Finding , right?

Hi @_AhmadKarami,

Good question! The pathfinding actually doesn’t take any spatial coordinate system into account, it only knows that an object has a connection to another object. If platforms were spread throughout 3D space, it would make no difference as long as the objects were still ‘connected’ logically. In addition to objects with connections, the connections have costs/weights that the algorithm properly accounts for. Distance is a good choice for this cost, but it could be many different things, in this demo the cost/weight for every connection is a constant 1.

In the demo everything but the doors lie on the same XY-plane, so you can see the agent move slightly up to travel through the red doors. The steering is 3D and actually does the work of navigating to the objects on the path, it is a simple implementation without any collision avoidance (I’m thinking that will be one of the next things I add).

The way the map generation (platforms and connections) is implemented right now is 2D, but would only need a bit of modification to form a 3D neighborhood graph.

Map generation (platform spawning, neighborhood graph, connection spawning, pathing on the graph) is a Lua script.
Agent (path requests, steering) is a Lua script.
Camera (steering) is a Script Canvas graph.

The agent entity sends its current location and desired location (1, 123) via the gameplay bus to the map generation entity. The Map script runs those locations through the pathfinding algorithm and returns the shortest path (i.e. the path with the least cost/weight) via the gameplay bus as a string “1 42 16 123”. The string is split up and saved into an array. The agent will always steer towards the first element in that array or request a new path if it’s empty. When it reaches a location it removes it from the array.

1 Like

This is a neat little project!

2 Likes

@Finite_State Thank you :blush: :rose: I’m waiting for see update your project , GREAT JOB :wink:

@Hogjonny_LY I think if there were 3D models in the project, we could better understand how it works via visualization concept, Good or excellent result :blush: