Creating a visual field within a maximum travel distance?

Godot Version

v4.7.1 stable official

Question

Hello! I’m working on a 3D tactics/strategy game with no tile system; just free movement within a set movement distance. I tried finding examples of this online for Godot, but couldn’t find anything outside of setting up basic navigation.

I’ve got the movement distance constraints set up on the player character, but I want to visualize the available movement area to the player.

In theory, I’d want to wrap a metaphorical “string” around the objects blocking straight lines of movement and combine it with the edge of a circle (uninhibited movement range) to visualize the edge of the distance a player can cover.

Although I think the idea is quite straightforward, for easier explanation, think “distance” vs “displacement.” Moving to the other side of a wall might take 100 steps (distance), but in the end, you’re only about 10 steps from your starting position (displacement)

A crude visualization:

Looking at the visualization, I’m asking how to join all the red dots and the edges of the obstacles in the way into one visual “edge.”

I truly want to implement this feature, rather than abandoning my original idea! If anyone has any ideas or resources that could help, it would be greatly appreciated! Thanks in advance!

Is the game turn-based? How often does this need to update?

Thanks for the fast response!

To answer your question, it is a turn based game, and this should only need to update a few times per turn: Once at the start of a turn, and then maybe additional times if the player climbs a ladder or uses something else that updates or recenters their movement range.

That being said, I’ve settled on a different movement system, but would still love to hear a solution on how to implement this visualization!

Since you want it to “wrap around the corners” the only way I can think of is to quantize the floor into a grid of sufficient granularity and calculate the reachability of each cell in a range. Store that into a bitmap where each cell corresponds to a pixel, blur and threshold it to smooth the edge and project the bitmap onto the floor.

What are describing is usually called an isochrone or geodesic distance field over the navigation mesh. A circle measures displacement you need shortestpath distance.
For turn based games , practical is to sample points around the unit, snap them to the NavigationServer3D map, query the shortest path to each point, and mark it reachable when the summed path length is within the movement budget. Run marching squares over that reachable unreachable field to create the filled area or its outer contour. Obstacles and paths around corners then emerge from the path queries instead of being handled with raycasts.
Be sure to verify that the returned path actually ends near the requested point, because disconnected targets may produce a path to the closest reachable position.