Pathfinder For Buildbox Now Available For Download!

Discussion in 'Promotional' started by Ivan Perfetti, Jul 20, 2021.

  1. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
    Hi all ! I've just started working on an easy-to-use pathfinding system for Buildbox, here's a clip!
    Graph and route gets created and updated in real-time; pillars are navigation nodes, purple ones show the route between START and END.
    This would be very useful to have enemies able to find a path to reach a character or to have NPCs walking around to reach places, for example.
    This system is a work in progress, I'm going to publish it on indym.itch.io as soon as it's ready.
    Please leave your feedback, suggestions or feature requests, thank you!
     
    Last edited: Jul 21, 2021
  2. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
    I've been asked a few times how do I create the lines, here's how:
    - spawn a cube object in between two nodes
    - change its scale to match the distance between the two nodes
    - rotate it on the Y axis using this formula to calculate the angle:
    -Math.atan(diff.z/diff.x)*c
    where diff is a Vec3 obtained by subtracting node positions and c is a constant equal to 180/Math.PI.
     
  3. wmfear

    wmfear Avid Boxer

    Joined:
    Apr 6, 2018
    Messages:
    131
    Likes Received:
    58
    That makes sense… :eek:
     
  4. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
    Actually I could make a node just to draw lines between two points or objects, that would be useful for many use cases.:D
     
    wmfear and Vlad-NY like this.
  5. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
    Hi all, here's an update!
    In this short clip you can see the path being recalculated in real-time based on moving obstacles!
    To anyone interested: I'm using the A* algorithm, to improve results in sparse node #graphs I've added attributes to change #heuristic weight (euclidean distance) and check backward routes, useful in #graphs with sparse nodes like this one.
    Coming soon! indym.itch.io
     
  6. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
    Here's a two minutes clip showing a pathfinding-enabled enemy chasing a character!
    Pathfinding System for Buildbox coming soon! >>>>>> http://indym.itch.io <<<<<<
     
    wmfear likes this.
  7. wayne_martell

    wayne_martell Avid Boxer

    Joined:
    Sep 25, 2015
    Messages:
    293
    Likes Received:
    100
    This is one thing that kills BB games, the lack of any real enemy that has AI, people will get sick of back and forward enemies or even ones that follow a path with sight variation. Come on BB contact this guy and start making exciting games again !
     
    Colin MH and Ivan Perfetti like this.
  8. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
    Time for an update! :)
    One of the components of this pathfinding system is the "Chase" node.
    You can use it to create enemies chasing a character, for example.
    You can drop it inside an object together with a control node, I've used the Move in Direction node here.
    Then you set its Target and that's it!

    upload_2021-7-24_17-8-7.png

    You can customize the way each enemy will chase its target with two special attributes:
    "Fuzziness" allows to make the path search more erratic, the higher the value, the more erratic it will be.
    "Nature" defines the search behavior: 0.0 = Cautious / 0.5 = Balanced / 1.0 = Impulsive.
    This way it is possible to define enemies with different capabilities.

    Here's a clip from a demo game making use of the #Pathfinding System for #Buildbox!
    In this clip you can see four different enemies chasing a character, each in its own way!
    Coming soon! ►►► http://indym.itch.io
     
    wmfear likes this.
  9. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
    A quick update: the search algorithm has been improved and an anti-stuck mechanism has been added so if an enemy is stuck against a wall the path will be recalculated; enemies will try to reach the target all the time!
    What if they can't? They'll keep trying, you bet!
    Coming soon! ►►► http://indym.itch.io
     
    Colin MH and andre_sprs like this.
  10. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
    Pathfinder for Buildbox is finally ready!
    A suite of assets and nodes to easily add pathfinding to any Buildbox 3D game!
    Get it now: https://indym.itch.io/pathfinder-for-buildbox-3


    WHAT IS IT?
    A suite of assets and nodes to add pathfinding to any Buildbox 3D game!

    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, a city map, etc.
    Here's a clip showing a demo game 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 [​IMG]
    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 [​IMG]
    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.

    • Set as Obstacle [​IMG]
    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 [​IMG]
    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 [​IMG]
    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.
    [​IMG]

    The chaser node has a few parameters 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.

    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.

    Looking for a developer to help you with your Buildbox project? Hire me!
    SYSTEM REQUIREMENTS
    Buildbox 3.4.2 or higher is required to use assets and nodes in this package.
    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 used by this pathfinder.
    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.

    Looking for a developer to help you with your Buildbox project? Hire me!
     
    Last edited: Aug 24, 2021
    andre_sprs and wmfear like this.
  11. wmfear

    wmfear Avid Boxer

    Joined:
    Apr 6, 2018
    Messages:
    131
    Likes Received:
    58
    Purchased :)
     
    Ivan Perfetti likes this.
  12. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
  13. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    500
    Likes Received:
    311
    Same here, well done fellow Dev :)
     
    Ivan Perfetti and wmfear like this.
  14. Jaro

    Jaro Avid Boxer

    Joined:
    Sep 21, 2018
    Messages:
    355
    Likes Received:
    116
    Does it also work with B3 2D? I cannot find such information.
     
  15. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
    @wmfear @Vlad-NY Thank you guys!
    @Jaro Should work without problems in 2D world but haven't tested that yet, I'll do that soon and let you know!
     
    Jaro likes this.
  16. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
    @Jaro I've tested it today in 2D world and it doesn't work well out of the box. I've just spent a couple of hours on it in 2D worlds and managed to have it working in part but there still is something wrong so that would take some time; sorry about that but at the moment it only works well in 3D worlds.
     
  17. Jaro

    Jaro Avid Boxer

    Joined:
    Sep 21, 2018
    Messages:
    355
    Likes Received:
    116
    it's a pity but thank you very much for the information. maybe I will use it someday in 3D.
     
  18. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
    @Jaro Hey there! I've just fixed the last issue with 2D worlds so now the pathfinder works in both 3D and 2D worlds, I'm going to publish an update in a day or two, meanwhile here's a clip of the pathfinder at work in a 2D world.
     
  19. Ivan Perfetti

    Ivan Perfetti Avid Boxer

    Joined:
    Sep 9, 2018
    Messages:
    167
    Likes Received:
    166
    Hey there! I managed to publish an update today to fix 2D Worlds support.
    You can download it here: https://indym.itch.io/pathfinder-for-buildbox-3.
    @Jaro Now 2D worlds are fully supported!
    The demo BBDOC has been updated as well, now it features both a 3D demo and a 2D demo; you can select which one to play at startup.

    CHANGELOG
    1.1.0 (August 29, 2021):
    Added support for 2D Worlds, updated demo BBDOC and system requirements.
     
  20. Jaro

    Jaro Avid Boxer

    Joined:
    Sep 21, 2018
    Messages:
    355
    Likes Received:
    116
    Great message. Many thanks
     
    Ivan Perfetti likes this.

Share This Page