• Welcome to Randomland - The Forum. Please login or sign up.
 
May 03, 2024, 05:11 AM

News:

Get Out, See Green!


Javascript A* Pathfinding

Started by Brad, Jun 02, 2013, 12:19 AM

Previous topic - Next topic

Brad

So I've finished the first phase of my Javascript A* pathfinding algorithm. It is viewable here http://game.randomland.net/astar/.

After I get back from yurting (is that a verb?) at the beach I'll continue on my next phase where I add weighted tiles (for such things as areas which are more difficult to travel through), making it so that you can't fit diagonally through two blocking squares, and influence mapping!

The last one is pretty cool because you can use it to make the AI be less dumb by influencing their mapping. For example if you were creating a strategy game and the AI units kept getting killed at a certain point, you'd influence the calculated "cost" of that area so that units would start taking longer but safer paths.

All that stuff is relatively easy, so I should have some more soon (after yurting).

Nick


zourtney

Wow, that is way cool indeed. The first time, I tried it on my phone and it was "way abysmal" (something weird with not registering the clicks in any way that made sense). It'd also be cool to build out an example of that good old separating-axis (hi-ya!) theorem. That stuff was fun...in it's own way.

...I haven't had a chance to mess with canvas much, but the API always looked pretty easy.

Brad

Sorry the JavaScript is not setup to work correctly on touch screen devices. Mostly because I am too lazy to test it.

Nick


zourtney

But but, but my phone has IE. Everything always works perfectly in IE! :P

Brad

Not sure the mobile version of IE fully supports HTML5.

zourtney

Likely not. But everything drew fine, actually. It was just hard to get it to register clicks (almost like it was firing two events). But yeah. That's a cool demo. I didn't read the code (yet), but it looked relatively short and followable

Nick

Cant get Firefox or Opera on Phone 8?

zourtney

I checked, and no. But I hadn't really ever tried before you asked. In all honesty, the browser does pretty well most of the time...unlike that Android phone I tried using for a few weeks, which would crash the browser any time you rotated the device. But that phone was very, very special.