Expand description

Protocol definitions for AIRMASH. This crate provides a strongly typed interface for communicating with an airmash server. It also provides an implementation of the airmash v5 protocol along with serde definitions for all interface structs. This is enough to communicate with any existing airmash server over a websocket connection.

Library Usage

The library is designed to be straightforward to use. First construct the appropriate packet from either server packets or client packets. From there you can serialize it to bytes via v5::serialize.

let packet = ClientPacket::from(Key {
  seq: 0,
  key: KeyCode::Fire,
  state: true
});

let bytes = airmash_protocol::v5::serialize(&packet)?;
// ... send bytes to server

Note that while the individual packet types are serializable individually the only types expected to be passed between clients and servers are ServerPacket and ClientPacket.

For deserialization you can use v5::deserialize on any byte slice.

let bytes: Vec<u8> = get_some_bytes();
let packet: ClientPacket = airmash_protocol::v5::deserialize(&bytes)?;
// ... do stuff with packet

Modules

Packets that the client sends to the server.

Packets that the server sends to the client.

Serialization and deserialization for the airmash v5 protocol.

Structs

Attempted to convert an enum from a value but the value didn’t map to any possible enum value.

All possible “keys” that a player can have activated.

Upgrade info that a client needs to know about to calculate movement. This also includes the shielded state of the player.

Enums

All possible client packets.

Specifies whether the debug reply to a command should open a popup or be displayed in the chat window.

Details on how the mob despawned.

All error codes that can be sent to the client.

This is used to control whether the firewall exists in BTR.

All player flags currently available within the game.

Flag update type

Game Type.

The key that’s had it’s state changed.

Indicates the type of entity that just left the player’s horizon.

Types of all mobs present in the game.

Used to indicate the type of plane that the packet refers to.

Indicate whether a player levelled up, or has just logged in and their level is being communicated to the client.

Flag for indicating whether a player is alive or dead.

The type of powerup effect that a player has.

Specific identifiers for server custom messages.

Type specifier for server banner messages.

All possible server packets.

All upgrade types.

Type Definitions

A 2D vector of AccelScalars.

Unit of acceleration: Distance / Time^2.

On-map distances.

Energy unit.

Unit of Energy / Time.

Health unit.

Unit of Health / Time.

A 2D vector of Distances.

Unit for rotations (in radians).

Unit of angular velocity: Rotation / Time.

Unit of velocity: Distance / Time.

Time unit. (1 unit of time ~= 16.667ms)

A 2D vector of Speeds.