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

Make function robust to existing command structure #280

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yanntm
Copy link

@yanntm yanntm commented Jul 14, 2018

If there is already a building, or, e.g. creep in a location, the placement queries for a CommandCenter (line 19) will answer false.
In the onStart method of a bot, it is likely that your own initial base is blocking at least one expansion location. This led to the algorithm returning points way off the map, or in e.g. (0,0). With this patch, we a posteriori edit the results of the query, so that an existing CC/Hatch/Nexus still counts as a good location to build in.

If there is already a building, or, e.g. creep in a location, the placement queries for a CommandCenter (line 19) will answer false.
In the onStart method of a bot, it is likely that your own initial base is blocking at least one expansion location. This led to the algorithm returning points way off the map, or in e.g. (0,0). With this patch, we a posteriori edit the results of the query, so that an existing CC/Hatch/Nexus still counts as a good location to build in.
@yanntm
Copy link
Author

yanntm commented Jul 14, 2018

The code is non intrusive w.r.t. to the existing code structure so I hope that helps the PR go through.
The only thing I'm not really sure about is that 1.0f squared 2D distance, but obviously I don't want any == on floats. It worked in practice on ladder maps where the previous function had erroneous reporting.

we can avoid a full traversal of the queries
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

Successfully merging this pull request may close these issues.

1 participant