AI Misbehaving

From Custom Map Makers Wiki
Revision as of 10:43, 26 November 2011 by John (talk | contribs)
Jump to: navigation, search

So far, the few bot tutorials that I've seen have seemed to consist entirely of:

  • Run BSPC on your compiled .bsp to create a bot navigation (.aas) file.
  • The End.

Ah, if only it were that simple.....

Unless you are extremely lucky or your map is one box with a rocket launcher and a spawn point in it, the bots will probably play really dumb. Worse still, you may encounter 'bot stutter' - an uneven framerate caused by CPU overload on the bot AI. Now its very easy to say "well, this map is designed for human players anyway so I'll leave it" but the sad fact of the matter is that its quite unlikely that your map will end up on any servers, so its worth making the botplay as good as possible. Happily there are several things that can be done to improve matters, and this tutorial is here to tell you what they are. However, before we start there are a few things bots will never, or hardly ever, do:

  • Bots will not usually shoot at a shootable trigger or button.
  • Bots will not press a button voluntarily (although you can make them using an item_botroam - but these are not conditional, so the bot will carry on trying to activate the button even if it isn't necessary, and/or won't go for it above anything else when it is necessary)
  • Bots are pretty rubbish at working out jumps and even worse at working out rocket jumps and strafe jumps. If an area of your map can only be reached by jumping don't be surprised if you can't get the bots to use it.
  • Bots will only try to get floating items (those flagged as 'suspended') by using jump-pads and launch-ramps. They won't jump or deliberately fall off a ledge to get a suspended item

K, now that's out of the way, download a copy of Q3map2Toolz if you haven't already got it (makes compiling the .aas file self-explanatory) and let's get on with the optimisations:

Simplify the collision hull with playerclip, weaponclip and botclip

Bots like simple blocky shapes to maneouvre round. They especially like blocks which are axial (parallel to the gridlines). Of course, you could just build your map out of axial blocks, but it would probably look a bit pants. This is where our various kinds of clip come in.

Weaponclip blocks the movement of players, bots and weaponfire. Playerclip blocks players and bots, but allows weaponfire through. Botclip only blocks bots.

Important note: Bots will fire through botclip, but seem to view playerclip as impenetrable.

The good thing about botclip is that it does not affect a human player in any way, so you can stick great big huge axial botclip brushes round more complicated architecture and no-one will ever know. Except the bots, who will like you and your map a whole lot better. Oh, and BSPC which will compile a whole lot faster too.

Remember that the only way a player will notice a botclip brush is if it stops a bot from being thrown through an empty space by an explosion, or if it is really in the way of a normal route round the level. Otherwise, the bots will just navigate round it and nobody will be any the wiser.

Stick botclip brushes everywhere you can get away with it to simplify the collision hull that the bots see. Prime contenders for clip intervention are:

  • Empty spaces above the players that the bots will never be able to get to can be botclipped - for example, in Q3DM4 there's a lot of this because the ceilings are so high.
  • Walls/floors/ceilings with lots of architectural detail - this kind of thing should usually be flattened with playerclip because it will probably get in the way of human players as well. Playerclip also acts as botclip - you don't need an overlapping botclip brush.
  • Curvy pipes and suchlike - any complex patchmeshes can complicate the .aas file unnecessarily. Make them non-solid and encase them in simplified weaponclip brushes as far as possible.*Any space which cannot be reached in the normal course of play - doesn't matter if it is just about possible to get there, if the bots aren't likely to, botclip it off! Look out for small areas under ledges which the players cannot fit into and things like that