This lib has those inconveniences (the flexibility part; I don't know about the speed) because it is coupled with a particular map implementation. As soon as you get out of those needs, it's just not flexible enough.
I'm not saying this to bash Roland; he's sharing a lib so others can use it, and that's great. I actually started doing my own A*, but doing it "the flexible way" takes some effort - I still haven't finished.
Maybe you guys want to give a look at TSerial. I just gave it a cursory look myself. At the very least it uses threads, which is something Jasoco is requesting.
LuAstar, a simple A* pathfinding class
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: LuAstar, a simple A* pathfinding class
When I write def I mean function.
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: LuAstar, a simple A* pathfinding class
I think you mean TLpath?
I will remark that my implementation, while maybe not being perfectly easy to use (I tried, though! It's a very tough problem!), is quite optimal in the path-finding itself (or so I believe).
I will remark that my implementation, while maybe not being perfectly easy to use (I tried, though! It's a very tough problem!), is quite optimal in the path-finding itself (or so I believe).
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: LuAstar, a simple A* pathfinding class
I was thinking of taking the LuaStar code and dissecting it and implementing path finders into my "person" objects so the part that does the finding can be run in stages from within their update function instead of in a closed loop that pauses the code. So basically it'll be the person will just stand still while it thinks, and then will move. At least it wouldn't freeze the rest of the game for every person.
This of course means figuring out exactly how it works at the code level.
This of course means figuring out exactly how it works at the code level.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: LuAstar, a simple A* pathfinding class
I meant TLPath. I got distracted by the other link to TSerial, apologies.Taehl wrote:I think you mean TLpath?
I will remark that my implementation, while maybe not being perfectly easy to use (I tried, though! It's a very tough problem!), is quite optimal in the path-finding itself (or so I believe).
When I write def I mean function.
Re: LuAstar, a simple A* pathfinding class
You probably already saw this around. For sure this can help you (a lot) if you want to do it from scratch or improve one.Jasoco wrote:I was thinking of taking the LuaStar code and dissecting it and implementing path finders into my "person" objects so the part that does the finding can be run in stages from within their update function instead of in a closed loop that pauses the code. So basically it'll be the person will just stand still while it thinks, and then will move. At least it wouldn't freeze the rest of the game for every person.
This of course means figuring out exactly how it works at the code level.
http://www-cs-students.stanford.edu/~am ... html#paths
Re: LuAstar, a simple A* pathfinding class
I tried to use this library to generate a tile-based map with a walkable path (tile number 2 is walkable), but I get the following error:
The code in function.lua (the file that generates the error (and the map) is this:
Link to the .love file: http://dl.dropbox.com/u/15081595/Doesn%27t%20work.love
Code: Select all
Error: ./lib/astar.lua:39: attempt to compare number with table
stack traceback:
./lib/astar.lua:39: in function 'inBound'
./lib/astar.lua:233: in function 'setInitialNode'
./lib/functions.lua:16: in function 'create'
Code: Select all
function map.create()
for y = 1, tilemap.h do
map[y] = {}
for x = 1, tilemap.w do
map[y][x] = math.random(1,5)
if map[y][x] ~= 5 then
map[y][x] = 1
else map[y][x] = 2
end
end
end
astar(map)
map.start = {math.random(tilemap.w),math.random(tilemap.h)}
map.goal = {math.random(tilemap.w),math.random(tilemap.h)}
-- If I uncomment the lines below, I have the error...
astar:setInitialNode(map.start)
astar:setFinalNode(map.goal)
enemies.path = astar:getPath()
if not enemies.path then
love.graphics.print('Loading...',0,0)
map.recreate()
end
-- If I uncomment the lines above, I have the error...
end
function map.recreate()
map.create()
end
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: LuAstar, a simple A* pathfinding class
I've been working on this one. I've re-started it from zero.
Actually I am trying trying to have Jump Point Search working.
It works fine, but there are still some odds with diagonal moves.
I'll give heads up soon.
Actually I am trying trying to have Jump Point Search working.
It works fine, but there are still some odds with diagonal moves.
I'll give heads up soon.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Who is online
Users browsing this forum: No registered users and 4 guests