[][src]Crate naia_shared

Naia Shared

Common functionality shared between naia-server & naia-client crates.

Modules

utils

Commonly used utility methods to be used by naia-server & naia-client

Structs

AckManager

Keeps track of sent & received packets, and contains ack information that is copied into the standard header on each outgoing packet

Config

Contains Config properties which will be used by a Server or Client

Connection

Represents a connection to a remote host, and provides functionality to manage the connection and the communications to it

EventManager

Handles incoming/outgoing events, tracks the delivery status of Events so that guaranteed Events can be re-transmitted to the remote host

Instant

Represents a specific moment in time

Manifest

Contains the shared protocol between Client & Server, with a data that is able to map Event/Entity TypeIds to their representation within specified enums. Also is able to create new Event/Entities using registered Builders, given a specific TypeId.

PacketReader

Contains an underlying byte payload, and provides a Cursor into that payload

PacketWriter

Handles writing of Event & Entity data into an outgoing packet

Property

A Property of an Entity, that contains data which must be tracked for updates, and synced to the Client

RttTracker

Tracks the current Round Trip Time of the connection

StateMask

The State Mask is a variable-length byte array, where each bit represents the current state of a Property owned by an Entity. The Property state tracked is whether it has been updated and needs to be synced with the remote Client

Timer

A Timer with a given duration after which it will enter into a "Ringing" state. The Timer can be reset at an given time, or manually set to start "Ringing" again.

Timestamp

A Timestamp for a moment in time that can be read/written to/from a byte stream

Enums

ManagerType

Every data packet transmitted has data specific to either the Event or Entity managers. This value is written to differentiate those parts of the payload.

PacketType

An enum representing the different types of packets that can be sent/received

Constants

MTU_SIZE

The maximum of bytes that can be used for the payload of a given packet. (See #38 of http://ithare.com/64-network-dos-and-donts-for-game-engines-part-v-udp/)

Traits

Entity

An Entity is a container of Properties that can be scoped, tracked, and synced, with a remote host

EntityBuilder

Handles the creation of new Entity instances

EntityMutator

Tracks which Properties have changed and need to be queued for syncing with the Client

EntityNotifiable

Represents a manager that must be notified when packets have been dropped or delivered

EntityType

An Enum with a variant for every Entity that can be synced between Client/Host

Event

An Event is a struct of data that can be sent and recreated on the connected remote host

EventBuilder

Handles the creation of new Events

EventClone

A Boxed Event must be able to clone itself

EventType

An Enum with a variant for every Event that can be sent to a remote host

PropertyIo

A Property that can read/write itself from/into incoming/outgoing packets

Functions

find_my_ip_address

Helper method to find local IP address, if possible

Type Definitions

LocalEntityKey

The key that represents an Entity in the Client's scope, that is being synced to the Client

SequenceNumber

Used to index packets that have been sent & received