## So I experimented with pathfinding

A spot for all things TestTube
wtg62
Posts: 174
Joined: Mon Jan 27, 2014 11:30 pm
Location: Texas, United States

### So I experimented with pathfinding

And... I'm very happy with the results!
https://dl.dropboxusercontent.com/u/556 ... star2.html

Now I understand the A* algorithm!
This message has been brought to you by wtg62, duh!

testtubegames
Site Admin
Posts: 1078
Joined: Mon Nov 19, 2012 7:54 pm

### Re: So I experimented with pathfinding

Nice! That works great. I'm especially a fan of the 'go to mouse' setting. It's like I'm being chased by someone unrelenting.

wtg62
Posts: 174
Joined: Mon Jan 27, 2014 11:30 pm
Location: Texas, United States

### Re: So I experimented with pathfinding

Thanks!

I'm a fan of using Math.random() as a heuristic.
Not because it's efficient, but it looks cool.
This message has been brought to you by wtg62, duh!

testtubegames
Site Admin
Posts: 1078
Joined: Mon Nov 19, 2012 7:54 pm

### Re: So I experimented with pathfinding

Whoa - thanks for pointing me in the direction of Math.random(). I wasn't too familiar with pathfinding - and it sent me down the rabbit-hole of reading about heuristics. (For instance, at first I was expecting this to be a random walk, which clearly it wasn't... quite.)

Interesting stuff. And I like how your tool helps me investigate the differences really easily. aka: "Huh, would Manhattan vs. Actual Distance be all that different? Let me run it and find the distance each takes."

wtg62
Posts: 174
Joined: Mon Jan 27, 2014 11:30 pm
Location: Texas, United States

### Re: So I experimented with pathfinding

testtubegames wrote:Interesting stuff. And I like how your tool helps me investigate the differences really easily. aka: "Huh, would Manhattan vs. Actual Distance be all that different? Let me run it and find the distance each takes."
Yeah, and I learned that a whole lot of times, Manhattan and Actual are very similar in move cost!
Pretty cool, huh?
This message has been brought to you by wtg62, duh!