Blizzard / Blizzard/s2client-api

race_actual always defaults to sc2::Race::Protoss

Open
#294 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
280
PR merge metrics
No merged PRs in 30d

Description

Hi,
Maybe someone can point me in the right direction.
I am currently trying to analyze replays (3.16.1 Pack 1) using the Linux package 3.16.1 and regardless of the UnitTypeData (eg, CommandCenter), player_info always returns "sc2::Race::Protoss".

```
void OnGameStart() final {
const sc2::ObservationInterface* obs = Observation();
assert(obs->GetUnitTypeData().size() > 0);
count_units_built_.resize(obs->GetUnitTypeData().size());
std::fill(count_units_built_.begin(), count_units_built_.end(), 0);

std::cout << "Map name: " << obs->GetGameInfo().map_name << std::endl;

// Get the race of the players
sc2::GameInfo game_info = obs->GetGameInfo();
std::vector player_information = game_info.player_info;

for (uint32_t i = 0; i < player_information.size(); ++i){
sc2::PlayerInfo player = player_information[i];
sc2::Race race = player.race_actual;
if(race == sc2::Race::Protoss) {
std::cout << "Player ID: " << player.player_id << "; Player's Race : " << "Protoss" << std::endl;
} else if(race == sc2::Race::Terran){
std::cout << "Player ID: " << player.player_id << "; Player's Race : " <<"Terran" << std::endl;
} else if(race == sc2::Race::Zerg){
std::cout << "Player ID: " << player.player_id << "; Player's Race : " << "Zerg" << std::endl;
} else {
std::cout << "Player ID: " << player.player_id << "; Player's Race : " << "Random" << std::endl;
}
}
}

```

I am seeing a similar issue with the map_name, but maybe I am very lucky that all my replay tests have been done in the map "Odyssey LE".

Any pointer is greatly appreciated.

Thanks,

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.