0AD computer players are implemented in JavaScript and
have to provide a particular set of functions to be
invoked by the pyrogenesis engine while the game
processes. This namespace provides a basic
implementation and decoding logic for the engine data.
- Source:
Classes
- BaseAI
- Base class for computer players.
- Class
- Provides a nicer syntax for defining classes, with support for OO-style inheritance.
- Entity
- Represents a single object (entity) in the game.
- EntityCollection
- A sequence of entities with filtering and tasking capabilities.
- Filters
- A class-factory for entity-collections using filters.
- SharedScript
- A shared data container holding information common to all players.
- Template
- Represents an entity template which defines a class of game objects.
Mixins
- Filter
- A filter interface which selects some elements from an entity collection.
Members
(static) DebugEnabled :Boolean
Enables output of debug information by a bot.
Type:
- Boolean
- Source:
- See:
Methods
(static) debug(output)
Emits data on the system console/on-screen warnings.
Parameters:
| Name | Type | Description |
|---|---|---|
output |
Object | An object to be shown to the developer. Is automatically converted to JSON-like notation. |
- Source:
- See:
Returns:
undefined
(static) SquareVectorDistance(a, b)
Computes the square of the euclidian distance of two points.
In many applications, such as sorting objects by
distance to a common anchor point, it is not necessary
to have the exact distance value as long as the
results are compatible with the less-than/equal
relation regarding the "real" distance. Since
computation of square roots is expensive, this
function may be used as a cheaper alternative to
VectorDistance.
Parameters:
| Name | Type | Description |
|---|---|---|
a |
Array.<Number> | The first point. |
b |
Array.<Number> | The second point. |
Returns:
The square of the euclidian distance between a and b, when
treating the first two elements of the arrays as a
two-dimensional position.
(static) VectorDistance(a, b)
Computes the euclidian distance of two points.
Parameters:
| Name | Type | Description |
|---|---|---|
a |
Array.<Number> | The first point. |
b |
Array.<Number> | The second point. |
Returns:
The euclidian distance between a and b, when treating the
first two elements of the arrays as a two-dimensional
position.
(static) warn(output)
Emits a warning message to the console.
While the basic JavaScript
warn function
could be used to emit warnings, for a bot it is
preferrable to use this function as it provides
additional information on which component/player
is having a problem.
Parameters:
| Name | Type | Description |
|---|---|---|
output |
Object | An object to be shown to the developer. Is automatically converted to JSON-like notation. |
Returns:
undefined