I’m working on a rts game and my current setup I the following:
- Raycast graph
- I use NavMeshCut for runtime constructions like buildings to update graph
- RVO enabled for my units
- Units and similarly RVOControllers has different attack range/agent radius.
I need some general guidance how to implement an approach logic for an “Attack building” order.
Let say my building has nav mesh cuts defined that update the nav mesh. I want to calculate the best path for a unit to approach a building and start attacking it within unit’s attack range.
Now my first approach would be to use an arbitrary picked center point for a building and calculate a crud path to this place for my unit. Then, when the unit is close to the said building within certain range, I would have to recalculate the path accounting for RVO agents and find a suitable “free” spot around the nav mesh cut within units attack range so it can actually start attacking it. This will mean I have to update initially calculated destination, because it might not necessary be the shortest point straight to the edge of mesh cut.
The nav mesh cuts could be arbitrary, but for simplicity I guess I would have to assume they are all either circles or rectangles. One building can consist of multiple nav mesh cuts.
What would be the best approach to achieve such behavior? I welcome any suggestions .