Namespace axr::sdk::Network
- namespace axr.sdk.Network
Enums
- enum ConnectionState
Describes the various states of the connection.
Values:
- NOT_CONNECTED
The connection is not currently active.
- CONNECTING
The .
- CONNECTED
The connection to the remote player or server is alive and healthy.
- LOST_CONNECTION
The connection was lost due to an unknown error.
- REFUSED
An error occurred while attempting to initiate the connection.
- enum MessageType
Describes the supporting encoding types of message data that can be sent over a connection.
Values:
- BINARY
The data is encoded in binary (byte order not assumed).
- TEXT
The data is encoded as UTF-8 compatible text.
- enum SocketMode
Describes the different operating modes of a real-time session socket.
Values:
- BOTH
Specifies a bi-directional connection.
- DOWN
Specifies a downward only connection, capable of receiving data from the server only.
- UP
Specifies an upward only connection, capable of sending data to the server only.
- enum NetworkMode
Describes the operating mode of the local network session.
Values:
- CLIENT
The operating mode of the local network session is a client. Clients have no authority over a session, only locally owned players and associated controllers participating in the session.
- SERVER
The operating mode of the local network session is a server. Servers have complete authority over a session including all players and controllers.
Functions
- delegate void OnSocketMessage (SocketMessage message)
Defines a callback function that will be notified when a new socket message has been received by the connection.
- delegate void OnUnknownMessage (MessageType type, byte[] data)
Defines a callback function that will be notified when a unknown message has been received by the connection.
- delegate void OnStateChanged (INetworkObject obj, bool fromNetwork)
Delegate for notifying of a change in state of this object.
- Param obj
The object that whose state has changed.
- Param fromNetwork
Indicates whether the state change originated from the network or was local.
- class Connection : public axr.sdk.Network.IConnection
- interface IConnection
Subclassed by axr.sdk.Network.Connection
- interface INetworkObject : public IEnumerable<KeyValuePair<string, object>>, public IDisposable
The NetworkObject is a thread-safe dynamic Object type for use within a network context. The class provides common functionality for performing event handling, property replication and remote procedure calls.
Network objects must have a unique name in order to identify them amongst other instances within the engine. If no name is specified at instance creation a random UUID is assigned for the object automatically.
Subclassed by axr.sdk.Network.GameFramework.IPlayerController, axr.sdk.Network.NetworkObject
- class NetworkObject : public axr.sdk.Object, public axr.sdk.Network.INetworkObject, public IEnumerable<KeyValuePair<string, object>>, public IEquatable<NetworkObject>, public IDisposable
The NetworkObject is a thread-safe dynamic Object type for use within a network context. The class provides common functionality for performing event handling, property replication and remote procedure calls.
Network objects must have a unique name in order to identify them amongst other instances within the engine. If no name is specified at instance creation a random UUID is assigned for the object automatically.
Subclassed by axr.sdk.Network.GameFramework.BasicPlayerController, axr.sdk.Network.GameFramework.GameState, axr.sdk.Network.GameFramework.PlayerState
- class NetworkSession : public IDisposable
The NetworkSession serves as the routing point between a set of active network connections and the objects participating in a given online session.
The NetworkSession manages a collection of replication groups containing all participating networked objects within the session. Each network object is capable of replicating its own state, executing remote procedure calls or sending and receiving network events to other objects within the network.
Any messages originating from the objects managed by this session are transmitted through one or more of the managed network connections. Each connection may represent a remote server or peer.
For convenience, this class also manages all created instances and provides easy access to each through the use of the
GetInstance
static method. This makes it easier for other parts of code to quickly refer to a given network session without requiring complex argument passing between constructors.Products are encouraged to sub-class this class in order to customize behavior such as how to instantiate the game and player controllers.
- class ReplicationGroup : public IDisposable
The ReplicationGroup manages a group of INetworkObject objects whose state will all be managed together.
For convenience, this class also manages all created instances and provides easy access to each through the use of the
GetInstance
static method. This makes it easier for other parts of code to quickly refer to a given replication group without requiring complex argument passing between constructors.
- class SocketMessage : public axr.sdk.Object
Defines a single message that has been sent across the network.
- namespace Attributes
Enums
- enum ExecuteScope
Describes the different scopes of remote procedure call executions.
Values:
- CLIENT
- SERVER
- enum ReplicateMode
Describes the different modes of property replication that is supported by the network engine.
Values:
- ALWAYS
The property will always be replicated any time replication of state is performed.
- ON_CHANGED
The property will be replicated only when it’s value has changed.
- ONCE
The property is replicated only the first time it is set and never again.
- class EventAttribute : public OnMethodBoundaryAspect
- class ExecuteAttribute : public OnMethodBoundaryAspect
Use this attribute to mark a class method as being remotely executable. Remotely executable methods cannot have a return type.
A method marked with this attribute will be executed remotely under the following conditions.
+——-—+——-—+———————-—+ | NetMode | Scope | Executes | +——-—+——-—+———————-—+ |
CLIENT
|CLIENT
| Local client only | |CLIENT
|SERVER
| Local client and server | |SERVER
|CLIENT
| All clients and server | |SERVER
|SERVER
| Server only | +——-—+——-—+———————-—+
- class ReplicateAttribute : public Attribute
Use this attribute to mark a class property to be replicated across the network.
- namespace GameFramework
- class BasicGameController : public axr.sdk.Network.GameFramework.IGameController
Manages the state of a networked game session as the authoritative host or server.
The authoritative host/server has the ability to perform any action and control any object within the context of the network session.
The controller manages a collection of connected player controllers. Each player controller gives this server the ability to override any action or state triggered by another player.
Only one instance of the GameController ever exists in a network context at a time. This instance only runs on the host/server’s machine. Each player’s client will have a copy of the
GameState
object only. However, each player will have exactly one copy of the PlayerController for the player that they directly control.
- class BasicPlayerController : public axr.sdk.Network.NetworkObject, public axr.sdk.Network.GameFramework.IPlayerController
Manages the state of a player participating in a networked game session on behalf of a local client.
- class GameState : public axr.sdk.Network.NetworkObject
Represents a single game session’s state within the network.
- interface IGameController
Manages the state of a networked game session as the authoritative host or server.
The authoritative host/server has the ability to perform any action and control any object within the context of the network session.
The controller manages a collection of connected player controllers. Each player controller gives this server the ability to override any action or state triggered by another player.
Only one instance of the GameController ever exists in a network context at a time. This instance only runs on the host/server’s machine. Each player’s client will have a copy of the
GameState
object only. However, each player will have exactly one copy of the PlayerController for the player that they directly control.Subclassed by axr.sdk.Network.GameFramework.BasicGameController
- interface IPlayerController : public axr.sdk.Network.INetworkObject
Manages the state of a participating player in a networked session.
Subclassed by axr.sdk.Network.GameFramework.BasicPlayerController
- class PlayerState : public axr.sdk.Network.NetworkObject
Represents a single player’s state within a network session.