# Adding computer-controlled players

Multiplayer games of dopewars can be made a little more interesting by introducing computer-controlled, or AI, players. These players will join a dopewars server, and to all intents and purposes will behave like normal human players - they will deal in drugs in an attempt to make a fortune, they will encounter the cops, you can spy on them, and they will shoot at you if you give them the chance!

To start a computer-controlled player, all you need is the standard dopewars binary. Run it as
`dopewars -c`
and it will attempt to connect to the server and port specified in the configuration files (or the local host, if none is specified). Alternatively, you can specify server and port with suitable command line options. Since an AI player takes its game settings from the server it connects to, no other options in the configuration files will take effect, with the exception of the AITurnPause option, which sets the pause in seconds between turns.

Once started and connected to the server, the AI player will choose a suitable name for itself and start playing. It will continue to play until its game finishes - i.e. it is killed or runs out of time - at which point the program will finish and drop you back to the command prompt. The program will display information to let you know what the AI player is doing within the game as it goes. Note that the program will pause for five seconds (or whatever you have set AITurnPause to be) before jetting to a new location - this is to simulate the time it takes a human player to choose which drugs to buy and to press all the requisite keys; it also gives other players a fighting chance of spotting the computer sitting still in any one location for a few seconds!

If a computer player is attacked by the cops or another player, it will defend itself if it can, and attempt to run if necessary. During normal play it will also attempt to "blend in" with the other players by hurling rather pathetic insults at them... you are free to edit the code of the AI player to give these insults a little more "punch", or email them to me (preferably without actually directing the insults themselves at me!) and I'll add them to the next dopewars release.

- Main index

Last update: 15-07-2002
Valid XHTML 1.1