Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the possible start locations for a player or force #863

Open
dgant opened this issue Feb 12, 2021 · 1 comment
Open

Expose the possible start locations for a player or force #863

dgant opened this issue Feb 12, 2021 · 1 comment
Labels

Comments

@dgant
Copy link
Contributor

dgant commented Feb 12, 2021

I've attached a copy of the map Aztec 2.1. The map has three playable start locations but BWAPI exposes eight start locations. The inability to determine which of these start locations are playable is a(n extremely minor) missing feature.

This map was probably converted from an "Observers" style map. That means it was originally meant to be played in Use Map Settings with some people playing and some people just observing. So it has a Players force with three normal start locations, and an Observers force with four start locations in the middle of the map, with the intent that Observers would play Terran and lift off and watch the game via Share Vision.

At some point in the map's history, the Observers force was rendered unplayable, so on the surface it appears to be a normal ladder map. But from the perspective of bots, it's an 8 player map and the API doesn't expose any information which indicates otherwise.

image

image

(3)Aztec2.1.zip

@dgant dgant changed the title Expose the possible start locations for a player or force Expose the possible start locations for a force Feb 12, 2021
@dgant dgant changed the title Expose the possible start locations for a force Expose the possible start locations for a player or force Feb 12, 2021
@heinermann
Copy link
Member

heinermann commented Feb 12, 2021

with the intent that Observers would play Terran and lift off and watch the game via Share Vision

If it were this situation then I'm fine with the behaviour. From the perspective of BWAPI they are participants in the game for 2 reasons:

  1. An opponent player can do this legitimately.
  2. UMS maps and even other game types can have all sorts of configurations, some of which could be mistakenly identified as this scenario.

BWAPI should be able to function on all maps and all game types so using base detection with minerals is not a legitimate way to determine participation either.


That being said I loaded the map up in Remastered and my own custom map editor to see what was going on, before realizing I didn't finish programming the player settings dialog in it. So I opened it in a hex editor to view the corresponding sections since it wouldn't open in SCMDraft. In OWNR the players are set to Inactive so these should indeed be excluded.

Relevant code here:

for (int i = 0; i < BW::PLAYABLE_PLAYER_COUNT; ++i)
{
// Skip Start Locations that don't exist
if (BW::BWDATA::Game.startPositions[i] == Positions::Origin)
continue;
// If the game is UMS and player is observer and race is not (UserSelect OR invalid player type), skip
if ( this->getGameType() == GameTypes::Use_Map_Settings &&
this->players[i]->isObserver() &&
(bRaceInfo[i] != Races::Enum::Select ||
(bOwnerInfo[i] != PlayerTypes::Computer &&
bOwnerInfo[i] != PlayerTypes::Player &&
bOwnerInfo[i] != PlayerTypes::EitherPreferComputer &&
bOwnerInfo[i] != PlayerTypes::EitherPreferHuman)) )
continue;
// add start location
startLocations.push_back(TilePosition(BW::BWDATA::Game.startPositions[i] - Position(64, 48)));
}

There we do a naiive check to see if the start location is at the origin, when this is in fact incorrect. We need to

  1. Determine which player types are valid (including invalid/extended/overflow types).
    • Specifically for UMS and whether their units will appear if they are preplaced or creatable with triggers.
  2. Determine if players can have a start location at exactly 0,0 (I suspect yes for UMS).
  3. Change the logic accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants