This is the API reference for Oort. For more general information see the wiki.

Starter Code

Oort expects your code to have a Ship type with a tick method. Each tutorial provides some starter code which includes this:

```rust use oort_api::prelude::*;

pub struct Ship {}

impl Ship { pub fn new() -> Ship { Ship {} }

pub fn tick(&mut self) {
}

} ```

The game will call your new function when a ship is created and then call tick 60 times per second during the simulation.

struct Ship is useful for storing any state that needs to persist between ticks. enum Ship works too and can be helpful when this state differs between ship classes.

The statement use oort_api::prelude::* imports all the APIs so that you can use them simply as e.g. position(). See the [prelude] module documentation for the details on everything this imports. The important APIs are covered below.

Subsystems

All actions performed by a ship (such as firing weapons or scanning the radar) occur between ticks. In particular, setting the radar heading or the radio channel will affect the scan results or messages received on the next tick.

Ship Status and Control

Basic status:

Engine control:

Engine limits:

Weapons

Guns:

Radar

Radar in Oort is modeled as a beam that can be pointed in any direction and which has a width between 1/360 of a circle to a full circle. Enemy ships illuminated by this beam reflect an amount of energy proportional to their radar cross section (larger for larger ships). The radar can return one contact per tick. Any changes to heading/width/filtering take effect on the next tick.

The position and velocity returned for a contact will have error inversely related to the signal strength.

Basic operation:

Advanced filtering:

Retrieving current state:

Radio

The radio can be used to send or receive a single value per tick. There are 10 channels available (0 to 9), shared between all teams.

Special Abilities

Some ship classes have a unique special ability. These abilities are activated for a certain time and then need to reload.

Scalar Math

See the Rust documentation for the full list of f64 methods.

Vector Math

Two-dimensional floating point vectors (Vec2) are ubiquitous in Oort and are used to represent positions, velocities, accelerations, etc.

Debugging

Clicking on a ship in the UI displays status information and graphics indicating its acceleration, radar cone, etc. You can add to this with the functions below.

Entering debug mode by pressing the 'g' key also displays debug graphics from all ships.

Miscellaneous

Ship Classes