Giter Site home page Giter Site logo

d68fbe50 / traveler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bonzaiferroni/traveler

0.0 1.0 0.0 64 KB

Traveler - A general movement solution for Screeps.com

License: GNU General Public License v3.0

JavaScript 49.13% TypeScript 50.87%

traveler's Introduction

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

  • Reorganized type definitions into index.d.ts
  • Fixed bug where public ramparts were not seen as pathable
  • Fixed bug that caused exceptions due to non-existant Memory.rooms

2017-06-16

  • Fixed bug that caused options.preferHighway to not prefer highways

2017-06-05

  • Fixed bug in the commented line of code that registered whether creeps were in a hostile room or not.
  • New version of Traveler! See what is different here. The old version can still be found here.

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

traveler's People

Contributors

bastianh avatar bencbartlett avatar bonzaiferroni avatar kotarou avatar selareid avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.