]> git.lizzy.rs Git - lua-star.git/blobdiff - README.md
3D Support
[lua-star.git] / README.md
index 4f22b84ccd35fc5fcae6050517cc6e6e14fc37dd..7390102734f3525dec32d07a003f1d25005e04fa 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,8 +1,10 @@
 # lua-star
 
-Easy A* path finding for Lua
+[![Build Status](https://www.travis-ci.com/wesleywerner/lua-star.svg?branch=master)](https://www.travis-ci.com/wesleywerner/lua-star)
 
-[lua star example screenshot](example/lua-star-01.png)
+Lua-star is a pure Lua A* path-finding library.
+
+![lua star example screenshot](example/example.gif)
 
 # Quick Start
 
@@ -15,7 +17,7 @@ Easy to use, it will make you more attractive and you feel sensual doing so.
         return mymap[x][y] == walkable
     end
 
-    local path = luastar:find(width, height, start, goal, positionIsOpenFunc, useCache)
+    local path = luastar:find(width, height, start, goal, positionIsOpenFunc, useCache, excludeDiagonalMoving)
 
 `path` will be false if no path was found, otherwise it contains a list of points that travel from `start` to `goal`:
 
@@ -38,10 +40,12 @@ Lua star does not care how your map data is arranged, it simply asks you if the
 
 `useCache` is optional and defaults to `false` when not given. If you have a map that does not change, caching can give a speed boost.
 
-If at any time you need to clear all cached paths;
+If at any time you need to clear all cached paths:
 
     luastar:clearCached()
 
+`excludeDiagonalMoving` also optional value  defaults to `false`. If you want to exclude the possibility of moving diagonally set the value `true`. i.e, by default, diagonal movement is **enabled**
+
 # Requirements
 
 * [Lua 5.x](http://www.lua.org/)
@@ -60,6 +64,24 @@ Unit testing is done with busted, the `.busted` config already defines everythin
 
     busted
 
+# Performance
+
+There is a performance measurement tool in `tests/performance.lua`, it calculates the average time to find a path on a large, random map.
+
+    # copy the lib to tests
+    $ cp ../src/lua-star.lua .
+
+    # measure performance
+    $ lua performance.lua
+    Running with seed 1540584306
+    Building a map of 3000x3000...
+    Precalculating 6000 random start/goal positions...
+    Finding 1000 paths...
+        Done in 16.37 seconds.
+        That is 0.0164 seconds, or 16 milliseconds, per path.
+        The map has 9.0 million locations, with about 65% open space.
+
+
 # Example
 
 There is an [interactive example](example/main.lua) that can be run with [Love](https://love2d.org).