bonzaiferroni / Traveler

Traveler - A general movement solution for Screeps.com
GNU General Public License v3.0
116 stars 38 forks source link

Please note: This repository is no longer being maintained, but Traveler lives on in many forks!

Traveler

Traveler is a general-purpose tool for moving your creeps around. Feel free to fork and use in other projects.

Features:

Installation

  1. Download Traveler.ts or Traveler.js or just copy/paste the code in Traveler.js into a new file using the screeps console.

  2. Add a require statement to main.js:

    • var Traveler = require('Traveler');
    • (in the sim or some private servers you might need to use 'Traveler.js')
  3. Replace situations where you used moveTo with travelTo

    // creep.moveTo(myDestination);
    creep.travelTo(myDestination);

Installation animation

Performance considerations

  1. travelTo creates a new object in creep memory, _trav, which is analogous to the object used by moveTo() for caching the creeps path. For this reason, it will save memory to use either travelTo() or moveTo() with a given creep, but not both.
  2. As with any algorithm where creeps aren't a consideration for pathing by default, you'll have best results when their path has a low chance of including immobile creeps. My creeps rarely reach the "stuck threshold" because I take extra considerations to keep the roads clear.

Documentation

The file itself has comments, and you can also find documentation in the wiki. I'm also looking for feedback and collaboration to improve Traveler, pull requests welcome!

Changelog

2017-06-26

2017-06-16

2017-06-05

2017-03-10

2017-03-06

2017-01-17

2017-01-15