Starter kit for TypeScript-based Screeps AI codes.
screeps-typescript-starter is a starter kit for building Screeps AIs in TypeScript. It is based on the original starter kit by Marko Sulamägi, but with extra tools for easy compiling/deploying of scripts to the Screeps server, as well as a base framework for running tests.
Download the latest zipped copy here.
- @bonzaiferroni has put out some really useful guides to get started with TypeScript development on Screeps. Go read them! (Guide #1, Guide #2)
- We've consolidated all of our guides into the wiki page. This README will be simplified to include the essentials to get you up and running. Feel free to contribute to the wiki as well!
- Features
- Quick start
- Initial configuration
- Running the compiler
- Further reading
- Contributing
- Special thanks
- Automated deploy to public and private Screeps servers
- Live reload compiling of typescript code
- Highly configurable environment with sane defaults
- Pre-configured linting rules customized for screeps
- Typescript Screeps typings
- Logger which links with source code and git repo
- Screeps profiler
- "Snippets" directory for code you want to save, but don't want compiled or linted
- Modest starter code to get you started, but not hold your hand
By far, the easiest and quickest way to get started with TypeScript development on Screeps is to follow @bonzaiferroni's guides on Screeps World. Go read them!
- https://screepsworld.com/2017/07/typescreeps-getting-started-with-ts-in-screeps/
- https://screepsworld.com/2017/07/typescreeps-installing-everything-you-need/
We'll assume you have already downloaded/cloned the starter kit.
- Node.js (latest LTS is recommended)
- Typings
- Yarn - Optional. You can use
npm
if you don't want to, but this is for your own sanity.
Run the following the command to install the required packages and TypeScript declaration files if you are using yarn:
$ yarn
or, for npm:
$ npm install
Create a copy of config/credentials.example.json
and rename it to config/credentials.json
.
WARNING: This file contains your secret credentials. DO NOT commit it into your repository!
# config/credentials.json
$ cp config/credentials.example.json config/credentials.json
In the newly created credentials.json
file, change the email
and password
properties with your Screeps credentials. The serverPassword
, token
, and gzip
options are only for private servers that support them. If you are uploading to the public Screeps server, you should delete these fields from your credentials file.
Go to config/config.dev.ts
, and you'll find the following lines:
const credentials: Credentials = require("./credentials.json");
credentials.branch = "dev";
Change the credentials.branch
property you want to initially build and upload to, e.g. "default"
. Note that due to the Screeps API limitations, you still have to create a branch with a matching name in the Screeps client by cloning an existing branch. The compiler will yell at you when you forgot to do so.
See Configuration page on the screeps-typescript-starter wiki for more in-depth info on configuration options.
# To compile and upload your TypeScript files on the fly in "watch mode":
$ npm start
# To compile and deploy once:
$ npm run deploy
To find out more about what else you can do with screeps-typescript-starter, head over to the screeps-typescript-starter wiki to find more guides, tips and tricks.
Issues, Pull Requests, and Wiki contributions are welcome! Please read the Contributing Guidelines beforehand.
Marko Sulamägi, for the original Screeps/TypeScript sample project.