https://github.com/selimanac/defold-graph-pathfinder
Find your way back home!
https://github.com/selimanac/defold-graph-pathfinder
astar-algorithm defold-library defold-module pathfinding
Last synced: about 1 month ago
JSON representation
Find your way back home!
- Host: GitHub
- URL: https://github.com/selimanac/defold-graph-pathfinder
- Owner: selimanac
- License: other
- Created: 2025-10-19T19:11:52.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2026-03-15T13:51:04.000Z (3 months ago)
- Last Synced: 2026-03-16T03:06:02.166Z (3 months ago)
- Topics: astar-algorithm, defold-library, defold-module, pathfinding
- Language: C++
- Homepage:
- Size: 12.9 MB
- Stars: 27
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
- awesome-defold - A* Graph Pathfinding - performance A* pathfinding library designed for real-time games and simulations with hundreds to thousands of moving objects. (Libraries / Programming Language)
README

# A* Graph Pathfinding Defold Native Extension
A high-performance A* pathfinding library written in C++11, designed for real-time games and simulations with hundreds to thousands of moving objects. Built with a focus on performance, using flat array data structures and advanced caching mechanisms.
## Discussions & Release Notes
https://github.com/selimanac/defold-graph-pathfinder/discussions
## Documentation
For detailed function descriptions and usage examples:
- [Path API Reference](./API.md)
- [Navmesh API Reference](./NAVMESH_API.md)
## Graph Pathfinder Editor
A visual editor for creating and editing navigation graphs for the Defold Graph Pathfinder extension.
https://github.com/selimanac/defold-graph-pathfinder-editor

## Installation
You can use this extension in your own project by adding it as a [Defold library dependency](https://defold.com/manuals/libraries/#setting-up-library-dependencies).
Open your `game.project` file, select `Project`, and add a stable version from the [releases](https://github.com/selimanac/defold-graph-pathfinder/releases) page to the `Dependencies` field.
## Examples
- Tiny City: https://github.com/selimanac/defold-tiny-city
## Status
This library consists of three parts:
### Pathfinder
The core library. Responsible for managing nodes, edges, and performing pathfinding.
✅ Projected Pathfinding
✅ Static Navmesh Pathfinding
✅ Min-Heap Priority Queue
✅ Path Caching
✅ Distance Caching
### Path Smoothing
Responsible for existing path smoothing.
Currently available smoothing options:
✅ Quadratic Bézier
✅ Adaptive Bézier
✅ Catmull–Rom
✅ Cubic Bézier
✅ Circular Arc
### Navigation
Responsible for enabling agents to navigate along the path.
🚧 **Path Following** - WIP
🚧 **Dynamic Nodes for Agents**
🚧 **Path Invalidation for Agents**
🚧 **Group Assignment for Agents**
🚧 **Group Formation Patterns**
❌ **Collision Avoidance** — Not planned, maybe in the future
## Supported Platforms
- **Desktop**: Linux (x86_64, arm64), macOS (x86_64, arm64), Windows (x86_64)
- **Mobile**: iOS (arm64, x86_64), Android (armv7, arm64)
- **Web**: JavaScript, WebAssembly (via Emscripten)
x86-win32 is not supported.
## Technical Features
- **High Performance**: Optimized for real-time pathfinding with hundreds to thousands of moving objects
- **A* Algorithm **: Classic A* with heuristics for optimal and efficient pathfinding
- **Flat Array Architecture**: Cache-friendly memory layout using `dmArray` from the Defold SDK
- **Path Caching**: LRU cache with version-based invalidation for frequently reused paths
- **Projected Pathfinding**: Supports pathfinding from arbitrary positions, not limited to graph nodes
- **Spatial Index for Large Graphs**: Grid-based spatial indexing for 10-100× speedup in large graphs (>500 nodes)
- **Dynamic Graph Updates**: Add or remove nodes and edges at runtime with automatic cache invalidation
- **Min-Heap Priority Queue**: Custom implementation with zero-copy memory pooling and bulk operations
- **Distance Caching**: Spatial hashing for fast approximate distance lookups
- **No STL Containers**: Uses `dmArray` and `dmHashTable` for all data structures
- **Memory Pre-allocation**: All arrays are pre-allocated at initialization; pathfinding uses only pre-allocated memory
- **No Exceptions**: Uses explicit error codes instead of C++ exceptions
---
### License Summary (not legally binding)
- ✅ Free for personal, educational, and **completely free** games or apps.
- 💲 Commercial use (any monetized game/app) requires **at least a one-time payment of $10 USD (monthly sponsorships are also welcome) via [GitHub Sponsors](https://github.com/sponsors/selimanac)**.
- 📩 Free releases are welcome to share project info (name, genre, date, links).
- 🔒 The Software is **closed-source**; source access may be granted **upon request**.
So basically, if your released project is completely free and non-monetized, no payment or permission is required.
See [License](./LICENSE.md)
---