Page 1 of 1

Add pathfinding API

PostPosted: Wed Dec 12, 2012 16:07
by aldobr
Pls add pathfinding api to Lua API.

We can do pathfinding using Lua already, but i believe this should be done in C++ (for speed).

Something like :

minetest.env:find_path(from, to)
-- Returns a list of tuples containing X, Y, Z step coordinates.

PostPosted: Wed Dec 12, 2012 16:15
by thetoon
If such a thing comes to life, we'd need to keep it adaptable. We should be able to pass parameters about whether or not the pass could cross water, or jump one block high, or....

PostPosted: Thu Dec 13, 2012 12:53
by rubenwardy
I suggested this awhile ago

PostPosted: Thu Dec 13, 2012 13:46
by jojoa1997
What is pathfinding api?

PostPosted: Thu Dec 13, 2012 14:41
by thetoon
jojoa1997 wrote:What is pathfinding api?


A pathfinder is a programming routine that gives the shorter path between two points (given a number of obstacles and associated rules). And as soon as we'll want to have "smart" mobs/NPCs, we'll want them to "move around trees" instead of getting stucked.

Depending on how it's done, it could be rather resource-hungry, and thus would greatly benefit from a native implementation. In the meantime, it should be perfectly doable in Lua.

PostPosted: Thu Dec 13, 2012 15:01
by jojoa1997
So it is like a shortcut to an app.

PostPosted: Thu Dec 13, 2012 15:16
by thetoon
jojoa1997 wrote:So it is like a shortcut to an app.


Err... not at all. Here we're not talking "path" in the common computer sense, but rather in the "geographic" sense. See http://en.wikipedia.org/wiki/Pathfinding for more information.

PostPosted: Thu Dec 13, 2012 15:38
by aldobr
minetoons can only jump one block at a time

so the heuristic function should return impassable if the path needs a two block jump.

PostPosted: Thu Dec 13, 2012 16:10
by jojoa1997
Thanks for the link. I understand it now. All ways wondered what it was.