Thread: Recast / Detour
View Single Post
Re: Recast / Detour
Old
  (#23)
Neoptolemus
Member
 
Status: Offline
Posts: 93
Join Date: Apr 2012
Default Re: Recast / Detour - 09-07-2015

Hi again SamPlay,

Thanks for the further input. I'm still learning the intricacies of both Recast and the Half-Life internals, so this kind of advice is always appreciated

I think you're right that bots will always generally catch on corners, even as a player I still sometimes misjudge a corner and am momentarily blocked. I think it's a symptom of Half-Life's collision detection. I think the trick here will be two-fold:

1) Create a second pass after calling recast's findStraightPath to further adjust the positioning of the nodes. An average path will usually only contain around 12 points, though if it's a complex, weaving path it can be more (for example a spiral staircase), but we're still talking about small numbers. This would make it computationally inexpensive to check the distances of each point to the nearest wall and, if necessary, move them away a bit. Perhaps I can override the findNearestWall recast function to retrieve the location and normal of ALL hit walls and use it to place the node somewhere in the middle, so bots aim for the centre of a doorway rather than trying to cut tight around the doorframe

2) Give the bots their own way of detecting if they've caught on something and to adjust their position accordingly. It should be fairly straight forward to get the normal of the collision and "bounce" them off slightly to get them around the corner. Perhaps work out a compromise between the normal of the collision and the oritentation of the point they're trying to get to, to have them "slide" along the wall instead of trying to run into it

With regards to sloped walls, that should (in theory) be covered by recast's use of heightfields, though it is still possible that at points where the headspace is very close to the player height (e.g. 71 units, where player height is 72 units), the accuracy of the heightfield may not be enough. Reducing the cell height during voxelisation would help alleviate this problem, at the expense of longer navmesh generation times (though given this is a one-off process, it's probably not a big deal).

I'll continue working on movement of course as it's easily the most important aspect of the AI, so I'll take a look at Immortal BLG and Xash when I have a chance.
  
Reply With Quote