SC2API
An API for AI for StarCraft II
Classes | Public Member Functions | List of all members
sc2::QueryInterface Class Referenceabstract

#include <sc2_interfaces.h>

Classes

struct  PathingQuery
 
struct  PlacementQuery
 

Public Member Functions

virtual AvailableAbilities GetAbilitiesForUnit (const Unit *unit, bool ignore_resource_requirements=false)=0
 
virtual std::vector< AvailableAbilitiesGetAbilitiesForUnits (const Units &units, bool ignore_resource_requirements=false)=0
 
virtual float PathingDistance (const Point2D &start, const Point2D &end)=0
 
virtual float PathingDistance (const Unit *start, const Point2D &end)=0
 
virtual std::vector< float > PathingDistance (const std::vector< PathingQuery > &queries)=0
 Issues multiple pathing queries.
 
virtual bool Placement (const AbilityID &ability, const Point2D &target_pos, const Unit *unit=nullptr)=0
 
virtual std::vector< bool > Placement (const std::vector< PlacementQuery > &queries)=0
 

Detailed Description

The QueryInterface provides additional data not contained in the observation.

Performance note:

Member Function Documentation

virtual AvailableAbilities sc2::QueryInterface::GetAbilitiesForUnit ( const Unit unit,
bool  ignore_resource_requirements = false 
)
pure virtual

Returns a list of abilities represented as a uint32_t see the ABILITY_ID enum for their corresponding, named, representations.

Parameters
tagTag of unit.
ignore_resource_requirementsIgnores food, mineral and gas costs, as well as cooldowns.
Returns
Abilities for the unit.
virtual std::vector<AvailableAbilities> sc2::QueryInterface::GetAbilitiesForUnits ( const Units &  units,
bool  ignore_resource_requirements = false 
)
pure virtual

Issues multiple available abilities queries. Batch version.

Parameters
tagTags of units.
ignore_resource_requirementsIgnores food, mineral and gas costs, as well as cooldowns.
Returns
Abilities for the units.
virtual float sc2::QueryInterface::PathingDistance ( const Point2D start,
const Point2D end 
)
pure virtual

Returns pathing distance between two locations. Takes into account unit movement properties (e.g. Flying).

Parameters
startStarting point.
endEnd point.
Returns
Distance between the two points.
virtual float sc2::QueryInterface::PathingDistance ( const Unit start,
const Point2D end 
)
pure virtual

Returns pathing distance between a unit and a target location. Takes into account unit movement properties (e.g. Flying). Batch version.

Parameters
startStarting points.
endEnd points.
Returns
Distances between the two points.
virtual bool sc2::QueryInterface::Placement ( const AbilityID ability,
const Point2D target_pos,
const Unit unit = nullptr 
)
pure virtual

Returns whether a building can be placed at a location. The placing unit field is optional. This is only used for cases where the placing unit plays a role in the placement grid test (e.g. A flying barracks building an add-on requires room for both the barracks and add-on).

Parameters
abilityAbility for building or moving a structure.
endtarget_pos Position to attempt placement on.
placing_unit_tag_(Optional) The unit that is moving, if moving a structure.
Returns
If placement is possible.
virtual std::vector<bool> sc2::QueryInterface::Placement ( const std::vector< PlacementQuery > &  queries)
pure virtual

A batch version of the above Placement query. Takes an array of abilities, positions and optional unit tags and returns a matching array of bools indicating if placement is possible.

Parameters
queriesPlacement queries.
Returns
Array of bools indicating if placement is possible.

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