Note that there are some explanatory texts on larger screens.

plurals
  1. PO2D waypoint pathfinding: combinations of WPs to go from curLocation to targetLocation
    primarykey
    data
    text
    <p>Please take a moment to understand my situation. If it is not comprehendable, please tell me in a comment.</p> <p>I have an ArrayList of Waypoints. These waypoints are not in any order. A waypoint has the following properties:<br> <code>{int type, float z, float y, float x, float rotation}</code></p> <p>This applies to a 3 dimensional world, but since my pathfinding should not care about height (and thus treat the world as a 2 dimensional one), the y value is ignored. Rotation is not of importance for this question.</p> <ul> <li>In this 2 dimensional world, the x represents the x axis and the z represents the y axis.</li> <li>If x increases, the object in the world moves east. If x decreases, the object in the world moves west.</li> <li>If z increases, the object in the world moves north. If z decreases, the object in the world moves south.</li> </ul> <p>Thus, these "new" waypoints can be simplified to: <code>waypoint = {float x, float y}</code>.</p> <p>Now, these waypoints represent the X-axis (x) and Y-axis (z) locations of an object. Moreover, there is a current location: <code>curLocation = {float x, float y}</code> and a target location: <code>tarLocation = {float x, float y}</code>.</p> <p>This is what I want to get:<br> <strong>All combinations of waypoints (aka: paths or routes) that will lead from <code>curLocation</code> to <code>tarLocation</code> <em>under the following strict conditions:</em></strong></p> <ol> <li>The distance inbetween each waypoint may not be bigger than <code>(float) maxInbetweenDistance</code>. This includes the initial distance from <code>curLocation</code> to the first waypoint and the distance from the last waypoint to <code>tarLocation</code>. If no such combination of waypoints is possible, null should be returned.</li> <li>When multiple waypoints are found within <code>maxInbetweenDistance</code> from a waypoint that lead towards the target waypoint, the closest waypoint should be chosen (even better would be if an alternative waypoint that is slightly further away would result in a new path with a longer distance that is also returned).</li> <li>The order of returned waypoint combinations (paths) should be from shortest route (minimum distance) to longest route (maximum distance)</li> </ol> <p>Finally, please consider these points:</p> <ol> <li>This is the only thing I need to do AI/pathfinding wise, which is why I do not wish to use a full blown pathfinding or AI framework. I believe one function should be able to handle the above.</li> <li>If returning all possible combinations of waypoints causes too much overhead, it'd also be fine if one can specify a maximum amount of combinations (but still ordered from closest to furthest). Eg. the 5 closest paths.</li> </ol> <p>How would I achieve this? Any feedback is appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload