
Mining groups bundle together mining sites by a common dropoff location, and each mining group has its own TransportRequestGroup and separate fleet of haulers. To solve this problem, I introduced the idea of miningGroups a while back. A hauler could come in from the left, deposit to the left link, then start handling a request from the right room, walking past the storage and negating the usefulness of the link. Suppose you own a room that harvests from its left and right neighbors, so you put links on the left and right sides of the room, with the storage in the middle. However, things get hairy when you add multiple possible dropoff locations, such as when you build several dropoff links in a room. In the simplest case, the dropoff structure is only ever colony.storage, and this approach actually works decently well. Supplier.task = obtain energy from store structure Supplier.task = transfer energy to target Let target = closest high-priority unhandled request Hauler.task = withdraw energy from target Let target = highest priority unhandled request Hauler.task = transfer energy to dropoff structure (There are also mineralSuppliers and queens which have slightly-modified supplier logic.) This is basically how they worked in pseudocode: function haulerLogic(hauler): Haulers bring in energy from remote sources and put them in a dropoff structure and suppliers take energy from storage and distribute it throughout a room. My old transport system took a greedy approach which was simple but inflexible, needlessly separating creep roles which could be combined. Isolating requests to separate boxes makes it difficult to handle more complex requests which need require multiple transportation “legs”, such as moving minerals to a terminal, sending them to another terminal, then transferring them from the terminal to a lab. However, this system did not provide much in the way of flexibility. This way of compartmentalizing requests proved to be quite useful in some cases, giving the convenience of “throw it all in a box” while still allowing me to specify which creeps do what. At early levels, the hatchery puts requests into that group, but at RCL4+, the hatchery gets its own dedicated attendant (the queen) and its own request group. For example, each colony has a request group which suppliers attend to. TransportRequestGroups (which existed in my old AI, but which I cleaned up in the Overlord Overload rewrite) act as a “box” to group prioritized resource requests.
Screeps reddit code#
In your editor: var assert = require ( 'assert' ) describe ( 'Array', function ( ) ) # Synchronous Code $ $EDITOR test/test.js # or open with your favorite editor
Screeps reddit install#
Or as a development dependency for your project: $ npm install -save-dev mochaĪs of v9.0.0, Mocha requires Node.js v12.0.0 or newer. Install with npm globally: $ npm install -global mocha
