{"id":48466079,"url":"https://github.com/rustyscreeps/screeps-starter-rust","last_synced_at":"2026-04-07T04:32:31.618Z","repository":{"id":49374317,"uuid":"123468970","full_name":"rustyscreeps/screeps-starter-rust","owner":"rustyscreeps","description":"Starter Rust AI for Screeps, the JavaScript-based MMO game","archived":false,"fork":false,"pushed_at":"2025-04-09T20:19:51.000Z","size":57,"stargazers_count":130,"open_issues_count":7,"forks_count":48,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-09T21:28:24.241Z","etag":null,"topics":["rust","screeps","wasm"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rustyscreeps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-01T17:30:41.000Z","updated_at":"2025-04-09T20:19:55.000Z","dependencies_parsed_at":"2024-03-24T19:25:03.892Z","dependency_job_id":"a2ef1510-386b-44c3-abd8-566c41989f55","html_url":"https://github.com/rustyscreeps/screeps-starter-rust","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/rustyscreeps/screeps-starter-rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustyscreeps%2Fscreeps-starter-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustyscreeps%2Fscreeps-starter-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustyscreeps%2Fscreeps-starter-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustyscreeps%2Fscreeps-starter-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rustyscreeps","download_url":"https://codeload.github.com/rustyscreeps/screeps-starter-rust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustyscreeps%2Fscreeps-starter-rust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31500397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","screeps","wasm"],"created_at":"2026-04-07T04:32:31.542Z","updated_at":"2026-04-07T04:32:31.608Z","avatar_url":"https://github.com/rustyscreeps.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# screeps-starter-rust\n\nStarter Rust AI for [Screeps: World][screeps], the JavaScript-based MMO game.\n\nThis uses the [`screeps-game-api`] bindings from the [rustyscreeps] organization.\n\n[`wasm-pack`] is used for building the Rust code to WebAssembly. This example uses [Rollup] to\nbundle the resulting javascript, [Babel] to transpile generated code for compatibility with older\nNode.js versions running on the Screeps servers, and the [`screeps-api`] Node.js package to deploy.\n\nDocumentation for the Rust version of the game APIs is at https://docs.rs/screeps-game-api/.\n\nAlmost all crates on https://crates.io/ are usable (only things which interact with OS\napis are broken).\n\n## Quickstart:\n\n```sh\n# Install rustup: https://rustup.rs/\n\n# Install wasm-pack\ncargo install wasm-pack\n\n# Install wasm-opt\ncargo install wasm-opt\n\n# Install Node.js for build steps - versions 16 through 22 have been tested, any should work\n# nvm is recommended but not required to manage the install, follow instructions at:\n# Mac/Linux: https://github.com/nvm-sh/nvm\n# Windows: https://github.com/coreybutler/nvm-windows\n\n# Installs Node.js at version 20\n# (all versions within LTS support should work;\n# 20 is recommended due to some observed problems on Windows systems using 22)\nnvm install 20\nnvm use 20\n\n# Clone the starter\ngit clone https://github.com/rustyscreeps/screeps-starter-rust.git\ncd screeps-starter-rust\n# note: if you customize the name of the crate, you'll need to update the MODULE_NAME\n# variable in the js_src/main.js file and the module import with the updated name, as well\n# as the \"name\" in the package.json\n\n# Install dependencies for JS build\nnpm install\n\n# Copy the example config, and set up at least one deployment mode.\ncp .example-screeps.yaml .screeps.yaml\nnano .screeps.yaml\n\n# compile for a configured server but don't upload\nnpm run deploy -- --server ptr --dryrun\n\n# compile and upload to a configured server\nnpm run deploy -- --server mmo\n```\n\n## Migration to 0.22\n\nVersions of [`screeps-game-api`] at 0.22 or higher are no longer compatible with the\n[`cargo-screeps`] tool for building and deployment; the transpile step being handled by [Babel] is\nrequired to transform the generated JS into code that the game servers can load.\n\nTo migrate an existing bot to using the new JavaScript translation layer and deploy script:\n\n- Create a `.screeps.yaml` with the relevant settings from your `screeps.toml` file applied to the\n  new `.example-screeps.yaml` example file in this repo.\n- Add to your `.gitignore`: `.screeps.yaml`, `node_modules`, and `dist`\n- Create a `package.json` copied from the one in this repo and make appropriate customizations.\n  - Importantly, if you've modified your module name from `screeps-starter-rust` to something else,\n    you need to update the `name` field in `package.json` to be your bot's name.\n- Install Node.js (from the quickstart steps above), then run `npm install` from within the bot\n  directory to install the required packages.\n- Copy the `deploy.js` script over to a new `js_tools` directory.\n- Add `main.js` to a new `js_src` directory, either moved from your existing `javascript` dir and\n  updated, or freshly copied.\n  - If updating, you'll need to change:\n    - Import formatting, particularly for the wasm module.\n    - wasm module initialization has changed, requiring two calls to first compile the module,\n      then to initialize the instance of the module.\n  - Whether updating or copying fresh, if you've modified your bot name from `screeps-starter-rust`\n    you'll need to update the bot package import and `MODULE_NAME` at the beginning of `main.js`\n    to be your updated bot name.\n- Update your `Cargo.toml` with version `0.22` for `screeps-game-api`\n- Run `npm run deploy -- --server ptr --dryrun` to compile for PTR, remove the `--dryrun` to deploy\n\n### Troubleshooting\n\n#### Error: Not Authorized\n\nIf you encounter an error like the following:\n\n```\nError: Not Authorized\n    at ScreepsAPI.req (PATH_TO_YOUR_BOT/node_modules/screeps-api/dist/ScreepsAPI.js:1212:17)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async ScreepsAPI.auth (PATH_TO_YOUR_BOT/node_modules/screeps-api/dist/ScreepsAPI.js:1162:17)\n    at async ScreepsAPI.fromConfig (PATH_TO_YOUR_BOT/node_modules/screeps-api/dist/ScreepsAPI.js:1394:9)\n    at async upload (PATH_TO_YOUR_BOT/js_tools/deploy.js:148:17)\n    at async run (PATH_TO_YOUR_BOT/js_tools/deploy.js:163:3\n```\n\nThen the password in your `.screeps.yaml` file is getting picked up as something aside from a string. Passwords sent to the server must be a string. Wrap it in quotes: `password: \"12345\"`\n\n#### Error: Unknown module\n\nIf you encounter an error like the following:\n\n```\nError: Unknown module 'bot-name-here'\n    at Object.requireFn (\u003cruntime\u003e:20897:23)\n    at Object.module.exports.loop (main:933:33)\n    at __mainLoop:1:52\n    at __mainLoop:2:3\n    at Object.exports.evalCode (\u003cruntime\u003e:15381:76)\n    at Object.exports.run (\u003cruntime\u003e:20865:24)\n```\n\nYou need to make sure you update your `package.json` `name` field to be your bot name.\n\n#### CompileError: WebAssembly.Module(): Invalid opcode\n\nIf you encounter an error like the following:\n\n```\nCompileError: WebAssembly.Module(): Compiling wasm function #327:core::unicode::printable::check::h9ddbb57eb721c858 failed: Invalid opcode (enable with --experimental-wasm-se) @+257876\n    at Object.module.exports.loop (main:934:35)\n    at __mainLoop:1:52\n    at __mainLoop:2:3\n    at Object.exports.evalCode (\u003cruntime\u003e:15381:76)\n    at Object.exports.run (\u003cruntime\u003e:20865:24)\n```\n\nYou need to update your `Cargo.toml` to include the `--signext-lowering` flag for `wasm-opt`. For example:\n\n```\n[package.metadata.wasm-pack.profile.release]\nwasm-opt = [\"-O4\", \"--signext-lowering\"]\n```\n\n[screeps]: https://screeps.com/\n[`wasm-pack`]: https://rustwasm.github.io/wasm-pack/\n[Rollup]: https://rollupjs.org/\n[Babel]: https://babeljs.io/\n[`screeps-api`]: https://github.com/screepers/node-screeps-api\n[`screeps-game-api`]: https://github.com/rustyscreeps/screeps-game-api/\n[`cargo-screeps`]: https://github.com/rustyscreeps/cargo-screeps/\n[rustyscreeps]: https://github.com/rustyscreeps/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustyscreeps%2Fscreeps-starter-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frustyscreeps%2Fscreeps-starter-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustyscreeps%2Fscreeps-starter-rust/lists"}