I need advice on how to create a previsualization of all areas my character can move to.

OK so this one will take a little while to explain, so apologies for the length of this.

For now assume I am creating a turn-based strategy game for PC. When a unit is selected, the player has the option to move that unit, and that unit has a certain maximum distance they should be able to move that turn. I am specifically trying to avoid making the game use a grid, or hexagonal grid system, so the distance that the unit can cover should be thought of in metres, rather than in ‘tiles’.
When I select a unit, I then have the option to click somewhere else to command that unit to move there. So when the unit is selected, I would like to create a system to highlight all the areas where the unit can move to. This should look like an actual highlight with a nice border to it, rather than just updating the mouse cursor or something.

To complicate matters, if there are objects in the way that cannot be moved through, then the ‘previs highlight’ should account for this.
Lastly, to add further complication, (if possible) I would like if possible to work with 3d undulating terrain, rather than a perfectly flat surface. This is not a deal breaker if I would be forced to use a 2d play area, but I would really like it to be 3d if possible.

The issue I’m having is A) trying to work out how to calculate the area, and then both B) how to use it to limit the unit’s movement, and C) what would be to best way to go about creating the previsualization effect. If you are struggling to understand what I mean by this, both XCOM and Wasteland have good examples for previsualizing your movement for a grid-based game. The problem for me is that I do not want to use a grid. Examples of both of those games below:



I can work out whether a given point is within the unit’s maximum movement range (using gameobjects that store normals information at the corners of each impassable object), but I have no idea how to create ‘an area’ with which to make my previz effect.

Does anyone have any suggestions about how I go about doing this?

NB: I dont mind using a grid based system behind the scenes, but the actual representation of the previsualization must not appear this way to the player, and also the player must not feel like the unit is ‘snapping’ their final destination to certain spots that does not exactly correlate to where the user clicked. This means that the border of the previs should usually be curved, and the unit should be able to move anywhere along that curve, or within the curve.

Honestly, I don’t think this would be so different from many other pathing systems. Create pathing nodes to define general “routes” that can be taken (for instance, hugging walls rather closely), then run through your choice of pathing algorithm starting from the nearest point(s) to the player to determine the maximum distance possible in each given direction to find your general maximums.

The detail and accuracy would then be defined by the number of pathing nodes established. At that point, displaying it could be done in a handful of ways, including building a mesh from the possible end points (as well as an arbitrary grid in the middle to accommodate varied terrain), then displaying it using a shader with “ZTest Always” to make it visible even when buried under terrain.

This might be a little bit expensive to calculate, but there should certainly be plenty of ways to optimize it as well.