Difference between revisions of "Automatic base building"

From Screeps Wiki
Jump to navigation Jump to search
m (Added an image of Dignissi's dynamic base)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Automatic base building is the process of finding, claiming and, building up a claimed room without using the UI and direct user input. For many fully a fully automatic bot is the end-goal and automatic base building is a large step.
+
Automatic base building is the process of finding, claiming and, building up a claimed room without using the UI and direct user input. For many, a fully automatic bot is the end-goal, and automatic base building is a large step towards it.
 
 
 
== Types ==
 
== Types ==
   
Line 7: Line 5:
   
 
=== Bunker ===
 
=== Bunker ===
The easiest by far is to have a pre-defined 'bunker' containing all structures you are intent on using and simply finding an open area to place it. The 'center' of the bunker anchor and from there you can generate the structures of your pre-determined bunker based on their relative position to the anchor. As long as the space is there, there should be no conflicts in the generation.
+
The easiest by far is to have a pre-defined 'bunker' object containing all structures and their locations that you intend to place. An anchor, or the center of the bunker's intended location, can give an offset from where you can place your bunker. So long as an area has enough space, bunkers are a great start with automated basing.
   
[[File:BunkerExample.png | left | 200px|An example of a bunker-style base]]<br><br><br><br><br><br><br>
+
[[File:BunkerExample.png|300x300px]]
   
 
<br>
 
<br>
 
 
=== Stamp/Tile-sets ===
 
=== Stamp/Tile-sets ===
   
Normally using a core tile/stamp, you can then determine locations for other pre-defined tile-sets/stamps to be placed around your anchor dependent on the terrain in the room. This allows for a bit more flexibility in rooms that do not have large-open spaces that bunkers can not fit in, while still allowing for already designed and known-to-work types of tiles insuring for example, that labs are in-range of other labs for reactions, extensions are in reachable and manageable locations, spawns have open area for creeps to exit, and so on.
+
Normally using a core tile/stamp, you can then determine locations for other pre-defined tile-sets/stamps to be placed around your anchor dependent on the terrain in the room. This allows for more flexibility in rooms that do not have large-open spaces that bunkers can not fit in, while still allowing for already designed and known-to-work types of tiles insuring for example, that labs are in-range of other labs for reactions, extensions are in reachable and manageable locations, spawns have open area for creeps to exit, and so on.
  +
  +
  +
Stamps, while more difficult to place and manage, can be an optimal improvement to bunkers, as they can better exploit terrain to reduce the need for barricades. Moreover they can allow for more optimal filling, as well as tower placement based around common attack locations or high-damage positions.
  +
  +
[[File:Stamp Example.png|441x441px]]
  +
  +
  +
  +
<div class="toccolours mw-collapsible mw-collapsed" style="color:black;background:#606060; overflow:auto;">
  +
<div style="font-weight:bold;line-height:1.6;">Expand for examples of Extension tile sets, or don't, If you want to make your own.</div>
  +
<div class="mw-collapsible-content">
  +
==== Extensions ====
  +
Extension 'field' or groups come in many different shapes and sizes, and can be one-set, or many smaller tiles. Roads often surround or weave to allow for haulers with a 2:1 carry to move ratio.[[File:Plus.png|left|thumb|100x100px|A plus, tile able extension field.]][[File:LargePlus.png|left|thumb|100x100px|A large plus.]]
  +
  +
  +
  +
  +
  +
  +
  +
  +
  +
[[File:Hallway.png|left|thumb|100x100px|A hallway tile type]]
  +
  +
  +
  +
  +
  +
  +
  +
  +
  +
  +
  +
[[File:DissiFlower.png|left|thumb|100x100px|A Dissi Flower extension field]]
  +
  +
  +
  +
  +
  +
[[File:RapidFillCluster.png|left|thumb|100x100px|A rapid-fill cluster.]]
  +
  +
  +
  +
  +
  +
[[File:EyeofEzic.png|left|thumb|100x100px|An extension field some-what resembling the Ezic's symbol from 'Papers Please']]
  +
  +
  +
</div></div>
  +
<div class="toccolours mw-collapsible mw-collapsed" style="color:black;background:#606060; overflow:auto;">
  +
<div style="font-weight:bold;line-height:1.6;">Expand for example of lab tile sets.</div>
  +
<div class="mw-collapsible-content">
  +
==== Labs ====
  +
Labs are often placed so every lab is in range of 2 to 2 'source labs' to allow for optimal compound production. When placing labs you should also consider their ability to engage in lab rotation with boost production, alongside ease of boosting and unboosting. Containers are often placed adjacent to labs to allow for unboosting resources to drop into them.[[File:Infinilabs.png|left|thumb|100x100px|Labs in a figure 8 or 'infinity' symbol shape, hallway allows pass-though and 2 position filling of all labs]]
  +
  +
  +
  +
[[File:LabStack.png|left|thumb|100x100px|A stack of labs, where all 8 production labs can reach 2 source labs.]]
  +
  +
  +
  +
  +
</div>
  +
</div>
  +
<div class="toccolours mw-collapsible mw-collapsed" style="color:black;background:#606060; overflow:auto;">
  +
<div style="font-weight:bold;line-height:1.6;">Expand for examples of Tower tile sets.</div>
  +
<div class="mw-collapsible-content">
  +
  +
==== Towers ====
  +
Towers can be clustered in a single area to allow for ease of refilling, though consequently they will likely have reduced damage.[[File:TowerA.png|left|thumb|118x118px|A single-tile-to-fill cluster of towers]]
  +
  +
[[File:TowerB.png|left|thumb|112x112px|A Hallway style tile single-fill tower cluster.]]
  +
  +
</div>
  +
</div>
  +
  +
<div class="toccolours mw-collapsible mw-collapsed" style="color:black;background:#606060; overflow:auto;">
  +
<div style="font-weight:bold;line-height:1.6;">Expand for examples of Anchor tile sets.</div>
  +
<div class="mw-collapsible-content">
  +
==== Anchor & central fill clusters ====
  +
A 'hub', 'anchor' or 'center' fill location can often take 1~ creeps to manage and can be relatively small. They will likely include the terminal and storage, alongside the factory, power spawn and possibly nuker and spawns, and may have the rest of the base planned around it.
  +
  +
[[File:AnchorExample.png|left|thumb|100x100px|An example of a single-fill-creep position for multiple structures.]]
  +
  +
</div></div>
   
 
=== Dynamic/Pattern Generation ===
 
=== Dynamic/Pattern Generation ===
   
 
Using a given open area, you can generate a structure or set of structures grouped together based on some basic rules. Some examples would include generating extension fields for one or more fillers to fill, calculating the best position for towers to sit for maximum damage on walls (instead of in a tight fill-group pattern), and so on.
 
Using a given open area, you can generate a structure or set of structures grouped together based on some basic rules. Some examples would include generating extension fields for one or more fillers to fill, calculating the best position for towers to sit for maximum damage on walls (instead of in a tight fill-group pattern), and so on.
  +
  +
[[File:Dynamic Base.png|385x385px]]
   
 
== Useful Algorithms ==
 
== Useful Algorithms ==
Line 26: Line 109:
 
There are several useful algorithms to take into consideration when automatically building your base.
 
There are several useful algorithms to take into consideration when automatically building your base.
 
=== Distance-Transform ===
 
=== Distance-Transform ===
Using the Screep's terrain, you can use [https://en.wikipedia.org/wiki/Distance_transform Distance Transformation] to have natural walls be barrier pixels and swamps/plains to be allowed. Using this, you can then create a matrix/object/array of all positions with a score of how much open space is available around a given roomPosition. This is direly useful to know how much you can fit in an area, without having user input.
+
[https://en.wikipedia.org/wiki/Distance_transform Distance Transformation] can be paired with room terrain data, such walls and non-walls, to score each room position (in something like a CostMatrix) based on their distance from the closest wall. This is great for finding large open locations to place things like bunkers.
   
  +
[[File:Distance Transform Example.png|451x451px]]
[[File:Redcirclegen.png|left|200px|An Example of Distance-Transformation on a room with roomVisuals]]<br><br><br><br><br><br>
 
   
 
<br>
 
<br>
 
 
=== Flood Fill ===
 
=== Flood Fill ===
[https://en.wikipedia.org/wiki/Flood_fill Flood Fill] is useful for defining or testing areas to make sure they are secure (like walls around a base) or defining areas into groups. Filling an area and gathering room positions allows you to use these positions later, for whatever purpose you see fit.[[file:PrototypeFloodFill.png|left|200px|An example of a flood-fill, filling the 'outside' of a predefined base area.]]<br><br><br><br><br>
+
[https://en.wikipedia.org/wiki/Flood_fill Flood Fill] is useful for defining or testing areas to make sure they are secure (like if there are barricades all around a base) or sectioning areas into groups. Filling an area and gathering room positions allows you to use these positions later, for whatever purpose you see fit.
   
  +
[[File:PrototypeFloodFill.png|334x334px]]
   
<br>
 
 
<br>
 
 
=== Minimum Cut ===
 
=== Minimum Cut ===
[[wikipedia:Minimum_cut|Minimum Cut]] is useful for well sized rampart & wall placment.[[file:MincutResult.png|left|200px|Result of the previous base map after cut]][[file:Mincutbase.png|left|200px|A base map for minCut, yellow is walkable, purple is exit, green is protected (can't cut)]]
+
[[wikipedia:Minimum_cut|Minimum Cut]] is useful for rampart and wall placement based around weighted graphs, meaning barricades can be placed at terrain chokepoints, for example.
  +
  +
[[File:MincutResult.png|393x393px]][[File:Mincutbase.png|303x303px]]
 
[[Category:Strategy]]
 
[[Category:Strategy]]

Latest revision as of 00:48, 29 January 2022

Automatic base building is the process of finding, claiming and, building up a claimed room without using the UI and direct user input. For many, a fully automatic bot is the end-goal, and automatic base building is a large step towards it.

Types[edit | edit source]

There's a few types of automatic bases, depending on method used.

Bunker[edit | edit source]

The easiest by far is to have a pre-defined 'bunker' object containing all structures and their locations that you intend to place. An anchor, or the center of the bunker's intended location, can give an offset from where you can place your bunker. So long as an area has enough space, bunkers are a great start with automated basing.

BunkerExample.png

Stamp/Tile-sets[edit | edit source]

Normally using a core tile/stamp, you can then determine locations for other pre-defined tile-sets/stamps to be placed around your anchor dependent on the terrain in the room. This allows for more flexibility in rooms that do not have large-open spaces that bunkers can not fit in, while still allowing for already designed and known-to-work types of tiles insuring for example, that labs are in-range of other labs for reactions, extensions are in reachable and manageable locations, spawns have open area for creeps to exit, and so on.


Stamps, while more difficult to place and manage, can be an optimal improvement to bunkers, as they can better exploit terrain to reduce the need for barricades. Moreover they can allow for more optimal filling, as well as tower placement based around common attack locations or high-damage positions.

Stamp Example.png


Expand for examples of Extension tile sets, or don't, If you want to make your own.

Extensions[edit | edit source]

Extension 'field' or groups come in many different shapes and sizes, and can be one-set, or many smaller tiles. Roads often surround or weave to allow for haulers with a 2:1 carry to move ratio.
A plus, tile able extension field.
A large plus.





A hallway tile type






A Dissi Flower extension field



A rapid-fill cluster.



An extension field some-what resembling the Ezic's symbol from 'Papers Please'


Expand for example of lab tile sets.

Labs[edit | edit source]

Labs are often placed so every lab is in range of 2 to 2 'source labs' to allow for optimal compound production. When placing labs you should also consider their ability to engage in lab rotation with boost production, alongside ease of boosting and unboosting. Containers are often placed adjacent to labs to allow for unboosting resources to drop into them.
Labs in a figure 8 or 'infinity' symbol shape, hallway allows pass-though and 2 position filling of all labs


A stack of labs, where all 8 production labs can reach 2 source labs.



Expand for examples of Tower tile sets.

Towers[edit | edit source]

Towers can be clustered in a single area to allow for ease of refilling, though consequently they will likely have reduced damage.
A single-tile-to-fill cluster of towers
A Hallway style tile single-fill tower cluster.
Expand for examples of Anchor tile sets.

Anchor & central fill clusters[edit | edit source]

A 'hub', 'anchor' or 'center' fill location can often take 1~ creeps to manage and can be relatively small. They will likely include the terminal and storage, alongside the factory, power spawn and possibly nuker and spawns, and may have the rest of the base planned around it.

An example of a single-fill-creep position for multiple structures.

Dynamic/Pattern Generation[edit | edit source]

Using a given open area, you can generate a structure or set of structures grouped together based on some basic rules. Some examples would include generating extension fields for one or more fillers to fill, calculating the best position for towers to sit for maximum damage on walls (instead of in a tight fill-group pattern), and so on.

Dynamic Base.png

Useful Algorithms[edit | edit source]

There are several useful algorithms to take into consideration when automatically building your base.

Distance-Transform[edit | edit source]

Distance Transformation can be paired with room terrain data, such walls and non-walls, to score each room position (in something like a CostMatrix) based on their distance from the closest wall. This is great for finding large open locations to place things like bunkers.

Distance Transform Example.png

Flood Fill[edit | edit source]

Flood Fill is useful for defining or testing areas to make sure they are secure (like if there are barricades all around a base) or sectioning areas into groups. Filling an area and gathering room positions allows you to use these positions later, for whatever purpose you see fit.

PrototypeFloodFill.png

Minimum Cut[edit | edit source]

Minimum Cut is useful for rampart and wall placement based around weighted graphs, meaning barricades can be placed at terrain chokepoints, for example.

MincutResult.pngMincutbase.png