Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals   Related Pages  

CBotAI Class Reference

Base class for external AI class. More...

#include <botai.h>


Public Types

enum  TBotMovingDir { EMoveForward, EMoveBackwards, EMoveLeft, EMoveRight }
 Bot moving directions. More...


Public Member Functions

 CBotAI ()
 Default constructor.

virtual ~CBotAI ()
 Destructor.

virtual void think ()=0
 Pure virtual think method.

virtual void init (int &aSpeed, int &aArmour, int &aAiming)
 Initializing method to configure attributes of the bot.

void resetAction ()
 Reset action to EActionNone.

void move (TBotMovingDir aDir)
 Move bot to the given direction.

void shoot (float aDir)
 Shoot to the given direction with the current weapon.

void bunker ()
 Bunker/unbunker bot.

void pickWeapon ()
 Pick up a weapon.

void dropWeapon ()
 Drop a weapon.

int action ()
 Getter for action.

bool checkAction ()
 Check validity of the action.


Data Fields

CTileMap * mTileMap
 Map of the surrounding world.

list< CVisibleBotInfo * > mBots
 List of all visible bots.

list< CVisibleWeaponInfo * > aWeapons
 List of all visible weapons.

list< CVisibleBulletInfo * > mBullets
 List of all visible bullets.

list< float > mSourcesOfNoise
 List of sources causing noise.

CBotInfo mData
 Information about this bot.


Detailed Description

Base class for external AI class.

Bots are controlled using think() method once in every frame. Action flags are used to define bot movement and other actions (see TBotAction).

Note:
All provided information about this bot or surrounding world is "read only". Changing anything else than action flags and moving/shooting direction will have no effects.
Robot specifications.

The purpose of this document is to specify abilities and disabilities of the robots
and define basic rules of controlling them.

Robots are acting in simplified tile based environment. Tile is a rectangular block
with a constant size, namely 100 units/side. Block can be either wall, obstacle or an emty block.

The robot is equipped with quite inadvanced mobilizing utilities, and it can only move
in four directions (forward, backwards, left or right). Moving speed is constant, 25 units/round
forward and 10 units/round to other directions. In order to change direction, the robot is able to
turn 18 degrees/round.

For input the robot uses a radar cabable of scanning an sector of 90 degrees with infinite radius.
The radar can scan areas behind an obstacle, while unveiling it's existence, but not thorough walls.
Besides the radar, the robot has multiple sound sensors that are used with an accurate timer to get
the direction to the source of the sound.

With a robotic arm the robot can aim within an 40 degree span and can be used to launch a weapon.
It can be controlled simultaneously with the servo motors used for movement, but while moving shooting
is not as accurate as while standing still. The accurancy can be further improved with a bunker mode,
which stabilises the arm and shields the essentials 25% better. Switching between bunker mode and movement
mode takes 4 rounds. The arm can also pick up a weapon found lying somewhere, requiring 2 rounds of
staying still.


Member Enumeration Documentation

enum CBotAI::TBotMovingDir
 

Bot moving directions.

Direction can be only one of these.

See also:
move().


Member Function Documentation

int CBotAI::action  
 

Getter for action.

Returns:
Action to be performed next.

void CBotAI::bunker  
 

Bunker/unbunker bot.

Action duration 4 rounds. If EActionShoot, EActionPickWeapon or EActionDropWeapon is defined, it will be cancelled.

bool CBotAI::checkAction  
 

Check validity of the action.

Only one of EActionShoot, EActionBunker, EActionPickWeapon or EActionDropWeapon can be defined at the time. If bot has been bunkered, EActionMove can not be defined. Action can not be changed, before it has been completed. See CBotInfo::actionDelay().

Returns:
True for legal actions, false for illegal.

void CBotAI::dropWeapon  
 

Drop a weapon.

Action duration 2 rounds. If EActionShoot, EActionBunker or EActionPickWeapon is defined, it will be cancelled. Dropped weapon disappears permanently, and it can not be picked up again.

virtual void CBotAI::init int &    aSpeed,
int &    aArmour,
int &    aAiming
[virtual]
 

Initializing method to configure attributes of the bot.

Bot speed, armour and aiming can be adjusted with different power, from 50% up to 150%. However, total power is scaled to be 300%. All attributes are 100% by default.

Parameters:
aSpeed Weight factor of the speed. Moving and turning speeds are both affected.
aArmour Weight factor of the armour.
aAiming Weight factor of the aiming.

void CBotAI::move TBotMovingDir    aDir
 

Move bot to the given direction.

If EActionBunker, EActionPickWeapon or EActionDropWeapon is defined, it will be cancelled. If bot has been bunkered, it can not move before unbunkering.

Parameters:
aDir Moving direction. If direction is invalid, no action is performed.

void CBotAI::pickWeapon  
 

Pick up a weapon.

Action duration 2 rounds. If EActionShoot, EActionBunker or EActionDropWeapon is defined, it will be cancelled. To pick a weapon, it has to be close enough (distance <= radius of the bot + radius of the weapon).

void CBotAI::shoot float    aDir
 

Shoot to the given direction with the current weapon.

If EActionBunker, EActionPickWeapon or EActionDropWeapon is defined, it will be cancelled. Moving at the same time will decrease precision. Reloading time depends on weapon. If bot is still reloading the weapon, no action is performed.

Parameters:
aDir Shooting direction in radians. If direction is invalid (|dir| > PI/8), no action is performed.

virtual void CBotAI::think   [pure virtual]
 

Pure virtual think method.

All bots must be provided with AI by implementing this method.


Field Documentation

list<CVisibleBulletInfo *> CBotAI::mBullets
 

List of all visible bullets.

Bullets are usually fast, but may be detected and dodged.

list<float> CBotAI::mSourcesOfNoise
 

List of sources causing noise.

Only angle of incidence can be detected.

CTileMap* CBotAI::mTileMap
 

Map of the surrounding world.

Bot is placed in the middle of the map (tile 0, 0).


The documentation for this class was generated from the following file:
Generated on Mon Jun 9 22:02:25 2003 for Drunken Bot III by doxygen1.3-rc3