My Project
Public Member Functions | Public Attributes | List of all members
sc2::ObservationImp Class Reference
Inheritance diagram for sc2::ObservationImp:
sc2::ObservationInterface

Public Member Functions

 ObservationImp (ProtoInterface &proto, ObservationPtr &observation, ResponseObservationPtr &response)
 
void ClearFlags ()
 
uint32_t GetPlayerID () const
 Gets a unique ID that represents the player.
 
uint32_t GetGameLoop () const final
 Get the current game loop indicated by the last observation.
 
const Units & GetUnits () const final
 Get a list of all known units in the game.
 
Units GetUnits (Unit::Alliance alliance, Filter filter={}) const final
 
const UnitGetUnit (uint64_t tag) const final
 
const UnitGetPreviousUnit (uint64_t tag) const final
 
const Units & GetUnitsAdded () const final
 
const Units & GetUnitsRemoved () const final
 
const RawActions & GetRawActions () const final
 
const ScoreGetScore () const final
 
const Abilities & GetAbilityData (bool force_refresh=false) const final
 
const UnitTypes & GetUnitTypeData (bool force_refresh=false) const final
 
const MapInfoGetMapInfo () const final
 
int32_t GetMinerals () const final
 The mineral count of the player.
 
int32_t GetVespene () const final
 The vespene count of the player.
 
int32_t GetFoodCap () const final
 
int32_t GetFoodUsed () const final
 
int32_t GetFoodArmy () const final
 
int32_t GetFoodWorkers () const final
 
int32_t GetIdleWorkerCount () const final
 The number of workers that currently have no orders.
 
int32_t GetArmyCount () const final
 
int32_t GetWarpGateCount () const final
 Number of warp gates owned by the player. This value should only be nonzero for Protoss.
 
int32_t GetLarvaCount () const final
 Number of available larva. This value should only be nonzer for zerg.
 
const GameStateProtocol::Observation * GetRawObservation () const final
 A pointer to the last Observation obtained from GetObservation. While it's possible to extract most in game data from this pointer. More...
 
bool UpdateObservation (ClientEvents *client_events)
 
void IssueCallbacks (ClientEvents *client_events)
 

Public Attributes

ProtoInterfaceproto_
 
ObservationPtrobservation_
 
ResponseObservationPtrresponse_
 
uint32_t player_id_
 
Units units_
 
Units units_previous_
 
UnitIdxMap units_previous_map_
 
Units units_added_
 
Units units_removed_
 
uint32_t current_game_loop_
 
RawActions raw_actions_
 
MapInfo map_info_
 
bool map_info_cached_
 
int32_t minerals_
 
int32_t vespene_
 
int32_t food_cap_
 
int32_t food_used_
 
int32_t food_army_
 
int32_t food_workers_
 
int32_t idle_worker_count_
 
int32_t army_count_
 
int32_t warp_gate_count_
 
int32_t larva_count_
 
Abilities abilities_
 
UnitTypes unit_types_
 
Score score_
 
bool abilities_cached_
 
bool unit_types_cached
 

Member Function Documentation

◆ GetFoodArmy()

int32_t sc2::ObservationImp::GetFoodArmy ( ) const
inlinefinalvirtual

The total supply consumed by army units alone.

See also
GetFoodUsed() GetFoodWorkers()

Implements sc2::ObservationInterface.

◆ GetFoodCap()

int32_t sc2::ObservationImp::GetFoodCap ( ) const
inlinefinalvirtual

The total supply cap given the players max possible supply.

See also
GetFoodUsed() GetFoodArmy() GetFoodWorkers()

Implements sc2::ObservationInterface.

◆ GetFoodUsed()

int32_t sc2::ObservationImp::GetFoodUsed ( ) const
inlinefinalvirtual

he total supply used by the player as defined: GetFoodArmy() + GetFoodWorkers().

See also
GetFoodArmy() GetFoodWorkers()

Implements sc2::ObservationInterface.

◆ GetFoodWorkers()

int32_t sc2::ObservationImp::GetFoodWorkers ( ) const
inlinefinalvirtual

The total supply consumed by workers units alone.

See also
GetFoodArmy() GetFoodUsed()

Implements sc2::ObservationInterface.

◆ GetPreviousUnit()

const Unit * sc2::ObservationImp::GetPreviousUnit ( uint64_t  tag) const
finalvirtual

Get the unit state as represented by the the call to GetObservation two steps ago. This is useful for calculating deltas between Unit states. It is unsafe to assume GetUnit and GetPreviousUnit will both necessarily return a Unit given the same tag. The Unit may have been created or destroyed in the last step.

Parameters
tagUnique tag of the unit.
Returns
Pointer to the Unit object.

Implements sc2::ObservationInterface.

◆ GetRawObservation()

const GameStateProtocol::Observation * sc2::ObservationImp::GetRawObservation ( ) const
finalvirtual

A pointer to the last Observation obtained from GetObservation. While it's possible to extract most in game data from this pointer.

<

Returns
A const pointer to the Observation.
See also
Observation GetObservation()

Implements sc2::ObservationInterface.

◆ GetUnit()

const Unit * sc2::ObservationImp::GetUnit ( uint64_t  tag) const
finalvirtual

Get the unit state as represented by the last call to GetObservation.

Parameters
tagUnique tag of the unit.
Returns
Pointer to the Unit object.

Implements sc2::ObservationInterface.

◆ GetUnits()

Units sc2::ObservationImp::GetUnits ( Unit::Alliance  alliance,
Filter  filter = {} 
) const
finalvirtual

Get all units belonging to a certain alliance and in regards to a filter. The Unit objects returned are simply copies of POD types. Therefore editing that data will not change any in game state. See the ActionInterface for changing Unit state.

Parameters
allianceThe faction the units belong to.
filterA 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.

Implements sc2::ObservationInterface.

◆ GetUnitsAdded()

const Units & sc2::ObservationImp::GetUnitsAdded ( ) const
finalvirtual

Gets a list of units added in the previous step. You could also hook into the OnUnitCreated event for this data on a per Unit basis.

See also
OnUnitCreated()

Implements sc2::ObservationInterface.

◆ GetUnitsRemoved()

const Units & sc2::ObservationImp::GetUnitsRemoved ( ) const
finalvirtual

Gets a list of units added in the previous step. You could also hook into the OnUnitCreated event for this data on a per Unit basis.

See also
OnUnitCreated()

Implements sc2::ObservationInterface.


The documentation for this class was generated from the following file: