bwapi icon indicating copy to clipboard operation
bwapi copied to clipboard

getScreenPosition behaves different for client and module bots

Open NiteKat opened this issue 3 years ago • 1 comments

getScreenPosition behaves differently for client and module bots in 4.4.0 and probably other 4.X versions too.

getScreenPosition returns Positions::Unknown if UserInput flag is not enabled for a module bot, and screen position if it is enabled. It does not care about that flag for client bots, and will always return the screen position. Module - https://github.com/bwapi/bwapi/blob/v4.4.0/bwapi/BWAPI/Source/BWAPI/GameImpl.cpp#L188 Client - https://github.com/bwapi/bwapi/blob/v4.4.0/bwapi/BWAPIClient/Source/GameImpl.cpp#L445

setScreenPosition does not care about the flag either type of bot.

Most likely correct behavior should be for module bots to behave like client bots, and just always return the screen position regardless of user input flag.

NiteKat avatar Jul 14 '21 04:07 NiteKat

I believe this is working correctly. https://github.com/bwapi/bwapi/blob/v4.4.0/bwapi/BWAPIClient/Source/GameImpl.cpp#L445 is logic for the client API but the data is set correctly on the backend, subject to the same code path as the module API: https://github.com/bwapi/bwapi/blame/3438abd8e0222f37934ba62b2130c3933b067678/bwapi/BWAPI/Source/BWAPI/GameImpl.cpp#L186

Empirically I can confirm that PurpleWave (a client, albeit using JBWAPI instead of the client API) is not receiving accurate screen positions when user input is disabled.

dgant avatar Jul 14 '21 14:07 dgant