#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# A new kind of pathfinding.

Posts: 100Member
edited June 2014

So I stumbled upon @StormyStudio 's (successful) attempt at A* pathfinding, and I was inspired. I'm currently in the process of developing a completely new kind of pathfinding, (or it might not be new, IDK) which somewhat works at the moment. I'll begin by explaining the process. I have a 9x8 grid filled with empty nodes. When I press a special magic button, the nodes sense walls around them and with specific patterns of code can identify if there is a wall to their left, right, top, and bottom. These nodes, having been identified, now spawn actors above them to tell the player where to move. Videos are attached.

Demo video (yellow = two walls, green = one wall, white = no walls, red = three walls):
Video 1: http://tinypic.com/r/10zoi2q/8

But how does this all work in the deep dark bowels of my code? I'll elaborate. It all revolves around children of the nodes which I lovingly named feelers. Each individual parent node has an identity number, and the children feelers share this same ID number. The node sends the feelers out in all four directions, by an offset of 45 pixels, so each feeler goes to the parent node's neighbor. This picture illustrates the concept: (for argument's sake the black box represents a node, the numbers represent feelers and the brown block represents a wall):

Each node sends out these feelers. When a feeler registers that a wall is on top of it, it changes a zero value in a table to the number 1, representing a boolean. The row of the table is the ID number so parent can reference it, and the column is where the node is located. Like in the picture, the feeler labeled one represents the X feeler, so it goes to column number one, so say if feeler four was tripped it would go to column four. With more code, I convert the four columns into a combination.

Looking at the picture, that node's code would be 1000 because there is a wall in position one. If there were two walls, one on three and one on two, then the combo would be 0110. All four nodes triggered is 1111 and no nodes triggered is 0000. Once I've obtained the special combo, the sky's the limit. You can implement pathfinding, animations, and maybe even make a game out of it. The last video is of the code working in real time.

If anyone has any ideas regarding highlighting the simplest path, I'd love to hear them. Any other suggestions are welcomed with open arms. If anyone would like to take a look at the source code, I can post it here - just let me know.

Video 2: http://tinypic.com/r/2iu2ow1/8

• Posts: 2,820Member, Sous Chef, PRO

Very, very cool!

It looks like you are doing very well following your own creative initiative. Keep going!

• Posts: 100Member

@RThurman thanks

• Posts: 2,867Member

Wow that looks fast! Nice work.

• Posts: 100Member

Finally got all the pathfinding work done. Although its not really finding paths, IT IS automated motion, and pathfinding can be implemented with some little tweaks. This is all real time too, so no pre-mapping needs to be done!