Crate naia_shared[−][src]
Expand description
Naia Shared
Common functionality shared between naia-server & naia-client crates.
Modules
Commonly used utility methods to be used by naia-server & naia-client
Structs
Keeps track of sent & received packets, and contains ack information that is copied into the standard header on each outgoing packet
Represents a connection to a remote host, and provides functionality to manage the connection and the communications to it
Contains Config properties which will be used by a Server or Client
The DiffMask is a variable-length byte array, where each bit represents the current state of a Property owned by a Replica. The Property tracks whether it has been updated and needs to be synced with the remote Client
Represents a specific moment in time
Simple implementation of a store that manages a recycling pool of u16 keys
Contains configuration required to initialize a LinkConditioner
The key that represents a Component in the Client’s scope, that is being synced to the Client
An Entity in the Client’s scope, that is being synced to the Client
Contains the shared protocol between Client & Server, with a data that is able to map Message/Component TypeIds to their representation within specified enums. Also is able to create new Messages/Components using registered Builders, given a specific TypeId.
Handles incoming/outgoing messages, tracks the delivery status of Messages so that guaranteed Messages can be re-transmitted to the remote host
Handles writing of Message data into an outgoing packet
Contains an underlying byte payload, and provides a Cursor into that payload
A Property of an Component/Message, that contains data which must be tracked for updates
Container for cross-platform Random methods
Collection to store data of any kind.
Iterator for a Sequence
Contains Config properties which will be shared by Server and Client
Contains Config properties which will be shared by Server and Client sockets
This header provides reliability information.
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.
A Timestamp for a moment in time that can be read/written to/from a byte stream
Enums
Enum used as a shared network protocol, representing various message types related to Entities/Components
Every data packet transmitted has data specific to either the Message, Entity, Command managers. This value is written to differentiate those parts of the payload.
An enum representing the different types of packets that can be sent/received
Constants
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
Standard Naia Key trait
Represents a manager that must be notified when packets have been dropped or delivered
Tracks which Properties have changed and need to be queued for syncing with the Client
An Enum with a variant for every Component/Message that can be sent between Client/Host
Handles the creation of new Replica (Message/Component) instances
A struct that implements ReplicateSafe is a Message/Component, or otherwise, a container of Properties that can be scoped, tracked, and synced, with a remote host
The part of ReplicateSafe which is object-safe
Structures that implement the WorldMutType trait will be able to be loaded into the Server at which point the Server will use this interface to keep the WorldMutType in-sync with it’s own Entities/Components
Structures that implement the WorldMutType trait will be able to be loaded into the Server at which point the Server will use this interface to keep the WorldMutType in-sync with it’s own Entities/Components
Functions
Returns whether or not a wrapping number is greater than another sequence_greater_than(1,2) will return false sequence_greater_than(2,1) will return true
Returns whether or not a wrapping number is greater than another sequence_less_than(1,2) will return true sequence_less_than(2,1) will return false
Retrieves the wrapping difference between 2 u16 values wrapping_diff(1,2) will return 1 wrapping_diff(2,1) will return -1 wrapping_diff(65535,0) will return 1 wrapping_diff(0,65535) will return -1
Type Definitions
Used to index packets that have been sent & received