Skip to content

Traveler - A general movement solution for Screeps.com

License

Notifications You must be signed in to change notification settings

adunato/Traveler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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);

Performance considerations

  1. travelTo creates a new object in creep memory, _travel, 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.
  3. My own codebase rarely harvests from rooms at more than a distance of 2. For this reason, my couriers rarely use more than 30 CPU for pathing purposes across their lifespan. I've set REPORT_CPU_THRESHOLD to 50, because if a creep goes above that, I'll want to know about it. If you are harvesting from further away, you might want to set this threshold to a higher value to get fewer false alarms.

Changelog

2017-03-10

  • Fixed a bug where public ramparts were not set as valid positions for pathing in the costmatrix (thanks ricane!)

2017-03-06

  • Fixed a bug where pathfinder gets needlessly called when using options.range (thanks helam!)

2017-01-17

  • Fixed bug in code that determines whether a room is SK from roomname

2017-01-15

  • Eliminated option returnPosition and added returnData
  • Fixed bug where preferHighway would not produce the intended results
  • Fixed bug where ignoreCreep behavior was reversed and creeps could not get unstuck

About

Traveler - A general movement solution for Screeps.com

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 50.9%
  • JavaScript 49.1%