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.
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.
1.0.0 (August 23, 2021): First public release.
1.0.1 (August 26, 2021): Updated demo BBDOC and system requirements.
1.1.0 (August 29, 2021): Added support for 2D Worlds, updated demo BBDOC and system requirements.
1.2.0 (July 1, 2022): Added input to 'Set as chaser' node to safely remove it from the game, fixed errors with debug options enabled in Pathfinder Manager, updated demo BBDOC and system requirements.
1.2.1 (July 3, 2022): Updated 2D game in demo bbdoc.
• Buildbox 3.4.8 or higher.
• Any plan: these assets will work no matter the plan you are in (Free, Plus, Pro, etc.).
HOW DOES IT WORK?
Here's some techy info on how this pathfinder works, you don't have to read it, this is just if you wish to know more about what's under the hood; it's a bit techy and requires you to know a little about the A* pathfinding algorithm since that's the one this pathfinder is based on, although it is not a pure A* algorithm.
The main function of the pathfinder takes four parameters: startNode, destNode, fuzzy, hWeight.
startNode is the starting waypoint, the chaser itself, destNode is the target waypoint, fuzzy is the fuzziness value set in the chaser, hWeight is the nature value set in the chaser.
As you'd expect from an A* algorithm, this one uses both G & H but as a weighted sum so that F = G*(1-hWeight) + H*hWeight instead of F = G + H.
This allows for the creation of different behaviors so that different enemies can create different paths.
It is also possible to set a Fuzziness value which causes a certain degree of unpredictability in created paths.
Quick description of the algorithm for pathfinding:
starting from the start waypoint (the chaser itself), for each link this waypoint has toward other waypoints we check the distance between the waypoint and the linked
waypoint and we sum to it the distance between the linked waypoint and the target waypoint, the link with the shortest distance gets saved,
marked as visited and becomes the next waypoint; this goes on until the target is reached or no complete path is found.
COPYRIGHT NOTICE & LICENSE AGREEMENT
Please note that this asset package and all of its content, including source code, is protected by copyright, it is not open source.
In short you can use it in any of your Buildbox projects but please don't share it, it took a lot of effort to design, create and optimize it.
In detail here's a more exhaustive copyright notice for this asset package, please read it carefully, thank you!
Once purchased you are free to use the asset package within your personal and commercial Buildbox projects.
And of course you are free to publish, sell or otherwise distribute any app or software you export from Buildbox that makes use of any of the assets in this asset package.
You are not allowed to allow users of such apps or software you created to access, extract and/or use any of the assets included in this package outside of the software, for example you are not allowed to distribute a Buildbox template or asset which includes any content coming from this asset package.
For sublicensing, volume licensing or any other request please contact me!
You are not allowed to copy, sell, give away or otherwise distribute any of the assets contained in this asset package, either in their original form or in any modified form.
You are not allowed to remove this copyright notice.