Waypoint Script
Posted: August 28th, 2007, 4:32 am
I'm toying with the idea of creating this, but after thinking about it somewhat in my head, I wanted to see if anyone had any better ideas as far as tackling this would be.
UI wise, simple pull down menu allowing user to select a destination and press go. I thought about having static start/stop locations, like the horses are, but that leads to it being a bit more static then I'd like.
Program wise:
road array containing all points on all the roads.
waypoint array containing loc and all connecting waypoints.
When a player presses "go", the idea would be to find the closest road and head directly to it, then map out the best series of waypoints to hit before reaching the destination.
It would start from the end location, and loop through each connecting waypoint to see which one is closer to the player until it finds the path. There are probably more advanced/more accurate ways of doing this, but looking through all the maps, I didn't see any location that would cause a serious problem as most routes are fairly direct. This process should go fairly fast and would only need to be run once and store all the needed waypoints in an array.
For the actual movement, obviously we'd need to follow the "road" (or some other path that isn't going to make you jump off a mountain/get stuck). My concern is that even if I break up the "roads" into different areas (shire, bree, etc), is that it will take up too much time finding the next closest point on the road. I am also concerned about getting stuck in a loop for roads that wind around a hill, fence, or something else, as the player might have to move further from the waypoint in order to get closer to it eventually, which leads more towards a static route, which I wanted to avoid.
Any ideas for a better way of doing it?
UI wise, simple pull down menu allowing user to select a destination and press go. I thought about having static start/stop locations, like the horses are, but that leads to it being a bit more static then I'd like.
Program wise:
road array containing all points on all the roads.
waypoint array containing loc and all connecting waypoints.
When a player presses "go", the idea would be to find the closest road and head directly to it, then map out the best series of waypoints to hit before reaching the destination.
It would start from the end location, and loop through each connecting waypoint to see which one is closer to the player until it finds the path. There are probably more advanced/more accurate ways of doing this, but looking through all the maps, I didn't see any location that would cause a serious problem as most routes are fairly direct. This process should go fairly fast and would only need to be run once and store all the needed waypoints in an array.
For the actual movement, obviously we'd need to follow the "road" (or some other path that isn't going to make you jump off a mountain/get stuck). My concern is that even if I break up the "roads" into different areas (shire, bree, etc), is that it will take up too much time finding the next closest point on the road. I am also concerned about getting stuck in a loop for roads that wind around a hill, fence, or something else, as the player might have to move further from the waypoint in order to get closer to it eventually, which leads more towards a static route, which I wanted to avoid.
Any ideas for a better way of doing it?