40 releases (22 breaking)

0.22.0 Aug 27, 2024
0.21.1 Jun 28, 2024
0.20.1 Jan 10, 2024
0.19.0 Dec 21, 2023
0.0.9 Mar 20, 2018

#24 in WebAssembly

Download history 13/week @ 2024-08-19 279/week @ 2024-08-26 19/week @ 2024-09-02 29/week @ 2024-09-09 82/week @ 2024-09-16 112/week @ 2024-09-23 115/week @ 2024-09-30 46/week @ 2024-10-07 20/week @ 2024-10-14 10/week @ 2024-10-21 14/week @ 2024-10-28 4/week @ 2024-11-04 6/week @ 2024-11-11 27/week @ 2024-11-18 19/week @ 2024-11-25 34/week @ 2024-12-02

86 downloads per month
Used in 8 crates

MIT license

680KB
12K SLoC

screeps-game-api

Linux Build Status crates.io version badge dependency status docs.rs version badge

Rusty Screeps Logo

Typed bindings to the Screeps in-game API for WASM Rust AIs.

Also the homepage for tools relating to writing Screeps AIs in Rust.

screeps-game-api is a Rust binding to the JavaScript APIs for programs compiled to WASM using wasm-pack.

Also in this organization is cargo screeps, a binary program which wraps wasm-pack and lets one directly upload Rust WASM code to Screeps servers.

These two tools go together well, but do not depend on eachother. cargo-screeps can compile and upload any screeps WASM project buildable with wasm-bindgen's wasm-pack, and screeps-game-api is usable in any project built with wasm-pack.

Writing Screeps code in Rust can be nice, but it can also be annoying. If you have tips, tricks, or other things you'd like to share, make an issue! We need to write more documentation, and if we have enough ideas, we can start an mdbook for this repository.

If you need help or want to share feedback, feel free to open an issue or come say "Hi!" on the official Screeps Discord in the #rust channel!


Here's a quickstart for what you need to get going. More documentation will be made in the future.

# Install CLI dependency:
cargo install cargo-screeps

# Clone the starter
git clone https://github.com/rustyscreeps/screeps-starter-rust.git
cd screeps-starter-rust

# Copy the example config, and set up at least one deployment mode
cp example-screeps.toml screeps.toml
nano screeps.toml
# configure credentials (API key) if you'd like to upload directly,
# or a directory to copy to if you'd prefer to use the game client to deploy

# build tool:
cargo screeps --help
# compile the module without deploying anywhere
cargo screeps build
# compile plus deploy to the configured 'upload' mode; any section name you
# set up in your screeps.toml for different environments and servers can be used
cargo screeps deploy -m upload
# or if you've set a default mode in your configuration, simply use:
cargo screeps deploy

Dependencies

~1.6–2.9MB
~54K SLoC