SC2API
An API for AI for StarCraft II
sc2_search.h
1 #pragma once
2 
3 #include "sc2api/sc2_unit.h"
4 #include "sc2api/sc2_common.h"
6 
7 #include <vector>
8 
9 namespace sc2 {
10 
11 namespace search {
12 
13 // Clusters units within some distance of each other and returns a list of them and their center of mass.
14 std::vector<std::pair<Point3D, std::vector<Unit> > > Cluster(const Units& units, float distance_apart);
15 
17  // Some nice parameters that generally work but may require tuning for certain maps.
19  radiuses_({ 6.4f, 5.3f }),
20  circle_step_size_(0.5f),
21  cluster_distance_(15.0f),
22  debug_(nullptr) {
23  }
24 
25  // The various radius to check at from the center of an expansion.
26  std::vector<float> radiuses_;
27 
28  // With what granularity to step the circumference of the circle.
29  float circle_step_size_;
30 
31  // With what distance to cluster mineral/vespene in, this will be used for center of mass calulcation.
32  float cluster_distance_;
33 
34  // If filled out CalculateExpansionLocations will render spheres to show what it calculated.
35  DebugInterface* debug_;
36 };
37 
38 // Calculates expansion locations, this call can take on the order of 100ms since it makes blocking queries to SC2 so call it once and cache the reults.
39 std::vector<Point3D> CalculateExpansionLocations(const ObservationInterface* observation, QueryInterface* query, ExpansionParameters parameters=ExpansionParameters());
40 
41 }
42 
43 }
Definition: sc2_search.h:16
Common data types, including points, rectangles and colors.
Unit data in an observation.
Definition: sc2_interfaces.h:236
Definition: sc2_action.h:9
A set of public facing interfaces used to query game state.
The ObservationInterface reflects the current state of the game. Guaranteed to be valid when OnGameSt...
Definition: sc2_interfaces.h:47
Definition: sc2_interfaces.h:423