Difference between revisions of "AI Misbehaving"

From Custom Map Makers Wiki
Jump to: navigation, search
(Simplify the collision hull with playerclip, weaponclip and botclip)
(Where you can't use botclip, use botdonotenter)
Line 44: Line 44:
  
 
==Where you can't use botclip, use botdonotenter==
 
==Where you can't use botclip, use botdonotenter==
 +
If after all your botclipping efforts the bots still insist on going places you don't want them too you can try using botdonotenter brushes instead. In theory, these create an area which the bots will avoid unless they are pushed into it or there is a worthwhile goal, such as an item or flag within it. In practice, the bots sometimes completely ignore them, so it's just trial and error really. I used a botdonotenter brush just taller than a player to stop the bots loitering over the trapdoors in my first map:
 +
 +
[[File:Bdneexample.jpg]]
 +
 +
 +
I think they thought they could get down through the trapdoor to the item_botroam I had placed on the jump-pad below, even though the trapdoor was one-way and only triggered from below. Luckily, my fix worked, and didn't stop them using the trapdoor from below and shooting up through the botdonotenter brush (I guess a trigger_push counts as being pushed into the area...?)

Revision as of 09:46, 26 November 2011

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

Botclip can also be used to stop the bots doing stupid things like jumping off the edge of a map, or not giving themselves enough forward thrust to make a fall from a platform without landing in some hazard. The latter is acheived by placing a botclip brush next to the edge of the platform as shown below - now the bots will slide down it (as long as it's steeper than 45 degrees) and over the hazard, rather than into it.

Botclip.jpg

Sometimes, you can use botclip to make an area that the bots keep killing themselves in more hazardous, so that the bots will realise it's dangerous and avoid it. For example, bots often think that they can land on very small or narrow bits of architecture over hazards, when in actual fact 9 times out of 10 they miss it and fall to their doom. However, you don't want to stop human players being able to attempt it. In this case you can use another steeply angled bit of botclip that makes it impossible for the bots to land on the offending brush - they would simply slide off. Now the bots should see the danger and stop acting like lemmings.

Where you can't use botclip, use botdonotenter

If after all your botclipping efforts the bots still insist on going places you don't want them too you can try using botdonotenter brushes instead. In theory, these create an area which the bots will avoid unless they are pushed into it or there is a worthwhile goal, such as an item or flag within it. In practice, the bots sometimes completely ignore them, so it's just trial and error really. I used a botdonotenter brush just taller than a player to stop the bots loitering over the trapdoors in my first map:

Bdneexample.jpg


I think they thought they could get down through the trapdoor to the item_botroam I had placed on the jump-pad below, even though the trapdoor was one-way and only triggered from below. Luckily, my fix worked, and didn't stop them using the trapdoor from below and shooting up through the botdonotenter brush (I guess a trigger_push counts as being pushed into the area...?)