Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/GlorifiedPig/Luafinding
Fast & easy-to-use A* module written in Lua
https://github.com/GlorifiedPig/Luafinding
love2d lua pathfinding
Last synced: 2 months ago
JSON representation
Fast & easy-to-use A* module written in Lua
- Host: GitHub
- URL: https://github.com/GlorifiedPig/Luafinding
- Owner: GlorifiedPig
- License: mit
- Created: 2021-03-01T06:53:25.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-09-23T15:25:04.000Z (over 2 years ago)
- Last Synced: 2024-08-02T06:16:11.979Z (6 months ago)
- Topics: love2d, lua, pathfinding
- Language: Lua
- Homepage:
- Size: 35.2 KB
- Stars: 31
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-love2d - Luafinding - Class-based A* implementation written purely in Lua. (AI)
README
# Luafinding
Luafinding is an A* module written in Lua with the main purposes being ease of use & optimization.
### Performance Tests
To run a performance test yourself, see `performance/performance.lua`. Move all the Lua files in `src/` to that folder and run `performance.lua` in your console. Here are my performance results:
```md
> luajit performance.lua
Using seed 1614795006
Building 100 x 100 sized map.
Generating 2000 random start/finish positions.
Finding 1000 paths.
Done in 0.309 seconds.
Average of 0.000309 per path.
```To compare, "lua-star" runs at an average of 0.0017 seconds per path on my machine for a 100x100 map; that's an **81.8% improvement** from one of the mainstream Love2D pathfinding methods.
Not to mention that a lot of Love2D implementations also feature a lot of `O(n)` for tables instead of indexing. When testing "lua-star" in Love2D, it ran at about 2 seconds per path - whereas Luafinding, on my machine, runs at 0.00034 seconds per path. That's an **entire 99.98% decrease in computing time.**
### Love2D Implementation
To see an example of how this is implemented in Love2D, navigate to the `love2d-example` folder.
![Luafinding in action](https://user-images.githubusercontent.com/7416288/109854935-546bfd00-7c60-11eb-8476-98308bfeb3c0.png)