npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

screeps-autobahn

v0.4.0

Published

A module for generating efficient road networks in Screeps

Readme

Screeps Autobahn

A module for generating efficient road networks in Screeps

What does it do?

Autobahn will return an array of Screeps RoomPosition objects. These positions represent a road network that satisfies two conditions:

  1. All destinations can be reached from the start in the minimum number of steps
  2. The network uses as few roads as possible to satisfy condition 1

Thus, Autobahn can be used to generate efficient road networks for your creeps.

Setup

Manual

  1. Download the Git repository
  2. npm install
  3. npm run bundle
  4. Stick dist/autobahn.js with your Screeps code and require it

Using NPM

  1. npm install screeps-autobahn
  2. Require screeps-autobahn in your Screeps code

Known Issues and Limitations

  • IMPORTANT: Autobahn will use between 30 and 100 CPU each time it is called. Rather than calling it repeatedly, just run it once and save the result.
  • IMPORTANT: Autobahn's algorithm takes exponentially longer with more destinations. For now, you should use no more than 6 destinations at once.
  • Currently, Autobahn will select a network without regard for terrain. An option to avoid swamps will be added in a future patch.
  • Currently, Autobahn will use tiles adjacent to your destination. For many use cases this is undesirable, since a creep may be standing there. An option to avoid these tiles will be added in a future patch.

Example usage

// Require autobahn
const autobahn = require('./autobahn');

// Use a flag as the start point
let start = Game.flags['start'];

// Create an array of energy sources to use as the destinations
let roomName = 'W34S73';
let destinations = Game.rooms[roomName].find(FIND_SOURCES);

// Run autobahn
let network = autobahn(start, destinations);

// Build the road network
for (let i = 0; i < network.length; i++) {
	let pos = network[i];
	Game.rooms[pos.roomName].createConstructionSite(pos, STRUCTURE_ROAD);
}

Multi-room pathing

Autobahn now supports building networks that span several rooms. By default, pathfinding is limited to the room of the start point. To allow Autobahn to use additional rooms, pass in an options object containing roomFilter. The simplest roomFilter is an array of room names that are allowed, for example:

let start = new RoomPosition(28, 48, 'W34S73');
let destinations = Game.rooms['W34S75'].find(FIND_SOURCES);

// Allow autobahn to path in these three rooms
let options = {roomFilter: ['W34S73', 'W34S74', 'W34S75']};

// Run autobahn
let network = autobahn(start, destinations, options);

Alternatively, you can specify roomFilter as a function that takes in a room name string and returns a boolean:

// Allow autobahn to use any rooms starting with W34
let options = {roomFilter: (roomName) => roomName.startsWith('W34')};

Please note that Autobahn builds a breadth-first graph from the start to all destinations, so asking Autobahn to build a network over long distances with many rooms allowed could be very expensive.

Contributing

Please open an issue on GitLab to report bugs or feature requests. Feel free to open merge requests with recommended fixes as well!

Acknowledgements

Special thanks to @davaned for inspiration and feedback.