Faqgeneral

## What is a bot ?

Anyone that has played FPS(First Person Shooter) games is probably familiar with bots.

Bots are computer controlled opponents, typically designed to play a game in a similar manner as what you might encounter when playing online multiplayer with other players. Although it is very difficult to get bots to actually play like a human would, most bot authors invest considerable time giving the bots the ability to competently play the game, and be a fun opponent.

Bots normally reside on the game server, meaning it is the game server that actually runs the bots, processes their navigation and AI, and ultimately controls the overall actions of the bots. Client side bots are commonly considered cheats, because they too are computer controlled and are often capable of giving individual clients unfair advantages. Aimbots could be considered a form of client side bot.

## What are they bots for ?

* Sometimes, for some people, playing against a bot can be more fun than playing a human. Humans are commonly idiots in multi-player games. They may cheat, complain, camp vehicles/spawns, teamkill, or generally do other things that ruin the enjoyment of other players. A well coded bot will play the game as designed. They don't complain. They don't cheat.
* They can be good practice. Playing against some bots, or even a hoard of bots, can be a good way to practice your death-matching skills, dodging, avoidance, sniping, etc.
* Bots are a good way for a server administrator to attract real players to their server. In a server browser, there are often many hundreds of servers listed. Few people will choose to join an empty server, so bots are often a good way to keep some gameplay going on a server even when no humans are around. Most bots have options that allow bots to be removed from the game as human players join, eventually resulting in a game of all or mostly humans.
* Playtesting maps. As a mapper building a map, it is often a good idea to playtest it. Sometimes it can be difficult to get enough humans together to properly test a map. If the mapper so desires, they can build bot navigation for their map as they develop it and test it with a full game of bots, or humans and bots, to test the balance, fun, and overall flow of the map. Foxbot for TFC was often used in this way.

## Do bots cheat ?

The answer to this varies from bot to bot. To be perfectly honest, technically some of the way bots have to be coded might be considered cheating by some, however most bot authors go through great lengths to reduce cheating to a level where the fun is not ruined.

Some examples of things that might be considered cheating

* Bots 'see' by doing collision tests with lines or volumes. This means that in order to determine if a bot can 'see' another player, a ray is shot from the bots eye to the target. If this ray doesn't collide with anything, such as walls, other players, props, etc, we would consider the object in the bots view. If the ray does hit something we consider the view blocked.

This concept is both a strength and a weakness of bot AI.

The strength, and the potential for cheat accusations to come about, are often due to the reliance on collision to determine view. For example, many games have foliage in their outdoor maps. Grass, bushes, trees, etc. Often these sort of things do not have any kind of collision on them, so they don't obstruct the view of a bot at all. To counter this, some games go through extra efforts to simulate obstruction through foliage. Many bots don't make such compensations, so in maps that contain objects that to humans might be considered cover because they block your view with transparent, often the bot is able to see right through them. This also comes into play with game elements such as flashbangs, smoke grenades, tear gas, or other things that might be based around altering the rendering of a human players screen. These sort of effects are often faked with bots, in one way or another.

A weakness of this method, is that it gives the bot a very very rough view of the environment. At the simplest level, a bot might cast a single ray from his eye to the enemy eye or enemy position to see if it can 'see' them. If the ray hits something, he can't see it, if it doesn't hit anything, he can see it. The problem with relying on a single raycast to make this determination, is that in reality that one spot on the target might be obstructed, while the rest of the target might be viewable. Due to this, sometimes bot authors do several raycasts at different positions on the target, to account for the possibility of partially obstructed targets. This results in a better view system, at the expense of requiring more processing. In extreme cases, a bot might cast a ray to every body part or bone on the target. This would give excellent resolution to the bot, but at a very high increase in cpu cost. Ultimately it depends on how accurate the bot author wants them to be. Most games typically don't notice slight inaccuracies in the resolution of the bots view system, while a slower paced tactical game might benefit more from it.

Also under the category of cheating, it is true that as a server side mod, the bot author technically has full access to where everything and everyone is in the game. It is fully within the capabilities of the bot coder to make the bots fully aware of everyone and everything. As a matter of fact, that would be the easiest way to make a bot. Fortunately, most bot authors don't like their bot to cheat that badly, which is why a bots knowledge of the world is heavily filtered, usually by parameters that mimic the view capabilities of a human player as close as possible, like the field of view, view distance, and whether the view is obstructed, usually by doing ray cast collision checks.

Finally, the subject most often accused of cheating is a bots aiming. It is very easy to make a bot shoot exactly on target every time. Some bots have implemented aiming systems that have resulted in an almost superhuman accuracy. These bots are rarely fun to play, and most bot coders also put alot of effort into a more human-like aiming system, with properties such as a max turn rate, and adding acceleration/deceleration to aiming, both for smoothness and for less robotic behavior.

In the end, bot AI, and game AI for that matter almost always cheats to some degree. It isn't feasible, both in time and processing power, to make an AI work exactly like a human. The key to good AI is limiting the cheating of the bot to an acceptable level. Some cheating is inevitable, but a good bot will not make it obvious that they are cheating. It's all about having fun, and sometimes the code has to be written to work around the fact that bots don't see a rendered world at all like players, and sometimes have very limited or non existent hearing capabilities too. Ultimately it doesn't matter, as long as the gaming experience is fun.