Anyhow, as seen in previous blog posts this week, a lot of things have changed directions. One of the main things is that we've shifted our approach to constraints. Unfortunately, since this new direction requires a lot more lower-level theoretical-ish work, that means there's not a whole lot of cool and interesting things to show off.
So, the plan is now:
- Use our own A* planner on a graph extracted from Unity's NavMesh.
- Adjust per-agent graph weights on the fly to reflect the constraints of the command being executed.
- For dynamic agents, modify the weights of nodes that fall into constraint areas relative to the agent.
- Initially, start with planning paths to a specific location and focus on implementing constraints.
I accomplished some things this week:
- Reading Unity's NavMesh and then correctly converting that into a navigation graph for A* (this was difficult because Triangulate returns a mesh that is not fully connected).
- Examining the usefulness of some things available to me, such as NavMeshLayers, NavMeshAgent.SetLayerCost, and Collider.ClosestPointOnBounds.
- Adding "NavAnnotations" or "constraint annotation mesh objects" that both split up the Unity-generated NavMesh and allow us to associate graph nodes with constraint areas:
Here are some things to note for future reference:
- NavMeshLayers are really only useful to manually split up the NavMesh (and thus make the navigation graph more dense).
- SetLayerCost probably won't be useful at all, because we can't have one layer for every possible constraint (every possible pair of object and constraint type) as there are only 32 possible layer flags.
- We probably want to use ClosestPointOnBounds to figure out which node should be our destination. Choose the path-cost-minimizing destination node amongst the nodes that are "within" the constraint annotation mesh.
- We may be able to store in graph nodes (at generation time) the constraint annotation mesh objects for each node (thus avoiding searching the graph for the closest nodes, as in the previous bullet point).
- All of the constraint annotation mesh objects are going into their own layer (NavAnnotations), which means we have the option of searching through them.
The challenges I'm currently anticipating:
- Figuring out how exactly constraints will work relative to dynamic objects (we can't add nodes to the pre-baked navigation graph).
- For hard constraints, dealing with the case where a hard constraint is not true at the starting state.
- Gracefully dealing with any failure case.


No comments:
Post a Comment