Best way to create a "grid" for units to help determine "squadding" around a destination (and how to squad them around this point) if multiple units move to that destination

I have a navmesh graph, that is very large (around 10k x 10k units) and want to keep performance on mobile a concern, but want to use some grid features.

I’m making an RTS and want to eventually do the following:

  1. Render grid lines (probably with OpenGL) around points spaced about on this navmesh
  2. if a navmesh grid is not prefered (or a regular node grid is still fast enough), i want to make my grid point movements more natural, and feeling less like waypoints.
    3… Use these points (or RVO) to determine if units block a path
  3. When multiple units are selected, and given the same move destination, they should form a squad formation around the destination based on preset unit sizes (some units can be long, wide, uniform in dimensions, etc).
  4. They should NOT “fight” for the destination and just all try to run towards it.

How can this be achieved? I’ve been scratching my head a bit on how to approach this, and also approach it in a convenient, modular and efficient way. Not sure where to begin. Any help, ideas or pointers?


Sorry, but you are asking for a lot.

First. If you want to use a 10k * 10k map you simply cannot use a grid graph (unless you want a resolution of 10 meters, which is not very good). I would recommend a recast graph.

  1. Using a navmesh graph you can use either the AIPath movement script with the funnel modifier or the RichAI movement script which has the funnel modifier built in. Using the funnel modifier will give you a lot more natural paths.

2.3 This is unfortunately not possible to any high accuracy.

  1. There is no built in functionality for generating those kinds of squad formations. The closest things is the GetPointsOnNodes method which will generate random points on the navmesh with some clearance. You can use these points as target points of your units instead of just making them all move towards a single target (which usually looks horrible).

Yeah, I understood that it was a lot, but I wanted to give full information and if anybody could give insight on any portion, I would be grateful.

Thanks for some insight, i’ll look around and see how thos eideas work and what directions they take me. I appreciate all the work you do on the forums / on this pathfinding asset :smile:

1 Like