- Node.js 24 (see
.nvmrc). Node 26 is not supported yet,isolated-vm(used by the screeps server) does not build against it. - Build tools for the native modules (
isolated-vm, screeps driver):python3,makeandg++(Debian/Ubuntu:apt install python3 build-essential) - Docker or Podman with compose support for the test server (MongoDB, Redis)
If the system Node.js has a different version, use a version manager which
reads .nvmrc, e.g. fnm:
curl -fsSL https://fnm.vercel.app/install | bash
fnm install # installs the version from .nvmrc
fnm use
npm installnpm only runs install scripts of packages listed in allowScripts in
package.json. When a dependency with install scripts is added or its git
source changes, review it with npm install-scripts ls and approve it with
npm install-scripts approve <pkg>.
To setup a test server with multiple bots. This will prepare the server and start everyting in a docker compose environment and can be stopped with CTRL-C
npm run setupTestServer
It can be resumed via
docker compose up
The compose files also work with Podman (apt install podman podman-compose):
CONTAINER_ENGINE=podman npm run setupTestServerpodman compose upto resume
With rootless Podman the MongoDB data in tmp-test-server-database/ is owned
by a mapped user id, remove it with podman unshare rm -rf tmp-test-server-database.
To deploy create a .screeps.yaml:
servers:
main:
host: 127.0.0.1
port: 21025
secure: false
username: 'W8N8'
password: 'tooangel'
and run npm run deployLocal.
Add a src/config_local.js to overwrite configuration values. Copy
config_local.js.example to src/config_local.js as an example. src/config.js
has the default values.
Add a src/friends.js with player names to ignore them from all attack considerations.
E.g.:
module.exports = ['TooAngel'];
the src/utils.js provides methods to interact with the NPC.
Within the config_local.js certain config.debug flags can be enabled.
To add debug messages Room.debugLog(TYPE, MESSAGE) and
Creep.creepLog(MESSAGE) are suggested. Especially the creepLog allows
granular output of the creep behavior based on the room and the creep role.
node utils/test.js will start a private server and add some bots as test cases.
install dependencies
npm install
add your account credentials
To deploy to the live server provide the credentials.
export email=EMAIL
export password=PASSWORD
echo "module.exports = { email: 'your-email@here.tld', password: 'your-secret' };" > account.screeps.com.js
or edit and rename account.screeps.com.js.sample to account.screeps.com.js
And deploy to the server:
npm run deploy
To the season server, with token in the environment or in
account.screeps.com.js:
node utils/deploy.js season
See Developing on test server: npm run deployLocal.
Releasing to npm is done automatically by increasing the version and merging to master.
Every deploy to master is automatically deployed to the live tooangel account.