Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / A* pathfinding library

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Jun 2013 22:33 Edited at: 22nd Jun 2013 22:35
After a brief discussion with someone on the TGC facebook page, I decided to port IanM's pathfinding code to AGK.
http://forum.thegamecreators.com/?m=forum_view&t=11137&b=6





You have the following search methods:
SearchMapAStar8()
SearchMapAStar4()
SearchMapFlood8()
SearchMapFlood4()


For the most part, everything works flawlessly, except that I get an out of bounds error when restricting diagonals with the Flood8 call. I'll try to track it down, but in the meantime the other 3 methods work just fine.

Anyone want to test the speed on some mobile platforms?


Press A and B to set the source and target points. Left mouse button will mark cells as unwalkable, Right mouse button will erase them.


Demo Code




Pathfinder library code


Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd Jun 2013 22:53
Very cool!

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Lost Dragon
13
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 22nd Jun 2013 23:01
Wow, nice. Thanks to you both!
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 23rd Jun 2013 02:42
I'll have a look when I can on my android (for speed results). You should do a video going through explaining what you are doing in the code Looks nice!

Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 23rd Jun 2013 13:12
Nice. For anyone not sure, this guide here

http://www.policyalmanac.org/games/aStarTutorial.htm

provides an exceedingly easy explanation of the A* method. I managed to code a routine from scratch in 10 hours using this with no prior knowledge....that's just how good the guide is! Lol. Will make this excellent code submission clearer for those who don't know what A* is.
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 23rd Jun 2013 13:39
Sweet, thanks

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Jun 2013 18:33
I started with that guide then remembered Ian's library I used in the past. For the most part, all was needed to convert to agk was change arrays from () to [] and remove the matrix1 commands.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 24th Jun 2013 00:08
Be sure to add it to the agk codebase.
Its at the same Place as the dbp one and you simply select agk as language.
Iam using Another Pathfinder currently by Another fellow agk user that i cant remember the name on right now ?

But his method whas completely differrent to yours

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Jun 2013 04:45
Quote: "Be sure to add it to the agk codebase."

Done. I didn't know the codebase was still around.

haliop
User Banned
Posted: 24th Jun 2013 11:01
comeon wheres the speed test resutls?!

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Jun 2013 11:11
In the screenshot! 5ms for that example.

leo877
16
Years of Service
User Offline
Joined: 6th Mar 2008
Location: san antonio, tx
Posted: 5th Jul 2013 22:01
@phaelax and others tgc forums

theres is another pathfinder in code base by Author: pedrolbs Simple Pathfind - AppGameKit that i found when i first got AGK.The code is list in the code section on page 2.
http://www.thegamecreators.com/?m=codebase_view&i=b496ae7bec039ca2806967d3443fd672
haliop
User Banned
Posted: 6th Jul 2013 21:46
thats a cool AI path system Leo877 just tested it , its pretty good
theres also an IsoMetric Path Finding by the same author.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th Jul 2013 22:52
I would think that isometric wouldn't be any different.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 7th Jul 2013 13:09
Iam using a strongly modified version of the pedrolbs Pathfinder.

But i also like phaelax doing his own conversion of ian ms.

We cant get enough of them as we can learn something from every code sample that is posted.

code,share and learn is my moto

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz

Login to post a reply

Server time is: 2024-05-01 05:53:00
Your offset time is: 2024-05-01 05:53:00