Grid pathfinder, possibly RPG later.

(can you believe this took a week? five days of planning before the answer came, and it was sitting in front of my face! Well, here goes.)
I wanted to make a click-goto script. only I needed SOME sort of pathfinding, so I decided on the simplest way. A grid! After pondering about it a while, (and observing my cat’s whiskers) I found my way, and it was a simple as having probes in each square adjacent to the character. Right now it’s still a bit buggy, but here it is: (pardon the lame model, but I personally like simple graphics, and that is my first… humanoid human?)
click-goto.blend (396 KB)

click on the grid, and the program will take a path there, occasionally it makes a strange move, but it corrects itself. anyway, the flower pots (wierd choice of a blocker, aye?) can be navigated around(made sure to get rid of the bug with the equal distances if you go left or right around the flowerpot… both ways are short!).

sorry for all you who want screens, I’ll take some later when there is more enviroment to look at… after all that planning and typing it will be nice to just decorate!

Good work! Yeah, it’s buggy, like I click on the next square, the little man goes on three other squares before going on the one i clicked.

But it’s good!

yeah, it’s a start!

Much better than i can do. Good thinking on this one. I have no idea how I would approach this.

Good job so far, I have a tip for you though. Instead of making the character move while trying to find the path try to store all possible path’s in a list (like [ [0,0,0,1,1], [2,2,4] ] the numbers being directions) and then run the smallest path.

I had an idea to use a text file that represents a level (in grid though) with only 2 characters, one being “passable” and the other “non-passable”. I never tried to work with it though.

Yer, a bit buggy, but this is great! Once you get it worked out itll be really nice.

reminds me alot of runescape with the simple materials and all

@ andrew
hmm, I could have an invisible object make the path… but that would yield about the same results…
@ valek
thats the type of pathfinder I was aiming for.

A* is a pretty nice pathfinding algorithm, this might help: