Pieuff ! A* PathFinding kill me !

Show off your games, demos and other (playable) creations.
Post Reply
Neolitik
Citizen
Posts: 55
Joined: Sun Jun 28, 2009 3:13 pm

Pieuff ! A* PathFinding kill me !

Post 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 !
Attachments
Pathfinding.love
(1.59 KiB) Downloaded 223 times
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Pieuff ! A* PathFinding kill me !

Post by TechnoCat »

I can place all the walls and set the start and end point, but I don't see any paths being found?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Pieuff ! A* PathFinding kill me !

Post by Robin »

It's really hard to see what you're doing since the walls don't show.
Help us help you: attach a .love.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Pieuff ! A* PathFinding kill me !

Post 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
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Pieuff ! A* PathFinding kill me !

Post by Jasoco »

See, if I could figure this out too I'd put mouse control in my game as well.
User avatar
Almost
Prole
Posts: 42
Joined: Fri Aug 21, 2009 8:04 pm
Location: Canada
Contact:

Re: Pieuff ! A* PathFinding kill me !

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests