View Single Post
Re: Bot running speed
Old
  (#13)
Neoptolemus
Member
 
Status: Offline
Posts: 93
Join Date: Apr 2012
Default Re: Bot running speed - 10-08-2015

Eventually I will handle dark areas, so bots can use nightvision, and possibly even use the dark to hide and ambush. Right now it just uses the view frustum and a trace to various parts of the body to check for visibility.

I've been trying numerous ways of handling movement to avoid bots getting stuck and I'm starting to get there I think. I can now have a bot run around cs_italy for a good 3 minutes before he gets caught in a corner, and his movement is pretty much perfect up until then.

I'm doing it by searching in a small radius (about 8 units) around the bot for the edge of the navmesh, taking the hit hormal of the nearest point to the edge from the bot's origin, and giving him a little nudge away, kind of like a magnet repelling another magnet with the same charge.

This works most of the time, but it seems like it's possible for the bot's origin to stray outside the navmesh, meaning in some cases the normal is inverted and ends up pushing them into the wall! I have added a sanity check that traces 20 units in the desired push direction, and if the trace hits a wall then it inverts it.

More testing is needed but so far, looking good! There are still plenty of minor issues to deal with: my technique does have the side effect of causing bots to rapidly zig-zag down narrow corridors where it can't help but touch the navmesh edge on either side, and if it gets stuck in a corner where it is blocked on one side AND in front, it will still be stuck as it's trying to move diagonally rather than strafing.

Last edited by Neoptolemus; 10-08-2015 at 10:34..
  
Reply With Quote