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:
- 0-namespace.js, line 15
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.
Members
-
<static> DebugEnabled :Boolean
Enables output of debug information by a bot.
-
Type:
- Boolean
- Source:
- baseAI.js, line 17
- See:
Methods
-
<static> debug(output)
Emits data on the system console/on-screen warnings.
-
Parameters:
output: ObjectAn object to be shown to the developer. Is automatically converted to JSON-like notation. - Source:
- utils.js, line 14
- 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:
a: Array.<Number>The first point. b: Array.<Number>The second point. - Source:
- utils.js, line 78
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:
a: Array.<Number>The first point. b: Array.<Number>The second point. - Source:
- utils.js, line 54
- See:
-
- API3.SquareVectorDistance A faster alternative
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
warnfunction 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:
output: ObjectAn object to be shown to the developer. Is automatically converted to JSON-like notation. - Source:
- utils.js, line 37
Returns:
undefined