[][src]Crate airmash_protocol

Incomplete protocol interface for AIRMASH. This crate provides a strongly typed interface for communicating with an airmash server. Since there can (in the future) be multiple protocol versions, this crate must be used with another crate such as airmash-protocol-v5 that provides a serialization layer.

Library Usage

Once you have gotten an instance of Protocol, it can be used to serialize and deserialize to and from the wire representation of that protocol version.

let protocol = protocol_from_elsewhere;
let bytes = bytes_from_elsewhere;
 
// To deserialize a packet from the server
let packet: ServerPacket = protocol.deserialize_server(&bytes)?;
 
// To deserialize a packet from a client
let packet: ClientPacket = protocol.deserialize_client(&bytes)?;

The ProtocolSerializationExt trait is also provided to allow for less typing when doing lots of serialization or deserialization.

Modules

client

Packets that the client sends to the server.

custom

Data serialization declarations for ServerCustom packets.

error

All error types for this crate.

server

Packets that the server sends to the client.

Structs

AirmashUnits

The struct for this unit system

Flag

A flag ID

Level

Type-safe Level identifier

Mob

A mob (missile, upgrade, or powerup) ID

Player

A player ID

Score

Type-safe score identifier

ServerKeyState

All possible "keys" that a player can have activated.

Team

Type-safe team identifier

Upgrades

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

Vector2

A 2D Vector that works with unit conversions.

Enums

ClientPacket

All possible client packets.

CommandReplyType

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

ErrorType

All error codes that can be sent to the client.

FirewallStatus

TODO: Reverse engineer

FirewallUpdateType

TODO: Reverse engineer

FlagCode

All player flags currently available within the game.

FlagUpdateType

Flag update type

GameType

Game Type.

KeyCode

The key that's had it's state changed. This is only used for client -> server communication.

LeaveHorizonType

Indicates the type of entity that just went outside of the player's horizon.

MobType

Types of all mobs present in the game.

PlaneType

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

PlayerLevelType

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

PlayerStatus

Flag for indicating whether a player is alive or dead.

PowerupType

TODO: Reverse engineer

ServerCustomType

Specific identifiers for server custom messages.

ServerMessageType

Type specifier for server banner messages.

ServerPacket

All possible server packets.

UpgradeType

TODO: Reverse engineer

Traits

Protocol

Interface to implement for all protocols.

ProtocolSerializationExt

Helper trait to make working with protocols easier.

Type Definitions

Accel

A 2D vector of AccelScalars.

AccelScalar

Unit of acceleration: Distance / Time^2.

BaseType

Inner type used for all unit type declarations.

Distance

On-map distances.

Energy

Energy unit.

EnergyRegen

Unit of Energy / Time.

Health

Health unit.

HealthRegen

Unit of Health / Time.

Position

A 2D vector of Distances.

Rotation

Unit for rotations (in radians).

RotationRate

Unit of angular velocity: Rotation / Time.

Speed

Unit of velocity: Distance / Time.

Time

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

Velocity

A 2D vector of Speeds.