Giter Site home page Giter Site logo

adhoc-pathfinder's Introduction

##AdHoc-Pathfinder PayPayl donate button

AdHoc Pathfinder (AHP) is a free and open-source pathfinder solution for use in Unity Applications. It specializes in high performance and low memory overhead for vast->infinite terrain surfaces. AHP calculates a path based on initial conditions without the need for a prebaked or precalculated mesh. Instead, AHP uses an artifical grid and raycasting to determine a position's walkable state.

####Features:

  • Pathfinding without the memory overhead of a baked mesh
  • Can be used on terrain of any size without loss of performance
  • Multi-terrain compatible (I use and recommend TerrainComposer)
  • Automatically detects terrain edges
  • Completely accessible via code (C# now, may translate to JS later)
  • Stupid simple to operate out of the box
  • Outputs raw Vector3 coordinate list rather than forcing you to use it's own movement system

####Planned features:

  • Planetary point-gravity pathfinding compatibility (I can't afford the asset to test yet. ;.; )
  • Multi-level support for voxel terrains (I can't afford a voxel asset to test yet. ;.; )
  • Behavior list (Patrolling, fleeing, etc)
  • Better movement behaviors
  • Better heuristics options

####What does AHP have that other pathfinders don't? AHP is a niche pathfinder. It is designed for people who:

  • Use massive terrains
  • Don't want the memory overhead of a baked mesh

Because AHP generates a grid on the fly, performance is not based on the size of the terrain, rather, it is based on the complexity and length of the desired path. So if your path is 50 units long and it's on a terrain 100x100, it will perform as fast as if it was on a terrain of 100,000x100,000 but it won't use any more memory.

####How does it work? AHP It accepts a maximum slope and "Out Of Bounds" (OOB) tags to create a path on command that fits the requirements. It uses a combination of a predetermined grid (specified by the resolution) and raycasting to conduct the pathfinding.

####Is it the shortest path? Yes and No. It CAN be. For performance reasons, AHP is not designed to always return the shortest path - rather, a path that fits the requirements. However, different Heuristics will be available so the user can balance performance->accuracy as needed.

##How to use

  1. Download the repository
  2. Copy the code files into your Unity Project
  3. Create an "agent" by adding a sphere to your project
  4. Disable to mesh renderer and mesh collider components
  5. Attach the AStarAdHocPathfinder.cs and AStarAdHocSimpleMovement.cs scripts to the agent
  6. Use AStarAdHocSimpleMovement's public method "SetNewTargetPosition(Vector3)" to move to the location

Note that the agent must have a similar Y to the terrain surface. When moving, the agent will follow the terrain at 0-y.

####Projects powered by AHP:

  • Fangs and Claws

If your project uses AHP, please message me (Kivak) on the Unity forums and I will add it to the list.

###Contributions and Donations Rather than charging for AHP, I have decided to offer it for free. However, AHP's development is powered by coffee. Donations of any size are welcome to contribute to the coffee fund - which means more improvements, faster, and an overall better piece of code! If AHP helped your project or you wish to support this project, I would be very grateful for your donation in support. Thank you ahead of time! :)

If you are code-inclined, I also welcome improvements to the function of the code. Please feel free to fork and initiate pull-requests as you are so inclined. Please make sure that your syntax is formatted correctly (identical to how it is in the main code) or I may have to change it.

adhoc-pathfinder's People

Contributors

mrabenhorst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

digitalsanity

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.