-
Notifications
You must be signed in to change notification settings - Fork 24
Advanced Topics
Oort rewrites the compiled WebAssembly code to insert a "gas" check after each basic block. This limits the number of WASM instructions executed per ship, per tick to 1 million. Ships that exceed this will explode.
Memory: TODO (code, stack, heap)
All ships in a team run in the same WebAssembly VM. This is due to browser limitations on some platforms on the number of VMs that can be created. In order to prevent communication between ships outside of the radio system certain Rust language features like static
and unsafe
are disallowed by the compiler.
Due to implementation differences between the various browsers and native WASM VMs (mainly floating point optimizations) a simulation with the same code/scenario/seed can very rarely produce different results on different platforms. When this happens, the native VM (as used by the tournament code) is canonical.
After cloning the repo run:
cargo run --bin battle $SCENARIO $AI0 $AI1 ...
Where $SCENARIO
is the name of a scenario like "fighter_duel" and each $AI
is either a filesystem path to your code or a shortcode. You can find both the scenario names and shortcodes in the URLs on the tournament results page. Here's a working example assuming you're in the root of the Oort repository:
cargo run --bin battle fighter_duel shared/builtin_ai/src/reference.rs fighter_duel.20230911.9705.stichinski fighter_duel.20230911.9705.rlane
This will run simulations pitting the first AI against each of the others and output the win/loss/draw stats and example seeds for each pairing.
The --json
flag can be used to get machine-readable output.
There's a similar tournament
binary in the repo that competes each AI against the others and outputs a ranking, exactly like the official tournaments:
cargo run --bin tournament run-unofficial fighter_duel --rounds 100 shared/builtin_ai/src/reference.rs fighter_duel.20230911.9705.stichinski fighter_duel.20230911.9705.rlane
You can craft URLs of the form https://oort.rs/scenario/SCENARIO_NAME?player0=PLAYER0&player1=PLAYER1&seed=SEED
, replacing the placeholders as described below.
- SCENARIO_NAME: e.g. "fighter_duel". The full list can be found here.
- PLAYER0/PLAYER1: A shortcode for an uploaded AI. There are several formats:
-
leaderboard:USERNAME:SCENARIO_NAME
- The leaderboard entry for the given user and scenario. -
tournament:USERNAME:SCENARIO_NAME
- The most recent tournament entry for the given user and scenario. -
TOURNAMENT_ID:USERNAME
- A user's entry into a previous tournament. - Random string generated when clicking the "Copy shortcode" button on the Mission Complete screen.
-
- SEED: An integer that determines all randomness in the game.