Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Pathfinding: Filling a matrix with numbers

Credits go to anonymous, CGamesPlay, Don Freeman, Goalie Ca, jason perkins, Johan Halmén, Neil Walker, piccolo, Schyfis, Thomas Fjellstrom, tobing, Trent Gamblin, weapon_S, and X-G for helping out!
This thread is locked; no one can reply to it. rss feed Print
 1   2 
Pathfinding: Filling a matrix with numbers
Felix-The-Ghost
Member #9,729
April 2008
avatar

Oh gosh I recognize that first image. I made it, but I just made it in MSPaint as an illustration as I have no real idea how to efficiently do things like this. Although I quite suddenly thought of a way to do so, probably not efficient, so oh well.

I might have messed up on it but I think it'd span out and if an adjacent square had a lower number it'd leave it alone. Note I don't know much about this.

==========================
<--- The ghost with the most!
---------------------------
[Website] [Youtube]

adam450
Member #5,460
January 2005

Thats a horrible example. I'm going to post this like just because its a better version of what your looking at, you can also download the thing to mess with.

http://www.gamedev.net/reference/articles/article2003.asp

At any rate, I'm not sure what those numbers are. My best guess is that they are the distance traveled from the start node. Hence a diagonal jump from 4 to 6. In a triangle, the hypotenuse(diagonal) is greater than the two sides.

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

At any rate, I'm not sure what those numbers are. My best guess is that they are the distance traveled from the start node. Hence a diagonal jump from 4 to 6. In a triangle, the hypotenuse(diagonal) is greater than the two sides.

You would know, if you looked at the example I posted ::)

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Don Freeman
Member #5,110
October 2004
avatar

Here is a graphic that might help you understand A*:

{"name":"597685","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/e\/eee99214ab9cde24c0c837264164ed89.gif","w":800,"h":505,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/e\/eee99214ab9cde24c0c837264164ed89"}597685

--
"Everyone tells me I should forget about you, you don’t deserve me. They’re right, you don’t deserve me, but I deserve you."
"It’s so simple to be wise. Just think of something stupid to say and then don’t say it."

 1   2 


Go to: