Jump to content

Image of the Day

#screenshotsaturday #gamedev #indiedev https://t.co/SytiLEa4G5
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.

Sign up now

Navmesh without agent radius offsets

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 DrEvil   Members   


Posted 05 May 2013 - 07:31 PM

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, 06 May 2013 - 06:29 PM.

#2 DrEvil   Members   


Posted 09 May 2013 - 05:11 PM

Anyone? Seems like my posts tend to invite crickets

#3 tool_2046   Members   


Posted 09 May 2013 - 06:29 PM

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?

#4 DrEvil   Members   


Posted 09 May 2013 - 07:21 PM

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



#5 jack_1313   Members   


Posted 10 May 2013 - 09:50 AM

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, 11 May 2013 - 09:22 AM.

#6 DrEvil   Members   


Posted 10 May 2013 - 05:17 PM

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.

#7 Steve_Segreto   Members   


Posted 13 May 2013 - 12:40 AM

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?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.