codebackup / bwapi

Automatically exported from code.google.com/p/bwapi
0 stars 0 forks source link

Player.isUpgrading() always returns false for Singularity Charge #360

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Broodwar->self()->isUpgrading(UpgradeTypes::Singularity_Charge) always returns 
false, even when the upgrade is active. I am using the shared memory bridge and 
BWAPI 3.4.

What steps will reproduce the problem?
1. Upgrade Singularity Charge
2. Broodwar->self()->isUpgrading(UpgradeTypes::Singularity_Charge) returns 
false while the upgrade is upgrading

What is the expected output? What do you see instead?
The function should return true while the core is flashing.

What version of the product are you using? On what operating system?
Win 7, BWAPI 3.4, JNI-BWAPI, Using the shared memory bridge.

Please provide any additional information below.
There is a workaround for this issue, which is to call getRemainingUpgradeTime 
on the core. 

Original issue reported on code.google.com by bgwe...@gmail.com on 9 Mar 2011 at 9:53

GoogleCodeExporter commented 9 years ago
I just tested it using the latest revision and it works(both loaded and bridge 
via AIModuleLoader). I'll keep the issue up a bit longer in case I am missing 
something.

Original comment by AHeinerm on 9 Mar 2011 at 10:26

GoogleCodeExporter commented 9 years ago
Also, I don't see any commit logs that addresses this issue.

Original comment by AHeinerm on 9 Mar 2011 at 10:32

GoogleCodeExporter commented 9 years ago
I just tried out the "Protoss Air Weapons" upgrade and the function works 
properly for that upgrade type, so this may be specific to the dragoon range 
upgrade. 

It seems that the cause of my trouble is that the IDs of the UpgradeTypes is 
changing between frames. There's a weird behavior where the ID of the upgrade 
type keeps changing. Here's an output of active upgrades after starting the 
range upgrade:

Frames since upgrade started: 0 Upgrade (ID): 33  Type is Singularity: true
Frames since upgrade started: 1 Upgrade (ID): 31  Type is Singularity: false
Frames since upgrade started: 2 Upgrade (ID): 33  Type is Singularity: true
Frames since upgrade started: 3 Upgrade (ID): 31  Type is Singularity: false
Frames since upgrade started: 4 Upgrade (ID): 31  Type is Singularity: false
Frames since upgrade started: 5 Upgrade (ID): 31  Type is Singularity: false
Frames since upgrade started: 6 Upgrade (ID): 31  Type is Singularity: false
Frames since upgrade started: 7 Upgrade (ID): 31  Type is Singularity: false
Frames since upgrade started: 8 Upgrade (ID): 31  Type is Singularity: false
Frames since upgrade started: 9 Upgrade (ID): 31  Type is Singularity: false 

I'm not sure whats going on here. I'm trying to identify upgrade types using 
the ID.

Original comment by bgwe...@gmail.com on 9 Mar 2011 at 11:46

GoogleCodeExporter commented 9 years ago
33 is Singularity Charge and 31 is Gamete Meiosis (Queen energy).
So the actual type is changing? Are you using any pointers to types, or 
assigning a value to a type? No idea what the cause could be here.

Possibilities:
  Buffer overflow
  Variable being misused somewhere

It may be specific to JNI-BWAPI.
In my test the value remained constant throughout the entire game.

Original comment by AHeinerm on 10 Mar 2011 at 4:23

GoogleCodeExporter commented 9 years ago
Lets mark this as fixed, and JNI-BWAPI specific for now. 

Original comment by bgwe...@gmail.com on 10 Mar 2011 at 5:59