Bots are fake clients that can be added to a game, and take a normal player slot. Their input and behaviour can be coded like most other things in C#.
By default, the console command
bot_add will add a bot that mimics another player's input. This command has some additional parameters you can use:
bot_add <clientIndex> <yawOffset> <forceCrouch>
clientIndex (def: 1) Which client to mimic. If set to 0, it will not mimic anything and remain idle.
yawOffset (def: 180) The bots yaw rotation relative to the target client.
forceCrouch (def: 0) Whether or not the bot is forced to crouch.
To create a custom bot you need to first extend the
Bot class, which has two important methods:
It's worth noting that the methods used below are only called server-side, unlike ordinary clients whose input is built client-side and sent to the server.
Each bot has a
Client property referring to its underlying fake client. Every bot can have its own Pawn and otherwise do anything any other ordinary client could do.