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

Players incorrectly being reported as observers in BWAPI 4.2.0 clients #38

Open
Jabbo16 opened this issue May 12, 2018 · 10 comments
Open
Labels
original bug A bug present in the original C++ BWAPI that also affects BWAPI4J pending tests An issue seems to be fixed but requires testing before being closed.

Comments

@Jabbo16
Copy link
Contributor

Jabbo16 commented May 12, 2018

This code called at onStart() while running a Melee game mode match:

for(Player p : bw.getAllPlayers()) {
    System.out.println("playername: " + p.getName() + " is observer: " + p.isObserver());
}

Returns all players as being observers:

playername: Cronus Wing is observer: true
playername: bwapi is observer: true
playername: Neutral is observer: true

The only Player that should be observer is Neutral.

@adakitesystems
Copy link
Collaborator

adakitesystems commented May 12, 2018

Thanks for the bug report.

Confirmed. However, in Linux + OpenBW + BWAPI4J, these players are not reported as observers. I suspect something to do with the bridge for Windows. Looking into recompiling the bridge. The values seem to be getting set correctly:

intBuf[index++] = player->isObserver() ? 1 : 0;

and

this.isObserver = playerData[index + Player.IS_OBSERVER_INDEX] == 1;

@adakitesystems
Copy link
Collaborator

adakitesystems commented May 12, 2018

Update:

  • Recompiling the bridge for Windows did not resolve the issue.
  • As a manual debug test, changing intBuf[index++] = player->isObserver() ? 1 : 0; to intBuf[index++] = player->isObserver() ? 0 : 0; in the Windows bridge resulted in the players being correctly reported as isObserver() == false.
  • Somehow, the Windows bridge is reporting the incorrect value but the Linux bridge appears to report the correct value.

Update 2:

  • I reverted to a very old commit aca6040 and observed the same issue.

@Jabbo16
Copy link
Contributor Author

Jabbo16 commented May 12, 2018

Shouldnt the code be:

intBuf[index++] = player->isObserver() == 1 ? 1 : 0

BWAPI isObserver() method returns 1 if observer and 0 if not.

@adakitesystems
Copy link
Collaborator

PlayerInterface.isObserver() in C++ is a bool function. That is the correct syntax. Even if it wasn't a bool, that is still valid syntax. I tried with == 1 anyway and observed the same incorrect behavior.
bool

@Jabbo16
Copy link
Contributor Author

Jabbo16 commented May 12, 2018

Ok, then forget what I said.

What a weird behaviour.

@adakitesystems
Copy link
Collaborator

Using a completely separate C++ BWAPI 4.2.0 client project with no Java, I am getting the same incorrect behavior with the client version but not with the module version. @Jabbo16, can you verify this as well, please?

@Jabbo16
Copy link
Contributor Author

Jabbo16 commented May 12, 2018

I checked module before and got correct behaviour, both players reported as not observers, just the Neutral player as observer.

Looks like Client bug?

@adakitesystems
Copy link
Collaborator

Yes, it looks like a BWAPI client bug that is present in 4.2.0, 4.1.2, and maybe other versions. The module appears unaffected. If/when it gets fixed, someone (if I'm not around) should use the updated BWAPI libs to recompile the bridge and then close this issue.

@adakitesystems adakitesystems added the original bug A bug present in the original C++ BWAPI that also affects BWAPI4J label May 12, 2018
@adakitesystems adakitesystems added the pending merge A fix has been proposed but is awaiting approval, review, or a merge from another branch. label Aug 21, 2018
@adakitesystems
Copy link
Collaborator

This issue has been fixed in the develop branch of C++ BWAPI. When an official version is released with this fix, the BWAPI4JBridge just needs to update to the new BWAPI version and recompile the bridge. Then, this issue can be closed.

@adakitesystems adakitesystems changed the title Players incorrectly being reported as observers Players incorrectly being reported as observers in BWAPI 4.2.0 clients Aug 21, 2018
@adakitesystems
Copy link
Collaborator

Upgraded to BWAPI v4.4.0 in 83423a9 which should resolve this. Needs to be tested first.

@adakitesystems adakitesystems added pending tests An issue seems to be fixed but requires testing before being closed. and removed pending merge A fix has been proposed but is awaiting approval, review, or a merge from another branch. labels Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
original bug A bug present in the original C++ BWAPI that also affects BWAPI4J pending tests An issue seems to be fixed but requires testing before being closed.
Projects
None yet
Development

No branches or pull requests

2 participants