Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

OnePathfinding

Discussion in 'Works In Progress - Archive' started by MakakWasTaken, Sep 26, 2015.

  1. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    Forum-Main.png

    I have been working on a pathfinding solution for unity3d and I would like some feedback on it. I have decided to make it open source incase anybody has some improvements they would like to implement.

    Current Version: 1.4.0

    Current Features:
    - A query system to make things more smooth
    - An advanced example which contains smelling (with wind), seeing and flocking.
    - It has been built for procedural terrains
    - Audio Sensors
    - Flying AI for birds and spaceships etc.
    - Spherical grids

    Currently plans:
    - Release on asset store.
    - Real-time object avoidance. (1.5.0)
    - Add Passive state, only flee when attacked. (1.5.0)
    - Add smoothing function for path (To prevent clunky movement)

    Screenshots:
    Screenshot-1.png Screenshot-2.png Screenshot-3.png

    GitHub: https://github.com/Unknown-Studios/OnePathfinding
    Documentation: http://unknown-studios.com/OnePathDocs/
    Webplayer: http://unknown-studios.com/OnePathfinding/
    Website: http://unknown-studios.com
    Website Forum: http://forum.unknown-studios.com

    Any feedback is greatly appreciated.
    - Makak
     

    Attached Files:

    Last edited: Nov 6, 2015
    EliasMasche, kfirmon, mgear and 2 others like this.
  2. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    I have just updated the project with these updates:

    Version 1.1.0:
    - Fixed Scared animals not fleeing combat, but engaging it.
    - Added Audio sensor support.
    - Added AudioScript.cs which can be attached to external audio sources.
    - Added support for spawning multiple gameobjects from Test.cs script.
    - Added option to change how many AIs is spawned by Test.cs
    - Added option on AIData to enable/disable respawning.
    - Added a new example of a scared AI
    - Improved AntiFly script​
    Any opinions or ideas on this project would be gladly accepted.
     
    Last edited: Oct 3, 2015
  3. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    Version 1.1.1:
    - Fixed some hirachy placings which caused some scripts not to work probably​
     
  4. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    Version 1.1.2:
    - Fixed two compiler errors when building.
    - Added Spectator mode to example scene.
    - Fixed Attacks never occuring when using advanced AI script​
     
  5. dudester

    dudester

    Joined:
    Oct 25, 2014
    Posts:
    371
    this is amazing dont understand why no ones commented , ill test this out later on and let you know what i think about , but from what i see it looks great , you should release it on the assetstore even if free.
     
  6. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    My plan for the asset was to release it for free, but I wanted some feedback on it before posting it on the assetstore.

    - Makak
     
  7. dudester

    dudester

    Joined:
    Oct 25, 2014
    Posts:
    371
    i see , if you could can you maybe add a test scene so i know how its all setup cause right now im totally confused
     
  8. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    There is an rampe scene under Plugins/Scene/

    It is called Example
     
  9. dudester

    dudester

    Joined:
    Oct 25, 2014
    Posts:
    371
    I see yes I saw a scene folder but inside is only a script called example.cs, I think maybe when you exported the files the scene got excluded .
     
  10. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    Will tale a look at that, have you tried reimporting the package to check og you have any missing files?
     
  11. dudester

    dudester

    Joined:
    Oct 25, 2014
    Posts:
    371
    ill do that just to double check , also a good tip , add a namespace to your files , cause there is a conflict with a*pathfinding project asset .
     
  12. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    I have a namespace, but it might be the same as A*'s, I will change it just to be sure, will be included in 1.1.3
     
  13. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    Version 1.1.3:
    - Renamed the namespace to "OnePathfinding" instead of "Pathfinding"
    - Added Step by step tutorial to package.
    - Moved flock spawning from AISpawner to the AdvancedAI.
    - Removed unused code.
    - Added more advanced finding food state.
    - Removed regions, as they weren't used for anything.
    - Added feature for automated noise. (A sound that plays from time to time)​
     
  14. dudester

    dudester

    Joined:
    Oct 25, 2014
    Posts:
    371
    great stuff so far , i made a voxel engine for unity and released on the assetstore(still pending review ), im wondering if this will work with it ?
    anyway great work , can't wait to see the polished version on the assetstore.
     
  15. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    I suppose it would work fine. If not please tell what isn't working and I will try to work out a solution for it. :)

    - Makak
     
  16. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    Version 1.2.0:
    - Added flying for AdvancedAI.cs
    - Added Flying AI prefab as an example on how to use AdvancedAI
    - Removed unused code in AdvancedAI
    - Redesigned AdvancedAI Editor to be more organized.​
     
  17. dudester

    dudester

    Joined:
    Oct 25, 2014
    Posts:
    371
    awesome thanks ill test the new version now and let you know how it goes.
     
  18. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    I have just submitted it to the asset store, hoping for a better result this time :)
     
  19. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    Version 1.2.1
    - Added a way more descriptive tutorial on how to install and use.
    - Added Support, File Description, License and About sections to the TUTORIAL file.
    - (AdvancedAI.cs) Moved movement to FixedUpdate instead of Update.
    - (AdvancedAI.cs) Improved perfomance, to be 0.25-0.5ms faster.
    - (AdvancedAI.cs) Fixed one of the StackOverflowExceptions occuring after running the example scene for some time.​
     
    Last edited: Oct 24, 2015
  20. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    Version 1.3.0 (The polisher)
    - Fixed all remaining StackOverflowExceptions
    - Added Documentation to the website: http://unknown-studios.com/OnePathDocs/
    - Made every variable in the plugin documented. If I missed one please feel free to contact me. :)
    - Fixed errors caused by not having the AI tag in the tagmanager. (This tag isn't needed anymore)
    - Relocated the Example scene to Plugins/OnePathfinding/Examples/
    - (AdvancedAI.cs) Fixed scared animals not fleeing.
    - (AdvancedAI.cs) Fixed AI not being percistent enough.
    - (AdvancedAI.cs) Agents in a flock will move towards the master if he isn't visible.
    - (AdvancedAI.cs) Fixed Flying AI agents not looking the direction that they are flying.
    - (GridManager.cs) Fixed bug where A* would continue to search all of the terrain if there wasn't a path between start and end positions.
    - (GridManager.cs) Center is now called Offset, as it was more of an offset than a center for the grid.
    - (AntiFly.cs) Fixed Agents able to fall off the terrain.
    - (AISpawner.cs) Fixed bug which caused some AIs to have the wrong name after being created.​
     
    elias_t likes this.
  21. dudester

    dudester

    Joined:
    Oct 25, 2014
    Posts:
    371
    i must say this is starting to look great , i still haven't had a chance to test this feature out as im doing some collaboration on a voxel terrain , once some more work is done ill test this with the terrain engine im working on.
     
  22. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    Version 1.3.1 (The cleanup)
    - Added documentation for missed variables.
    - (AISpawner.cs) Added variable to set maximum number of active AIs in the scene.
    - (AdvancedAI.cs) Fixed Flying AI not fleeing combat if set to scared.
    - (AdvancedAI.cs) Fixed Flocking not working.
    - (GridManager.cs) Fixed AI was able to have multiple pathrequests queued at a time.
    - (AdvancedAIEditor.cs) Added new label under information named: "Path State" (Replaced "Has Path")
    - (GridManager.cs) Reversed the WalkableMask to be UnwalkableMask.
    - (GridManager.cs) Fixed some errors when drawing the grid when there wasn't any nodes.
    - (GridManagerEditor.cs) Removed some unused debugging code.
    - (Wind.cs) Fixed default value for RepeatRate being 0. (Default: 300)​
     
    Last edited: Oct 25, 2015
  23. trialnterrorgames

    trialnterrorgames

    Joined:
    Feb 20, 2014
    Posts:
    58
    Is there support for spherical maps? Or a way to make a closed spherical grid?
     
    Last edited: Oct 27, 2015
  24. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    I will give it a go in 1.4.0, but I can't promise anything. 1.3.2 is ready for release and will be uploaded shortly.
     
  25. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    Version 1.3.2 (Separation)
    - Fixed missing directional light in example scene.
    - Moved Listen and Smelling features to new components, which can easily be attached. The new components are called Listening & Smelling.
    - Improved setup tutorial.
    - Added example to documentation.
    - Added file types to the CHANGELOG and README files.​
     
  26. dudester

    dudester

    Joined:
    Oct 25, 2014
    Posts:
    371
    just tested this using the example scene , i am really impressed , it even has flying AI as well as ground AI , are you absolutely sure you want this to be free , i mean its excellent and looks like alot of work went into it , either way its awesome , keep it up!
    the thing i like about it is its fully dynamic so it works perfectly for procedural terrains .
    I'm guessing it has obstacle avoidance already in ?
     
  27. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    It doesn't currently support obstacle avoidance for objects that are moving at run-time, it only check for updates in the grid every time you do a rescan of the whole grid.
     
    Last edited: Oct 31, 2015
  28. PhoenixRising1

    PhoenixRising1

    Joined:
    Sep 12, 2015
    Posts:
    488
    Great stuff. I'd pay good money if it had avoidance built in :).
     
  29. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    I will take a look at it in 1.5 or potentially make 1.4 into 2.0
     
  30. mliukka

    mliukka

    Joined:
    Nov 1, 2015
    Posts:
    19
    This is looking amazing! Can you give a quick summary of any differences between OnePathFinding and A* pathfinding? It has some AI functionality (sensing, fleeing) in addition to just pathfinding?
     
  31. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    I am adding spherical grids in 1.4.0 + I think you need to pro version of A* Project to get the Heap optimization (Correct me if i'm wrong), in mine it is included for free, I cannot remember if the A* Project has a queue system so it doesn't have lag spikes, but OnePathfinding has that.
     
    Last edited: Nov 2, 2015
  32. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    The 1.4.0 release is now 75% done and will most likely be released in the upcoming weekend.

    EDIT: The sperical pathfinding is now fully functional, now it just needs some optimizations and then 1.4.0 will be released. I have also chosen to delay the Real-Time Object avoiding to 1.5.0 because of the long wait for 1.4.0.
     
    Last edited: Nov 6, 2015
  33. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    Version 1.4.0 (Planetarium)
    - Removed the need for the movement platform to be a terrain. It can now be a mesh instead.
    - Fixed wrong named label on the GridManager.
    - Added Spherical grids
    - Added new example called Single AI which doesn't have flocking enabled.
    - Renamed Example scene to Plane.
    - (AdvancedAI.cs) Added ability to choose a specific grid.
    - (AdvancedAI.cs) Added option to pause the AI.
    - (AdvancedAI.cs) You can now control the additional components from the new "Components:" menu.
    - (AdvancedAI.cs) Moved all gizmos to this file for more universal showing of the gizmos.
    - (AdvancedAI.cs) Agents is now unable to leave their grid (Plane only)
    - (AudioScript.cs) Fixed a bug which caused the AudioScript only to alert flock members.
    - (Flocking.cs) Added flocking as an external component too.
    - (GridAlign.cs) Added this component to align the agent with the grid.
    - (GridManager.cs) Improved the overall processing rate of the queue.
    - (Listening.cs) Fixed NullReferenceException.
    - (Listening.cs) Moved file to Examples/Scripts as it was part of the AdvancedAI example.
    - (Pathfinding.cs) Improved performance of NodeFromWorldPos.
    - (Pathfinding.cs) Removed NearWalkable as it had terrible performance.
    - (Pathfinding.cs) Removed unused namespace.
    - (Pathfinding.cs) Temporarily disabled Heap as it has some errors in it.
    - (Smelling.cs) Fixed NullReferenceException.
    - (Smelling.cs) Moved file to Examples/Scripts as it was part of the AdvancedAI example.
    - (Wind.cs) Moved file to Examples/Scripts as it was part of the AdvancedAI example.​
     
    Last edited: Nov 6, 2015
  34. trialnterrorgames

    trialnterrorgames

    Joined:
    Feb 20, 2014
    Posts:
    58
    This is looking really cool. Especially the spherical grids look really great!

    Is it possible to create an interface for coders to easilly add grids of their own making? I suppose you have a list of nodes, and a list of connections per node. It would be amazing if it were possible to just give users the choice between your options OR an option that they implement themselves. This saves you the trouble of having to account for every type of grid people want to play around with, making this framework amazingly versatile.

    I can't wait for the real-time object avoiding!
     
  35. trialnterrorgames

    trialnterrorgames

    Joined:
    Feb 20, 2014
    Posts:
    58
    Some questions:

    - Am I correct in assuming that the function private IEnumerator ScanA(GridGraph grid) in GridManager.cs actually creates the grid?
    - The spherical grid doesn't have a size to be set, however this size is used in ScanA for creating the grid. So the spherical grid used a default size?
    - If I understand correctly: For the spherical grid you are using 6 planes (spherical cube), and each of these planes have a different GridIndex. I assume this is so you can avoid having to account for complex shapes, and keep everything in the planar space? Why not use a UV-mapping approach so you can keep everything on the same GridIndex?
     
    Last edited: Nov 16, 2015
  36. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    1. You can create a grid through code by creating a new GridGraph class and then adding it to Gridmanager.grids.Add(GridGraph) I will include a function to add a new grid in the new version.
    2. The spherical grid uses the NodeWidth or NodeRadius variable under the GridManager (I don't quite remember what I called it and I don't currently have access to my computer.)
    3. Yes it is, it is because creating a 3 dimensional grid will result in a array with 650000000 length which isn't allowed and it way to hard to map, so using this work-around is way easier and gridIndex defines what side of the sphere the node is on.
     
    Last edited: Nov 19, 2015
  37. MakakWasTaken

    MakakWasTaken

    Joined:
    Mar 26, 2015
    Posts:
    45
    I am around 80% done with the realtime object avoiding, and it will most likely be released either tomorrow or on sunday. I only need to do a couple of tests on the sphere grid.