Jump to content


Javascript and Pathfinding


5 replies to this topic

#1 jakevfr

    Young Padawan

  • Members
  • Pip
  • 40 posts

Posted 24 September 2006 - 12:18 PM

I'm attempting to figure out how to make a pathfinder for javascript, but all I can find for examples are in other languages, and I can't decode all the code in there. Could someone please direct me towards a javascript pathfinding a)tutorial b)source code

I would greatly appreciate it :P

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 24 September 2006 - 03:19 PM

Could you explain what you mean by pathfinding. When talking about computers and the i-net that could mean any number of things.

#3 jakevfr

    Young Padawan

  • Members
  • Pip
  • 40 posts

Posted 24 September 2006 - 05:15 PM

I mean like finding the shortest route between two things. A* I believe is what I've seen it called.

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 25 September 2006 - 03:30 PM

Are you talking about something like mapquest?? Because i have no idea what an astrick is, or what it's relation to pathfinding is.

If you want something like mapquest, you can use javascript (google does it), but you'll need a server-side language to at one point or another to determine where the two points are that you're looking for, and how you can get between the two points.

#5 jakevfr

    Young Padawan

  • Members
  • Pip
  • 40 posts

Posted 25 September 2006 - 03:49 PM

I mean like your opponent is at 3,1 you're at 7,4. I want the opponent to figure out the best path to get to 7,4 without me having to program exactly what to do.

And I believe it is called A star. I could be wrong though.

#6 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 26 September 2006 - 12:05 AM

Still completely lost, are you talking about points on a coordinate grid now? If so, the shortest distance is a straight line.

If you're talking about how, on a game, you can click on a map and your character will move to the point you clicked and dodge buildings/what ever is in the the way, then i have no idea how that's done. I'm almost positive any similar solution in JS would not be easy though, and you most likely won't find any good material about it on the web (without a really long search).

Edited by rc69, 26 September 2006 - 12:05 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users