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

Cache expansion_locations #200

Open
Dentosal opened this issue Jan 12, 2019 · 3 comments
Open

Cache expansion_locations #200

Dentosal opened this issue Jan 12, 2019 · 3 comments

Comments

@Dentosal
Copy link
Owner

No description provided.

@tweakimp
Copy link
Contributor

Arent they cached here?

@Dentosal
Copy link
Owner Author

Seems like they are. I'll verify that this before closing.

@merfolk
Copy link
Contributor

merfolk commented Jan 13, 2019

The issue is that expansion_locations needs to be called once for the values to be cached.

If the call is made for the first time inside on_step() function it can cause a timeout for the whole bot.

Our bot currently handles the first call like below, but I feel the python-sc2 library should already have the values cached.

    def _prepare_first_step(self):
        """First step extra preparations. Must not be called before _prepare_step."""
        sc2.BotAI._prepare_first_step(self)
        # Call expansion_locations so they are cached for the rest of the game.
        # This can take a long time! Hopefully this overridden method 
        # will not be subject to the timeout limit.
        self.expansion_locations.keys()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants