Pathfinder AI System for Buildbox

WHAT IS IT?

A suite of assets and nodes to add pathfinding AI to any Buildbox game! Pathfinder for Buildbox supports both 3D and 2D games (it works in 3D worlds and in 2D worlds) and is compatible with the latest version of Buildbox.

WHAT IS PATHFINDING?

Simply put, pathfinding solves the problem of finding a path between two points, for example it would allow enemies to find a way to reach the player’s character within a maze, a dungeon or a city map while getting around obstacles.
In short you’re adding artificial intelligence (AI) to enemies, they’ll become smart.
Here are two clips showing both 3D and 2D demo games using the Pathfinder for Buildbox.
Waypoints and paths are visible to show what happens under the hood, particularly: path creation and update in real-time, path update when an obstacle blocks it, enemies following paths to reach the target, enemies changing path when required.

 

EASY TO USE!

Pathfinder for Buildbox is very easy to set up.
There are a few key nodes and assets you can quickly add to your project to enable pathfinding, here’s a quick roundup:

• Pathfinder Waypoint 

Waypoints are all the intermediate points through which a path can pass, you just place waypoints in your world and the Pathfinder Manager will take care of the rest.

• Pathfinder Manager  

This colorful cube is the brain of the pathfinder, its main function is to find waypoints, create links between them, update links when needed and provide paths for Chaser nodes; it recognizes obstacles so that no link is created when there is an obstacle between two waypoints.
You only need one Pathfinder Manager in each world.

The Pathfinder Manager has a few attributes you can configure:
• DEBUG: Show Nodes, Show Links, Show Paths can be used to enable nodes, links and paths to show up in game; these attributes are unchecked by default.
• Max Update Interval (s): this value sets the maximum update interval to update links between waypoints; it is suggested to leave this at 1 or more to avoid overhead; in case you have many waypoints in game (>60) it is suggested to increase this value.
• 2D World: check this if you’re using the pathfinder in a 2D World.

• Set as Obstacle  

Add this node to an object and it will be considered as an obstacle by the pathfinder, you can use this for walls, doors, floors, and any other object that should be considered as an obstacle if encountered along a path.
Obstacles can be animated, if you have a sliding door for example a path may become blocked, the Pathfinder Manager will take care of this as well and look for a different path if available.

• Set as Target  

Add this node to an object and it will be considered as a target by the pathfinder; an example of target could be the player’s character.

• Set as Chaser  

Add this node to an object and it will be considered as a chaser by the pathfinder.
A chaser follows the best path it can find to reach a target; a chaser is, for example, an enemy trying to reach the player’s character.
Here’s an example of how to set up a chaser node.

The chaser node has a few attributes you can configure:
• Target: this is the target of the chaser node, the player’s character for example.
• Fuzziness: causes a certain degree of unpredictability in the path to be followed, 0 is the default; the effect of this attribute will vary depending on your setup, it is suggested to keep it below 100 in most cases, in the demo game some of the enemies use fuzziness with values of 10, 20 and 30.
• Nature: this can be any value between 0 and 1 and will change the way the path is searched, to simplify it can be said that 0 is a very cautious approach, 0.5 is balanced and 1 is very impulsive.
• Set as obstacle: check this if you want the chaser to be considered an obstacle by other chasers; this is unchecked by default but can be useful in some cases.

Remove Chaser inlet: send a signal into this inlet to safely remove the chaser entity from the game. You’ll find an example of how to use this new feature in the 3D demo game that’s included, check into the ‘3D Enemy’ asset.

You can see that the chaser node has an output and that’s the direction to follow; in this example, it is connected to a ‘Move in Direction’ node and that would be perfectly suitable for most cases; anyway, this output is simply a 2D vector, the same you’d get from a joystick so you can use it with any other node that accepts that as an input.

WHAT’S INCLUDED?

All of the assets and nodes just described are included, as well as a demo BBDOC game that demonstrates how the Pathfinder for Buildbox works.

Related Portfolio