Agents with dynamically changing size

I’m currently working on a project that requires agents to be able to change size (not fixed values like 1.0, 2.0, 3.0… but anything in between). The Agent will only change its size while stationary (never while moving) but once it has its new size it needs to pathfind to a location with this new size. There are a few of these agents (5-50) and all of them have different sizes at any one time. This agent is in an RTS like the Total War games so I’m currently using a Recast Graph. Is there a convient way to do this?

Hi

Is it ok if you approximate these sizes with discrete steps, for pathfinding purposes?

To give more details… I’m trying to create a system similar to the total war games, I have formations of units (rectangles, circles, and wedges) and these formations are composed of units (1-300+). I think that the best way to move these formations is to pathfind using the formation as an agent with an agent size as the width of the formation. Then the units in the formation pathfind to their individual places in the formations as the formation moves. When formations change size (width) then the formation should be able to fit within smaller gaps. approximating with discrete steps could work but these steps would need to be 0.1-0.5 size minimum and the maximum width of a formation can be extremely large (>100)

Hi

Hmm, that’s tricky.

The best way I can think of is to use the grid graph’s erosion to tags feature. See GridGraph - A* Pathfinding Project
That would allow you to change the penalty (or walkability) for moving within specific distances from the walls. I think it’s very good to allow moving closer to the walls (but with a higher penalty), to avoid the formation being unnecessarily strict about where it can move.

Thanks for the idea, I’ll try it when I get the time as I have a fulltime job so mostlikely this weekend. I’ll get back to you then