Class: StatisticsTracker

StatisticsTracker()

new StatisticsTracker()

Source:

Members

UpdateSequenceInterval

This number specifies the time in milliseconds between consecutive statistics snapshots recorded.
Source:

Methods

CounterIncrement(cmpIdentity, counter, type)

Increments counter associated with certain entity/counter and type of given entity.
Parameters:
Name Type Description
cmpIdentity the entity identity component.
counter the name of the counter to increment (e.g. "unitsTrained").
type the type of the counter (e.g. "workers").
Source:

GetBasicStatistics()

Returns a subset of statistics that will be added to the simulation state, thus called each turn. Basic statistics should not contain data that would be expensive to compute. Note: as of now, nothing in the game needs that, but some AIs developed by modders need it in the API.
Source:

GetResourceCounts() → {Object}

Source:
Returns:
- The amount of available resources.
Type
Object

GetStatisticsJSON()

Used to print statistics for non-visual autostart games.
Source:
Returns:
The player's statistics as a JSON string beautified with some indentations.

GetTeamPercentMapExplored()

Note: cmpRangeManager.GetUnionPercentMapExplored computes statistics from scratch! As a consequence, this function should not be called too often.
Source:

IncreaseConstructedBuildingsCounter()

Counts the total number of buildings constructed as well as an individual count for each building type. Based on templates.
Source:

IncreaseResourceGatheredCounter(type, amount, specificType)

Parameters:
Name Type Description
type string generic type of resource.
amount number amount of resource, whick should be added.
specificType string specific type of resource.
Source:

IncreaseResourceUsedCounter(type, amount)

Parameters:
Name Type Description
type string generic type of resource.
amount number amount of resource, which should be added.
Source:

IncreaseTrainedUnitsCounter()

Counts the total number of units trained as well as an individual count for each unit type. Based on templates.
Source:

PushValue(fromData, toData)

Adds the values of fromData to the end of the arrays of toData. If toData misses the needed array, one will be created.
Parameters:
Name Type Description
fromData an object of values or a value.
toData an object of arrays or an array.
Source: