Page 1 of 1

Pieuff ! A* PathFinding kill me !

Posted: Sun Aug 16, 2009 6:55 pm
by Neolitik
hello

I have spend lot of time to unsderstand A* algo !! for path fiding !
I code this ( not optimised lol , to tired for remake it !! )
for lovequest ! :o


mouse left + s = Place start
mouse left + e = Place End
mouse left for draw wall !
Space for run algo !
r for restart
b y !

Re: Pieuff ! A* PathFinding kill me !

Posted: Sun Aug 16, 2009 7:59 pm
by TechnoCat
I can place all the walls and set the start and end point, but I don't see any paths being found?

Re: Pieuff ! A* PathFinding kill me !

Posted: Sun Aug 16, 2009 8:02 pm
by Robin
It's really hard to see what you're doing since the walls don't show.

Re: Pieuff ! A* PathFinding kill me !

Posted: Sun Aug 16, 2009 8:50 pm
by TechnoCat
Robin wrote:It's really hard to see what you're doing since the walls don't show.
The walls show on mine, it draws a rectangle for when you click. But when I press space I get a LOVE error.

Edit: I got it to do stuff. You just have to move it out from the edge. Apparently it checks outside the screen and results in a nil value.
Image
Image

Re: Pieuff ! A* PathFinding kill me !

Posted: Sun Aug 16, 2009 9:09 pm
by Jasoco
See, if I could figure this out too I'd put mouse control in my game as well.

Re: Pieuff ! A* PathFinding kill me !

Posted: Sun Aug 23, 2009 8:19 pm
by Almost
Hmm, that's neat. I've had some success with my own a* pathfinding implementations, although it's cool to see what it's outputting other than just the path.

Also, there's one thing that seems to be missing: if there is no valid path, your algorithm currently locks up in a while loop.
You have to add something so that if the "open list" is empty, it gives up (every tile that can be reached, has been reached).
Oh yeah, and as TechnoCat pointed out, you ought to check if the x and y of a spot is on the screen when you're checking if it's walkable


Your code confuses me as to which language you speak; all of the functions and variables seem to be english words, yet the comments are french.