Tweaking Recast Navigation

Recast Navigation is working better and better. It’s still far from being a replacement to our old and trustworthy Tiled, but major porting and rigging problems seem to be resolved now. What remains are inherent RN issues, one of which are deadlock situations. Those I’ve been dealing with for the past few days.

Example below is a perfect deadlock situation. Two agents in the middle compete over reaching the same target (yellow point). Since both agents are equal, they push and react to each others pushing with exactly the same force.

2015-02-05 2 agents deadlock

Most of the deadlock situations are variation of this one. Agents exchange around a corner, three agents going for one target and so on. In essence it is all about dealing with “Equal opposing forces”. There are few high-level options:

  • Firstly there’s the right way – tweak RN settings, which are plenty and not always well documented, Upside is that we don’t have to modify and maintain our modified version of the library.
  • Secondly we can try to change RN state from the outside, e.g. by monitoring the agents, detecting if they have stuck and overriding RN agents state. There’s one major downside to this one though – in essence it’s like performing a repair on a working engine. One wrong move and whole thing might just explode. Even though I have ported Recast to Delphi, I still have rather vague idea on it’s internal workings.

Option 1 it is. And for the bonus material – exchange of 80 agents in a slideshow:

2015-02-05 40vs40 0

1. Agents get spawned into the world. All at the same time in two places.

2015-02-05 40vs40 1

2. Groups of agents pour into the hallway and approach each other.

2015-02-05 40vs40 2

3. Exchange is at its peak. The process is so intense, that some agents had to overlap.

2015-02-05 40vs40 3

4. Exchange is almost over, no overlapping now. Remaining agents hurry up.

2015-02-05 40vs40 4

5. Finally, exchange is complete, now agents compete over reaching their targets.

This entry was posted in How things work, Live progress, Sidenotes. Bookmark the permalink.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.