Onboard Systems: Introduction
Previous Top Next

A bot has several onboard systems that are associated with its various mechanisms, such as its scanner and communications unit. You control your bot by accessing one of these systems and calling a method (to tell it to do something) or accessing a property (to retrieve information). For example, the Weapons property accesses the weapons system.

To illustrate, here are some isolated examples that use the navigation, scanner, weapons, and communication systems:

Nav.Move(5); // move forward 5 meters
List<ScannedObject> foundObjects = Scanner.Scan(); // scan for objects
Weapons.Pulsar.Fire(obstacle.Position); // fire at something
Comm.Transmit(transmission); // send some information to allies

Each mechanism operates independently of the others. During battle a mechanism can be damaged or completely destroyed. When damaged, it may still function but to a lesser degree (operate more slowly or with less accuracy). When the damage reaches 100% it is completely destroyed and, of course, won't function at all.

When an AI program attempts to operate a destroyed system, the attempt will fail silently (without errors) and just wastes time as the bot tries to use a destroyed mechanism. You can account for the possibility that a system won't work by checking the IsFunctional or DamageLevel property of the system. For example:

if (Weapons.IsFunctional)
{
       // ...Be aggressive...
}
else
{
       // ...Run and hide...
}


Subsequent topics in this guide introduce the onboard systems individually, showing the basics of how each one works and how to control it.

Tip: We only introduce the basics of the onboard systems here. Consult the Bots AI Library reference for more detailed information.

Recommended Topics
Navigation
Scanner
Weapons
Communications