Duplicate actions in Realtime mode
I noticed that some actions are run twice when realtime=True in sc2.run_game(), even though they shouldn't. This doesn't seem to happen when realtime=False.
For example, if I run examples/proxy_rax.py in realtime, there is sometimes an extra SCV queued at the CC, even though the code says that it should only train an SCV if the CC queue is empty. I also sometimes get NotEnoughMinerals error for the same reason, because it runs the build SCV action twice, but can't afford the second one (even though there's the self.can_afford(SCV) check).
I'm on Windows 10, if this has anything to do with it.
I have this too. I'll try to look at it. Might be an issue with the API itself, but more likely my mistake.
Yeah, I actually talked with some people on Discord that are using other frameworks, and I think they had similar issues too, so I'm afraid it might be a problem with the Blizzard API itself like you say!
I guess a small workaround could be to use
if iteration % x == 0: # where x is some number between 2 and 6
in places where you want to make sure that you never queue a second unit or never build a second building.
It happened to me too where the AI built a second extractor when it should only have built one. Adding iteration % 6 == 0 fixed it for me.
So in the proxy rax bot, that if statement could look like this:
if self.can_afford(SCV) and self.workers.amount < 16 and cc.noqueue and iteration % 6 == 0:
await self.do(cc.train(SCV))
EDIT: After some testing, this only makes sense to use in realtime=True mode
@Dentosal any luck?
No matter realtime true or false when I try to get tech lab ability for my factory it's gonna build an extra factory . Sometimes I have to move it !