Automatic base building

From Screeps Wiki
Revision as of 17:53, 13 September 2020 by Donatzor (talk | contribs) (Created page with "Category:Automatic Base Building Automatic base building is the process of finding, claiming and, building a claimed room without using the UI and direct user input. For...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Automatic base building is the process of finding, claiming and, building 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.


Types

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

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.

Stamp/Tilesets

Normally using a core tile/stamp, you can then determine locations for other pre-defined tilesets/stamps to be placed around your ancor dependent on the terrain in the room.


Useful Algorithms

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


Distance-Transform

Using the screep's terrain, you can use 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.

Flood-Fill

Floodfill 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.