|
ProtoBot
|
The BuildingPlacer is the way ProtoBot is able to utilize the BWEB blocks generated to place down buildings. This allows for a single class to be able to find places to build and returns information about the placement info if anything goes wrong.
When the BuildingPlacer is first created the Blocks that generated are stored into lists that ProtoBot is able to use based on the building type of a ResourceRequest. This allows the BuildingPlacer to find a suitable generated locations without having to loop through ever single block on the map.
More blocks are added based on the areas the ProtoBot controls. To prevent the risk of ProtoBot building in enemy territory, ProtoBot will only build in the areas that ProtoBot currently 'controls'. When a nexus is created this expands ProtoBot's influence and makes more blocks avalible if any are generated in that location.
More...
#include <BuildingPlacer.h>
Public Member Functions | |
| BuildingPlacer (BuildManager *buildReference) | |
| PlacementInfo | getPositionToBuild (BWAPI::UnitType, const BWEM::Base *) |
| bool | alreadyUsingTiles (BWAPI::TilePosition, int, int, bool assimilator) |
| Checks if a location to place a building already has another unit ontop of it (will only consider buildings not combat units). | |
| bool | checkPower (BWAPI::TilePosition, BWAPI::UnitType) |
| BWAPI::TilePosition | checkBuildingBlocks () |
| Finda an available Block that has no power in the power tile location. | |
| BWAPI::TilePosition | checkPowerReserveBlocks () |
| Checks Blocks of size 2x2 (tiles) that can be used in order to place down pylons for supply. | |
| BWAPI::TilePosition | findAvailableExpansion () |
| Checks BWEM expansion locations for possible place to construct resource depot. | |
| BWAPI::TilePosition | findAvailableGyser (const BWEM::Base *) |
| Checks a base to place down an assimlator ontop of a vespene gyser. | |
| BWAPI::TilePosition | findAvaliblePlacement (BWAPI::UnitType) |
| Standard call for buildings to find a location to be placed other than refineries, resource depots, and supply units. | |
| int | numberOfFullPoweredLargePlacements () |
| void | drawPoweredTiles () |
| void | onStart () |
| Update Block information to reflect generated BWEB Blocks and reset values to reflect a beggining game state. | |
| void | onUnitCreate (BWAPI::Unit) |
| Updates BWEM to reflect the current state of StarCraft game. | |
| void | onUnitComplete (BWAPI::Unit) |
| Updates BWEM to reflect the current state of StarCraft game. | |
| void | onUnitDestroy (BWAPI::Unit) |
| Updates BWEM to reflect the current state of StarCraft game. | |
| void | onUnitMorph (BWAPI::Unit) |
| Updates BWEM to reflect the current state of StarCraft game. | |
| void | onUnitDiscover (BWAPI::Unit) |
| Updates BWEM to reflect the current state of StarCraft game. | |
Public Attributes | |
| int | Powered_LargePlacements = 0 |
| int | Powered_MediumPlacements = 0 |
| int | Used_LargeBuildingPlacements |
| int | Used_MediumBuildingPlacements |
| BuildManager * | buildReference |
Private Attributes | |
| std::map< BWAPI::TilePosition, BlockData > | Block_Information |
| std::unordered_set< const BWEM::Area * > | AreasOccupied |
| std::vector< BWEB::Block > | ProtoBot_Blocks |
| std::unordered_map< const BWEM::Area *, std::vector< BWEB::Block > > | Area_Blocks |
| int | mapWidth = 0 |
| int | mapHeight = 0 |
| int | nexusCount = 0 |
| bool | debug = false |
The BuildingPlacer is the way ProtoBot is able to utilize the BWEB blocks generated to place down buildings. This allows for a single class to be able to find places to build and returns information about the placement info if anything goes wrong.
When the BuildingPlacer is first created the Blocks that generated are stored into lists that ProtoBot is able to use based on the building type of a ResourceRequest. This allows the BuildingPlacer to find a suitable generated locations without having to loop through ever single block on the map.
More blocks are added based on the areas the ProtoBot controls. To prevent the risk of ProtoBot building in enemy territory, ProtoBot will only build in the areas that ProtoBot currently 'controls'. When a nexus is created this expands ProtoBot's influence and makes more blocks avalible if any are generated in that location.
Definition at line 69 of file BuildingPlacer.h.
| BuildingPlacer::BuildingPlacer | ( | BuildManager * | buildReference | ) |
Definition at line 5 of file BuildingPlacer.cpp.
| bool BuildingPlacer::alreadyUsingTiles | ( | BWAPI::TilePosition | position, |
| int | width, | ||
| int | height, | ||
| bool | assimilator = false ) |
Checks if a location to place a building already has another unit ontop of it (will only consider buildings not combat units).
| Top Left Tile Position to place building | |
| Width | |
| Height | |
| isAssimilator |
Definition at line 11 of file BuildingPlacer.cpp.
| BWAPI::TilePosition BuildingPlacer::checkBuildingBlocks | ( | ) |
Finda an available Block that has no power in the power tile location.
Definition at line 54 of file BuildingPlacer.cpp.
| bool BuildingPlacer::checkPower | ( | BWAPI::TilePosition | location, |
| BWAPI::UnitType | buildingType ) |
Definition at line 31 of file BuildingPlacer.cpp.
| BWAPI::TilePosition BuildingPlacer::checkPowerReserveBlocks | ( | ) |
Checks Blocks of size 2x2 (tiles) that can be used in order to place down pylons for supply.
Definition at line 101 of file BuildingPlacer.cpp.
| void BuildingPlacer::drawPoweredTiles | ( | ) |
Definition at line 298 of file BuildingPlacer.cpp.
| BWAPI::TilePosition BuildingPlacer::findAvailableExpansion | ( | ) |
Checks BWEM expansion locations for possible place to construct resource depot.
Definition at line 154 of file BuildingPlacer.cpp.
| BWAPI::TilePosition BuildingPlacer::findAvailableGyser | ( | const BWEM::Base * | base | ) |
Checks a base to place down an assimlator ontop of a vespene gyser.
| Base (expansion location) |
Definition at line 200 of file BuildingPlacer.cpp.
| BWAPI::TilePosition BuildingPlacer::findAvaliblePlacement | ( | BWAPI::UnitType | type | ) |
Standard call for buildings to find a location to be placed other than refineries, resource depots, and supply units.
| UnitType (building type to be constructed) |
Definition at line 268 of file BuildingPlacer.cpp.
| PlacementInfo BuildingPlacer::getPositionToBuild | ( | BWAPI::UnitType | type, |
| const BWEM::Base * | base ) |
Definition at line 363 of file BuildingPlacer.cpp.
| int BuildingPlacer::numberOfFullPoweredLargePlacements | ( | ) |
Definition at line 347 of file BuildingPlacer.cpp.
| void BuildingPlacer::onStart | ( | ) |
Update Block information to reflect generated BWEB Blocks and reset values to reflect a beggining game state.
Definition at line 451 of file BuildingPlacer.cpp.
| void BuildingPlacer::onUnitComplete | ( | BWAPI::Unit | unit | ) |
Updates BWEM to reflect the current state of StarCraft game.
| Unit |
Definition at line 547 of file BuildingPlacer.cpp.
| void BuildingPlacer::onUnitCreate | ( | BWAPI::Unit | unit | ) |
Updates BWEM to reflect the current state of StarCraft game.
| Unit |
Definition at line 540 of file BuildingPlacer.cpp.
| void BuildingPlacer::onUnitDestroy | ( | BWAPI::Unit | unit | ) |
Updates BWEM to reflect the current state of StarCraft game.
| Unit |
Definition at line 610 of file BuildingPlacer.cpp.
| void BuildingPlacer::onUnitDiscover | ( | BWAPI::Unit | unit | ) |
Updates BWEM to reflect the current state of StarCraft game.
| Unit |
Definition at line 719 of file BuildingPlacer.cpp.
| void BuildingPlacer::onUnitMorph | ( | BWAPI::Unit | unit | ) |
Updates BWEM to reflect the current state of StarCraft game.
| Unit |
Definition at line 714 of file BuildingPlacer.cpp.
|
private |
Definition at line 85 of file BuildingPlacer.h.
|
private |
Definition at line 78 of file BuildingPlacer.h.
|
private |
Definition at line 75 of file BuildingPlacer.h.
| BuildManager* BuildingPlacer::buildReference |
Definition at line 100 of file BuildingPlacer.h.
|
private |
Definition at line 93 of file BuildingPlacer.h.
|
private |
Definition at line 88 of file BuildingPlacer.h.
|
private |
Definition at line 87 of file BuildingPlacer.h.
|
private |
Definition at line 91 of file BuildingPlacer.h.
| int BuildingPlacer::Powered_LargePlacements = 0 |
Definition at line 96 of file BuildingPlacer.h.
| int BuildingPlacer::Powered_MediumPlacements = 0 |
Definition at line 97 of file BuildingPlacer.h.
|
private |
Definition at line 81 of file BuildingPlacer.h.
| int BuildingPlacer::Used_LargeBuildingPlacements |
Definition at line 98 of file BuildingPlacer.h.
| int BuildingPlacer::Used_MediumBuildingPlacements |
Definition at line 99 of file BuildingPlacer.h.