ryanrolds / screeps-bot-choreographer

A bot for Screeps
MIT License
11 stars 0 forks source link

Screeps Bot - Choreographer

An bot for Screeps. Implemented following the OS pattern with processes communicating via Message Queues and Event Streams. Named after Choreography in Event-Driven Architecture.

Key Features:

Roadmap:

Usage as bot in private server

  1. Install the bot
    npm install screeps-bot-choreographer --save
  2. Add "choreographer": "node_modules/screeps-bot-choreographer/dist/main.js" to mods.json

Building and running as a player

Backup your existing scripts.

Note this project uses LF, not CRLF, and the linter will complain if it files with CRLFs. The project is setup for EditorConfig. Please use that.

Requirements:

npm install grunt-cli -g
npm install

Create .screeps.json and provide credentials:

{
  "email": "<email>",
  "token": "<token>",
  "branch": "default",
  "ptr": false,
  "private": {
    "username": "<username>",
    "password": "<password>",
    "branch": "default",
    "ptr": false
  }
}

Token is gotten from the the account settings in the Screeps client. The private username and password for private servers are set via the private server CLI tool.

Running

After making changes run linting, tests, and TS complication with grunt.

Uploading of built TS+JS can be done by running grunt <world> where <world> can be mmo, private, or local.

Structure

First-class business logic concepts:

The AI strategy is contained mostly in the Runnables and the Roles, which will sure the shared constants, functions, and libraries.

Communication between processes and other components is almost entirely done over Topics and Event Streams, items not using these methods are being moved to using them as needed.

Operation

The AI will focus on establishing an economy, build, repair, and defend it's bases. The build manager will spawn at least one Upgrader and will add more if there is energy above the defense reserve.

There are some debugging tools built into the project:

There are a couple of helpful global variables:

Many of these persist between restarts, so make sure to unset them when you're finished with them.