The ObservationInterface reflects the current state of the game. Guaranteed to be valid when OnGameStart or OnStep is called.
More...
#include <sc2_interfaces.h>
The ObservationInterface reflects the current state of the game. Guaranteed to be valid when OnGameStart or OnStep is called.
virtual const Abilities& sc2::ObservationInterface::GetAbilityData |
( |
bool |
force_refresh = false | ) |
const |
|
pure virtual |
Gets metadata of abilities. Array can be indexed directly by AbilityID.
- Parameters
-
force_refresh | forces a full query from the game, may otherwise cache data from a previous call. |
- Returns
- Data about all abilities possible for the current game session.
virtual int32_t sc2::ObservationInterface::GetArmyCount |
( |
| ) |
const |
|
pure virtual |
The number of army units.
- Returns
- Count of army units.
virtual const Buffs& sc2::ObservationInterface::GetBuffData |
( |
bool |
force_refresh = false | ) |
const |
|
pure virtual |
Gets metadata of buffs. Array can be indexed directly by BuffID.
- Parameters
-
force_refresh | forces a full query from the game, may otherwise cache data from a previous call. |
- Returns
- Data about all buffs possible for the current game session.
virtual Point2D sc2::ObservationInterface::GetCameraPos |
( |
| ) |
const |
|
pure virtual |
Position of the center of the camera.
- Returns
- Camera position.
virtual const std::vector<ChatMessage>& sc2::ObservationInterface::GetChatMessages |
( |
| ) |
const |
|
pure virtual |
Gets new chat messages.
- Returns
- List of chat messages.
virtual const Effects& sc2::ObservationInterface::GetEffectData |
( |
bool |
force_refresh = false | ) |
const |
|
pure virtual |
Gets metadata of effects. Array can be indexed directly by EffectID.
- Parameters
-
force_refresh | forces a full query from the game, may otherwise cache data from a previous call. |
- Returns
- Data about all effects possible for the current game session.
virtual const std::vector<Effect>& sc2::ObservationInterface::GetEffects |
( |
| ) |
const |
|
pure virtual |
Gets all active effects in vision of the current player.
- Returns
- List of effects.
virtual const SpatialActions& sc2::ObservationInterface::GetFeatureLayerActions |
( |
| ) |
const |
|
pure virtual |
Gets a list of actions performed. For use with the feature layer options.
- Returns
- List of actions.
virtual int32_t sc2::ObservationInterface::GetFoodArmy |
( |
| ) |
const |
|
pure virtual |
virtual int32_t sc2::ObservationInterface::GetFoodCap |
( |
| ) |
const |
|
pure virtual |
virtual int32_t sc2::ObservationInterface::GetFoodUsed |
( |
| ) |
const |
|
pure virtual |
virtual int32_t sc2::ObservationInterface::GetFoodWorkers |
( |
| ) |
const |
|
pure virtual |
virtual const GameInfo& sc2::ObservationInterface::GetGameInfo |
( |
| ) |
const |
|
pure virtual |
Gets the GameInfo struct for the current map.
- Returns
- The current GameInfo struct.
virtual uint32_t sc2::ObservationInterface::GetGameLoop |
( |
| ) |
const |
|
pure virtual |
Get the current game loop for this observation.
- Returns
- The game loop.
virtual int32_t sc2::ObservationInterface::GetIdleWorkerCount |
( |
| ) |
const |
|
pure virtual |
The number of workers that currently have no orders.
- Returns
- Count of idle workers.
virtual int32_t sc2::ObservationInterface::GetMinerals |
( |
| ) |
const |
|
pure virtual |
The mineral count of the player.
- Returns
- The mineral count.
virtual uint32_t sc2::ObservationInterface::GetPlayerID |
( |
| ) |
const |
|
pure virtual |
Gets a unique ID that represents the player.
- Returns
- The player ID.
virtual const std::vector<PowerSource>& sc2::ObservationInterface::GetPowerSources |
( |
| ) |
const |
|
pure virtual |
Gets all power sources associated with the current player.
- Returns
- List of power sources.
virtual const RawActions& sc2::ObservationInterface::GetRawActions |
( |
| ) |
const |
|
pure virtual |
Gets a list of actions performed as abilities applied to units. For use with the raw option.
- Returns
- List of raw actions.
virtual const SC2APIProtocol::Observation* sc2::ObservationInterface::GetRawObservation |
( |
| ) |
const |
|
pure virtual |
A pointer to the low-level protocol data for the current observation. While it's possible to extract most in-game data from this pointer.
<
- Returns
- A const pointer to the Observation.
- See also
- Observation GetObservation()
virtual const SpatialActions& sc2::ObservationInterface::GetRenderedActions |
( |
| ) |
const |
|
pure virtual |
Gets a list of actions performed. For use with the rendered options.
- Returns
- List of actions.
virtual const std::vector<PlayerResult>& sc2::ObservationInterface::GetResults |
( |
| ) |
const |
|
pure virtual |
Gets the results of the game.
- Returns
- Player results if the game ended, an empty vector otherwise.
virtual const Score& sc2::ObservationInterface::GetScore |
( |
| ) |
const |
|
pure virtual |
Gets the detailed current set of scores.
- Returns
- The current score structure.
virtual Point3D sc2::ObservationInterface::GetStartLocation |
( |
| ) |
const |
|
pure virtual |
Gets the initial start location of the player.
- Returns
- Player start position.
virtual const Unit* sc2::ObservationInterface::GetUnit |
( |
Tag |
tag | ) |
const |
|
pure virtual |
Get the unit state as represented by the last call to GetObservation.
- Parameters
-
tag | Unique tag of the unit. |
- Returns
- Pointer to the Unit object.
virtual Units sc2::ObservationInterface::GetUnits |
( |
| ) |
const |
|
pure virtual |
Get a list of all known units in the game.
- Returns
- List of all ally and visible enemy and neutral units.
virtual Units sc2::ObservationInterface::GetUnits |
( |
Unit::Alliance |
alliance, |
|
|
Filter |
filter = {} |
|
) |
| const |
|
pure virtual |
Get all units belonging to a certain alliance and meet the conditions provided by the filter. The unit structure is const data only. Therefore editing that data will not change any in game state. See the ActionInterface for changing Unit state.
- Parameters
-
alliance | The faction the units belong to. |
filter | A functor or lambda used to filter out any unneeded units in the list. |
- Returns
- A list of units that meet the conditions provided by alliance and filter.
virtual Units sc2::ObservationInterface::GetUnits |
( |
Filter |
filter | ) |
const |
|
pure virtual |
Get all units belonging to self that meet the conditions provided by the filter. The unit structure is const data only. Therefore editing that data will not change any in game state. See the ActionInterface for changing Unit state.
- Parameters
-
filter | A functor or lambda used to filter out any unneeded units in the list. |
- Returns
- A list of units that meet the conditions provided by the filter.
virtual const UnitTypes& sc2::ObservationInterface::GetUnitTypeData |
( |
bool |
force_refresh = false | ) |
const |
|
pure virtual |
Gets metadata of units. Array can be indexed directly by UnitID.
- Parameters
-
force_refresh | forces a full query from the game, may otherwise cache data from a previous call. |
- Returns
- Data about all units possible for the current game session.
virtual const Upgrades& sc2::ObservationInterface::GetUpgradeData |
( |
bool |
force_refresh = false | ) |
const |
|
pure virtual |
Gets metadata of upgrades. Array can be indexed directly by UpgradeID.
- Parameters
-
force_refresh | forces a full query from the game, may otherwise cache data from a previous call. |
- Returns
- Data about all upgrades possible for the current game session.
virtual const std::vector<UpgradeID>& sc2::ObservationInterface::GetUpgrades |
( |
| ) |
const |
|
pure virtual |
Gets all upgrades.
- Returns
- List of upgrades.
virtual int32_t sc2::ObservationInterface::GetVespene |
( |
| ) |
const |
|
pure virtual |
The vespene count of the player.
- Returns
- The vespene count.
virtual Visibility sc2::ObservationInterface::GetVisibility |
( |
const Point2D & |
point | ) |
const |
|
pure virtual |
Returns visibility value of the given point for the current player.
- Parameters
-
- Returns
- Visibility.
virtual int32_t sc2::ObservationInterface::GetWarpGateCount |
( |
| ) |
const |
|
pure virtual |
Number of warp gates owned by the player. This value should only be nonzero for Protoss.
- Returns
- Count of warp gates.
virtual bool sc2::ObservationInterface::HasCreep |
( |
const Point2D & |
point | ) |
const |
|
pure virtual |
Returns 'true' if the given point has creep.
- Parameters
-
- Returns
- Creep.
virtual bool sc2::ObservationInterface::IsPathable |
( |
const Point2D & |
point | ) |
const |
|
pure virtual |
Returns 'true' if the given point on the terrain is pathable. This does not.
<
- Parameters
-
- Returns
- Pathable.
virtual bool sc2::ObservationInterface::IsPlacable |
( |
const Point2D & |
point | ) |
const |
|
pure virtual |
Returns 'true' if the given point on the terrain is buildable. This does not.
<
- Parameters
-
- Returns
- Placable.
virtual float sc2::ObservationInterface::TerrainHeight |
( |
const Point2D & |
point | ) |
const |
|
pure virtual |
Returns terrain height of the given point.
- Parameters
-
- Returns
- Height.
The documentation for this class was generated from the following file: