Last week have been a slow one, but some progress have been made.
I fixed a bug in the POM generator export code. Some times a node would be written twice, which caused quite some strange behavior from the agent as the grid where connected in a bizarre way.
I’ve added the ability for objects to block areas on the navigation mesh. This caused a rewrite of the navigation loading code and forced me to dive back into Detour as this functionality depends on the tile cache available in Detour. It’s the tiles of the navigation mesh compressed and kept in memory so when a obstacle is added, it’s easy to fetch a single tile, decompress it and rebuild it with the obstacle added.
The different planes of the POM is now functional. So objects that blocks the navigation mesh now also blocks nodes on the POM at appropriate levels. This fixes the issue where the agent tries to look at a node that is inside another object.
Other than that I’ve been working on the behavior. The roaming behavior is coming along a lot better. I’ve restricted the area to search close to the agent. This gives the result of a more directed and thorough search. Before the agent would run back and forth between locations.
Today I’ve improved the search behavior in the same way. By using the last known velocity of the target I can define an area where the agent can be in. This prevents the agent from walking away to another place that have accumulated a large probability over time.
I’ve also added the ability for the player to move objects and a simple reaction from the agent when a object is discovered in a new location. With this I also fixed some previously undiscovered problems with the navmesh blocking.