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

Duplicate actions in Realtime mode #38

Open
Hannessa opened this issue May 21, 2018 · 5 comments
Open

Duplicate actions in Realtime mode #38

Hannessa opened this issue May 21, 2018 · 5 comments
Labels

Comments

@Hannessa
Copy link

Hannessa commented May 21, 2018

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.

@Dentosal
Copy link
Owner

I have this too. I'll try to look at it. Might be an issue with the API itself, but more likely my mistake.

@Hannessa
Copy link
Author

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!

@BurnySc2
Copy link
Collaborator

BurnySc2 commented May 30, 2018

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

@ghost
Copy link

ghost commented Jul 4, 2018

@Dentosal any luck?

@beni-Lx
Copy link

beni-Lx commented Sep 30, 2018

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 !

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

4 participants