A* Pathfinder Routine

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
el_stupido
Posts: 24
Joined: Tue Jun 23, 2009 9:38 am

A* Pathfinder Routine

Post by el_stupido » Wed Dec 23, 2009 2:08 pm

anyone ever had a go at it in this language? I've got a pretty good handle on what's got to happen in it. I'm just mustering up the strength to actually code it. It's going to take a sustained period of concentration if you know what I mean.

Anyone done it already and want to share their take?

Heyyy. Merry xmas from Australia. Just turned 12am :P

El Stupido

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Re: A* Pathfinder Routine

Post by BvG » Wed Dec 23, 2009 11:15 pm

I have done 3 versions up to now. Why do you want to make one?
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

el_stupido
Posts: 24
Joined: Tue Jun 23, 2009 9:38 am

Re: A* Pathfinder Routine

Post by el_stupido » Tue Dec 29, 2009 10:00 am

BvG wrote:Why do you want to make one?
To get to the other side.

ha ha.

I have a 12 by 12 grid and I want NPCs and PCs to be able to move thru the maze.

making a hobby game.

el_stupido
Posts: 24
Joined: Tue Jun 23, 2009 9:38 am

Re: A* Pathfinder Routine

Post by el_stupido » Thu Dec 31, 2009 2:19 am

BvG wrote:I have done 3 versions up to now. Why do you want to make one?
oh come on now, don't be shy, tell me more about these '3' versions you've done up to now.

even better: share one
:)

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: A* Pathfinder Routine

Post by Mark » Thu Dec 31, 2009 3:09 am

Oh... come on, don't be shy, tell us why you want one ;-)

Probably, if you tell us why, BvG can decide better which version to share with you.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

el_stupido
Posts: 24
Joined: Tue Jun 23, 2009 9:38 am

Re: A* Pathfinder Routine

Post by el_stupido » Fri Jan 01, 2010 12:49 pm

hello mark, happy new year. Hey I thought I had said why I wanted one when I said I'm making a hobby game with a 12 by 12 grid and I want NPCs to move thru the maze.

as to the why I was hoping someone would share. I just want to learn how to do one. As I said, I am mustering up the courage to take it on. For my level of programming skill and experience, getting A* work is essentially my K2 (the mountain).

So the why I guess is me reaching out going "say, anyone got any tips? and or code they've done."

I am writing the hobby game for my little brother and I. game has an audience of one.

I'm intrigued by how someone else has done three of them, as I find the task of making one daunting

:oops:

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: A* Pathfinder Routine

Post by Da_Elf » Wed Jul 20, 2016 11:15 pm

After a while of putting it off i tried it. im using a 5px grid. I DEFINITELY need to optimize. click on run it and wait.. and wait.. and wait.,

http://www.elfpro3d.com/livecode/MazeRunner.zip

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: A* Pathfinder Routine

Post by FourthWorld » Thu Jul 21, 2016 1:03 am

Da_Elf, I was hoping I might try my hand at optimizing that, but it's a standalone. Are you in a position to share the source?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: A* Pathfinder Routine

Post by Da_Elf » Thu Jul 21, 2016 1:08 am

mine is currently using a grid of rectangles that are built and each graphic is used in the calculations. i need to change it to use pixel locations as nodes in the openSet and closedSet

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: A* Pathfinder Routine

Post by Da_Elf » Fri Oct 13, 2017 1:20 am

Here is my original code. Really sucky. Im going to try to give this another go but rather than setting up a predone grid i want to get pixel points on the fly. i used to use a program called Adventure game studio. You would create am image which would be called the "walkable area" it wouldnt show up in the final but it would be used to calculate the walkable and non-walkable area for pathfinding. If i used a black and white image as my walkable image and i was testing pixels to see if its black or white i could do the same as the grid but quicker since i would only be testing the neighbouring pixels on the fly as needed as opposed to at the start with a full grid of everything

dont know if any of that made sense,
Attachments
A Star Test2.zip
(14.26 KiB) Downloaded 181 times

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: A* Pathfinder Routine

Post by Da_Elf » Fri Oct 13, 2017 9:37 pm

my latest version rather than build a grid for an entire place to see whats walkable and whats not im going to just build nodes as i work my way through.

Post Reply

Return to “Talking LiveCode”