A* Native Extension

I think all fixed now. You can test it from dev branch:

https://github.com/selimanac/defold-astar/archive/dev.zip

I was using astar.reset() just for development purpose only and this is why I wasn’t exposed it to the documentation. It is different then astar.reset_cache(). It removes all the data and the Map class internally. I fix it is bugs. It should be safe to use if you want to free some memory. But I believe it is not necessary. Also astar.reset() delete the Costs array. It must be set. Otherwise proper error occur which describes the situation.

astar.reset_cache() will not crash the engine anymore. Actually you don’t need to call it before changing map state using astar.set_map(). astar.set_map() calls reset cache internally.

You were right, It was about the world bound check for early exit. It is fixed now. (At least as far as I can test)

This is not related to your issue but It was returning nil caused by other issue. It was returning SOLVED and nil before when there is only tile itself as a solution. It will return NO_SOLUTION now.

There isn’t any breaking changes but I made a few more fix.

I try to test every circumstances which I can think of.
Here are the test files on dev branch:

3 Likes