Blizzard / s2client-api

StarCraft II Client - C++ library supported on Windows, Linux and Mac designed for building scripted bots and research using the SC2API.
MIT License
1.66k stars 282 forks source link

expose player race in ObservationInterface #293

Closed pedronahum closed 5 years ago

pedronahum commented 5 years ago

Hi,

I couldn't find a way to extract from a replay the race of the player (and of the corresponding opponent). It seems that only the Player ID is exposed in the ObservationInterface.

obs->GetUnitTypeData() could be used to create a logic to obtain the race of the player, but was wondering if there is a simpler way.

Thanks!!!

pedronahum commented 5 years ago

Closing this, as there is an indirect way to obtain the race.

auto game_info = obs->GetGameInfo();
std::vector<sc2::PlayerInfo> player_information = game_info.player_info;
auto which_race = player_information[0].race_actual;
std::cout << "Player Race:" << which_race << std::endl;