To be honest, Web Assembly honestly seems like black magic to me and I hoped I wouldn't have to mess with it and just code in Rust, but as it stands, I couldn't even get the example code from https://github.com/rustyscreeps/screeps-starter-rust to work. The error messages vary between ticks for some reason, but the stack trace always ends at the code
const wasmModule = new WebAssembly.Module(bytes);
I googled a bit and it seems like the problem is that WebAssembly can't parse the binary data. As per the error message, I tried to add --experimental-wasm-se to the extra_options = [] in [build] in screeps.toml, but when doing that, the code isn't even compiled when running the command cargo screeps deploy.
For the reference, here is the entire error message from screeps:
caught exception: CompileError: WebAssembly.Module(): Compiling wasm function #55:core::num::flt2dec::strategy::grisu::format_exa... failed: Invalid opcode (enable with --experimental-wasm-se) @+43788
at screeps-starter-rust:410:20
at screeps-starter-rust:416:3
at Object.exports.evalCode (:15851:76)
at Object.requireFn (:46524:28)
at Object.module.exports.loop (main:28:27)
at mainLoop:1:52
at mainLoop:2:3
at Object.exports.evalCode (:15851:76)
at Object.exports.run (:46474:24)
I haven't changed anything in the code itself or the configuration, apart from changing the name of the destination directory from default to rust-screeps to compare the differences between my new and old code.
To be honest, Web Assembly honestly seems like black magic to me and I hoped I wouldn't have to mess with it and just code in Rust, but as it stands, I couldn't even get the example code from https://github.com/rustyscreeps/screeps-starter-rust to work. The error messages vary between ticks for some reason, but the stack trace always ends at the code
const wasmModule = new WebAssembly.Module(bytes);
I googled a bit and it seems like the problem is that WebAssembly can't parse the binary data. As per the error message, I tried to add
--experimental-wasm-se
to theextra_options = []
in[build]
inscreeps.toml
, but when doing that, the code isn't even compiled when running the commandcargo screeps deploy
.For the reference, here is the entire error message from screeps:
I haven't changed anything in the code itself or the configuration, apart from changing the name of the destination directory from
default
torust-screeps
to compare the differences between my new and old code.