Jump to content
  • Advertisement
Sign in to follow this  

Navmesh without agent radius offsets

This topic is 1961 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Wondering if anyone has used a navigation mesh with AI without doing the typical agent radius offsetting that is normally done. I know that it simplifies a lot to bake in the agent radius to the navmesh, but I'm experimenting with a navmesh representing the entire floor space without the offsetting. As you can probably imagine, this complicates certain aspects of it, so I'm looking for ideas if anyone has tried or done similar before.


Here's some screens to get an idea where I'm at with my tinkering. This is from one of many games my bot supports but it's a great testing ground for various A.I. stuff


















The last picture shows the main obvious issue with not offsetting the navmesh by the agent radius. Basically I will need to modify the paths found through the navmesh to account for the agent radius some as part of building the result path. I'm wondering if anyone has some ideas about how you might address this. I'm not yet funnel pulling the path, though I plan to, and I'm tinkering now with modifying the path along the edge portal normal by the agent radius to try and compensate, but there are situations where that distance even can overshoot the size of an adjacent sector, so I'm looking for some ideas on perhaps how/when to optionally perform fixup in a more selective and robust manner.


Thanks in advance.

Edited by DrEvil

Share this post

Link to post
Share on other sites
I don't work on the pathfinding at my job currently, but I'm vaguely familiar with the approach. Initially it was hoped that a single navmesh could be generated for all agents based on a minimum agent radius. This ended up leading to a great deal of grief when trying to path larger agents (imagine SUVs going through door frames). Eventually it was decided to generate navmeshes not necessarily per agent, but per similarly sized agent.

Our project requires user interaction with the site (level), and thus navmeshes have to be regenerated depending on changes to the site. Without that stipulation I think the decision to generate navmeshes per agent (or similarly sized agent) would have been a no brainer. I admit we tend to throw hardware at a problem, but I'm curious what motivated your approach?

Share this post

Link to post
Share on other sites

Partially as an experimental exercise to see if I can get it working reasonably well, even though the games that my bot works in don't technically need it. The way I construct nav meshes is a manual process that involves pointing and using surfaces of the game world as clip planes, since I don't have access to the raw collision geometry to auto build and offset. The up side to that process is that its pretty fast to generate the navigation(for a manual process at least), and it represent the walkable floor space exactly, the down side obviously is the need to handle some of the issues at the path finding level.


Also, although it also doesn't really come into play with my bot, we had lots of problems with nav meshes when I worked on Doom 4, specifically with melee creatures. The larger the creature, the more fragile it is to calculate a movement position suitable to melee from, especially when the player or smaller humanoid style targets are backed into a corner, because the distance from that entity to the larger creatures navmesh can be significantly above the radius due to the offsetting.


At the moment I'm largely getting obstacles of varying weights working with modifying the navmesh sectors temporarily and reverted when they are removed so I can represent both solid obstructions as well as weighted soft obstructions, like defensive weightings, such as



Share this post

Link to post
Share on other sites

Hi DrEvil,

Sorry that it’s taken me a little while to get back to your post/PM. I’m really under the pump with work at the moment.

To account for agents with varying sizes, we need to solve two problems:

1. We need to account for agent size when running our A* algorithm on the navigation mesh to find the list of nodes (be they triangles or convex polygons) which will contain the final path. That is to say, we can't send agents through gaps that are too small for them.
2. We need to account for agent size when “funnelling” through the list of nodes returned by our A* search to obtain the actual shortest path.

For problem #1, please see my full description and solution in this post from 2008.

You will see that for each node, it is necessary to store a separate size restriction value for every edge-pair combination that an agent could enter and leave from. If our nodes are triangles, this means each one must store three separate widths.

If we allow other kinds of convex polygons, then the number of widths each node must store will be equal to the sum of all integers from 1 to (number_of_neighbours – 1), if my brain is working correctly at the moment. We would need to come up with an equation to reference the right value from a node’s array of stored widths given an entry edge and an exit edge – this should be fairly trivial.

For problem #2, please see my solution in this post from 2009, as well as my other contributions in the same thread. The linked post explains (my version of) the funnel algorithm and then explains the modifications that you need to make to account for agent size, providing pseudo code at both stages.

Just let me know if you have any questions.

On a side note, I obviously don’t think that the traditional solution of expanding and bevelling the base navigation mesh to account for agent size is very elegant. Apart from necessitating a new mesh for each possible agent size, it also increases the complexity of the navigation mesh at every concave feature. For fast pathfinding, we want to reduce the number of nodes that need to be searched, not increase it.

Edited by jack_1313

Share this post

Link to post
Share on other sites
Thanks. I'm on the road at the moment so it will take me some time to sit down and digest. I'm primarily looking to correct the corners where my guys currently cut across and get stuck due to the non offset geometry. I don't currently need to actually pathfinder for multiple agent sizes. I can understand there there is probably some overlap though.

Share this post

Link to post
Share on other sites

Do you also intend to have some sort of collision det/response system in place and represent the agents using some sort of physics "character controller"? If you do, you could force them along the generated path without your AI/Pathfinding system caring about their agent radius and the collision system would push them off the walls and other geometry so they wouldn't interpenetrate. This wouldn't be very computationally optimal I suppose, but just an idea?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!