Open 3D Engine Multiplayer Gem API Reference
24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
Multiplayer system component wraps the bridging logic between the game and transport layer. More...
#include <MultiplayerSystemComponent.h>
Inherits AZ::Component, AZ::TickBus::Handler, SessionNotificationBus::Handler, Multiplayer::ISessionHandlingClientRequests, AzNetworking::IConnectionListener, Multiplayer::IMultiplayer, AzFramework::RootSpawnableNotificationBus::Handler, and AzFramework::LevelLoadBlockerBus::Handler.
Public Member Functions | |
AZ_COMPONENT (MultiplayerSystemComponent, "{7C99C4C1-1103-43F9-AD62-8B91CF7C1981}") | |
bool | IsHandshakeComplete (AzNetworking::IConnection *connection) const |
bool | HandleRequest (AzNetworking::IConnection *connection, const AzNetworking::IPacketHeader &packetHeader, MultiplayerPackets::Connect &packet) |
bool | HandleRequest (AzNetworking::IConnection *connection, const AzNetworking::IPacketHeader &packetHeader, MultiplayerPackets::Accept &packet) |
bool | HandleRequest (AzNetworking::IConnection *connection, const AzNetworking::IPacketHeader &packetHeader, MultiplayerPackets::ReadyForEntityUpdates &packet) |
bool | HandleRequest (AzNetworking::IConnection *connection, const AzNetworking::IPacketHeader &packetHeader, MultiplayerPackets::SyncConsole &packet) |
bool | HandleRequest (AzNetworking::IConnection *connection, const AzNetworking::IPacketHeader &packetHeader, MultiplayerPackets::ConsoleCommand &packet) |
bool | HandleRequest (AzNetworking::IConnection *connection, const AzNetworking::IPacketHeader &packetHeader, MultiplayerPackets::EntityUpdates &packet) |
bool | HandleRequest (AzNetworking::IConnection *connection, const AzNetworking::IPacketHeader &packetHeader, MultiplayerPackets::EntityRpcs &packet) |
bool | HandleRequest (AzNetworking::IConnection *connection, const AzNetworking::IPacketHeader &packetHeader, MultiplayerPackets::RequestReplicatorReset &packet) |
bool | HandleRequest (AzNetworking::IConnection *connection, const AzNetworking::IPacketHeader &packetHeader, MultiplayerPackets::ClientMigration &packet) |
bool | HandleRequest (AzNetworking::IConnection *connection, const AzNetworking::IPacketHeader &packetHeader, MultiplayerPackets::VersionMismatch &packet) |
void | Activate () override |
void | Deactivate () override |
bool | OnSessionHealthCheck () override |
bool | OnCreateSessionBegin (const SessionConfig &sessionConfig) override |
void | OnCreateSessionEnd () override |
bool | OnDestroySessionBegin () override |
void | OnDestroySessionEnd () override |
void | OnUpdateSessionBegin (const SessionConfig &sessionConfig, const AZStd::string &updateReason) override |
void | OnUpdateSessionEnd () override |
void | OnTick (float deltaTime, AZ::ScriptTimePoint time) override |
int | GetTickOrder () override |
AzNetworking::ConnectResult | ValidateConnect (const AzNetworking::IpAddress &remoteAddress, const AzNetworking::IPacketHeader &packetHeader, AzNetworking::ISerializer &serializer) override |
void | OnConnect (AzNetworking::IConnection *connection) override |
AzNetworking::PacketDispatchResult | OnPacketReceived (AzNetworking::IConnection *connection, const AzNetworking::IPacketHeader &packetHeader, AzNetworking::ISerializer &serializer) override |
void | OnPacketLost (AzNetworking::IConnection *connection, AzNetworking::PacketId packetId) override |
void | OnDisconnect (AzNetworking::IConnection *connection, AzNetworking::DisconnectReason reason, AzNetworking::TerminationEndpoint endpoint) override |
bool | RequestPlayerJoinSession (const SessionConnectionConfig &sessionConnectionConfig) override |
void | RequestPlayerLeaveSession () override |
Request the connected player leave session. | |
MultiplayerAgentType | GetAgentType () const override |
void | InitializeMultiplayer (MultiplayerAgentType state) override |
bool | StartHosting (uint16_t port=UseDefaultHostPort, bool isDedicated=true) override |
bool | Connect (const AZStd::string &remoteAddress, uint16_t port) override |
void | Terminate (AzNetworking::DisconnectReason reason) override |
void | AddClientMigrationStartEventHandler (ClientMigrationStartEvent::Handler &handler) override |
void | AddClientMigrationEndEventHandler (ClientMigrationEndEvent::Handler &handler) override |
void | AddEndpointDisconnectedHandler (EndpointDisconnectedEvent::Handler &handler) override |
void | AddNotifyClientMigrationHandler (NotifyClientMigrationEvent::Handler &handler) override |
void | AddNotifyEntityMigrationEventHandler (NotifyEntityMigrationEvent::Handler &handler) override |
void | AddConnectionAcquiredHandler (ConnectionAcquiredEvent::Handler &handler) override |
void | AddNetworkInitHandler (NetworkInitEvent::Handler &handler) override |
void | AddSessionInitHandler (SessionInitEvent::Handler &) override |
void | AddSessionShutdownHandler (SessionShutdownEvent::Handler &) override |
void | AddLevelLoadBlockedHandler (LevelLoadBlockedEvent::Handler &handler) override |
void | AddNoServerLevelLoadedHandler (NoServerLevelLoadedEvent::Handler &handler) override |
void | AddVersionMismatchHandler (VersionMismatchEvent::Handler &handler) override |
void | AddServerAcceptanceReceivedHandler (ServerAcceptanceReceivedEvent::Handler &handler) override |
void | SendNotifyClientMigrationEvent (AzNetworking::ConnectionId connectionId, const HostId &hostId, uint64_t userIdentifier, ClientInputId lastClientInputId, NetEntityId controlledEntityId) override |
void | SendNotifyEntityMigrationEvent (const ConstNetworkEntityHandle &entityHandle, const HostId &remoteHostId) override |
void | SendReadyForEntityUpdates (bool readyForEntityUpdates) override |
AZ::TimeMs | GetCurrentHostTimeMs () const override |
float | GetCurrentBlendFactor () const override |
INetworkTime * | GetNetworkTime () override |
INetworkEntityManager * | GetNetworkEntityManager () override |
void | RegisterPlayerIdentifierForRejoin (uint64_t temporaryUserIdentifier, NetEntityId controlledEntityId) override |
void | CompleteClientMigration (uint64_t temporaryUserIdentifier, AzNetworking::ConnectionId connectionId, const HostId &publicHostId, ClientInputId migratedClientInputId) override |
void | SetShouldSpawnNetworkEntities (bool value) override |
bool | GetShouldSpawnNetworkEntities () const override |
void | DumpStats (const AZ::ConsoleCommandContainer &arguments) |
void | OnRootSpawnableReady (AZ::Data::Asset< AzFramework::Spawnable > rootSpawnable, uint32_t generation) override |
bool | ShouldBlockLevelLoading (const char *levelName) override |
Public Member Functions inherited from Multiplayer::ISessionHandlingClientRequests | |
AZ_RTTI (ISessionHandlingClientRequests, "{41DE6BD3-72BC-4443-BFF9-5B1B9396657A}") | |
Public Member Functions inherited from Multiplayer::IMultiplayer | |
AZ_RTTI (IMultiplayer, "{90A001DD-AD31-46C7-9FBE-1059AFB7F5E9}") | |
MultiplayerStats & | GetStats () |
Additional Inherited Members | |
Static Public Attributes inherited from Multiplayer::IMultiplayer | |
static const uint16_t | UseDefaultHostPort = 0 |
Multiplayer system component wraps the bridging logic between the game and transport layer.
|
override |
AZ::Component overrides.
|
overridevirtual |
Adds a ClientMigrationEndEvent Handler which is invoked when a client completes migration.
handler | The ClientMigrationEndEvent Handler to add |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Adds a ClientMigrationStartEvent Handler which is invoked at the start of a client migration.
handler | The ClientMigrationStartEvent Handler to add |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Adds a ConnectionAcquiredEvent Handler which is invoked when a new endpoint connects to the session.
handler | The ConnectionAcquiredEvent Handler to add |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Adds a EndpointDisconnectedEvent Handler which is invoked on the client when a disconnection occurs.
handler | The EndpointDisconnectedEvent Handler to add |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Adds a LevelLoadBlockedEvent Handler which is invoked whenever the multiplayer system blocks a level load.
handler | The LevelLoadBlockedEvent handler to add |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Adds a NetworkInitEvent Handler which is invoked when the network is initialized on the dedicated server or client-server.
handler | The NetworkInitEvent Handler to add |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Adds a NoServerLevelLoadedEvent Handler which is invoked whenever a client connects to a server that doesn't have any level loaded.
handler | The NoServerLevelLoadedEvent handler to add |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Adds a NotifyClientMigrationEvent Handler which is invoked when a client migrates from one host to another.
handler | The NotifyClientMigrationEvent Handler to add |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Adds a NotifyEntityMigrationEvent Handler which is invoked when an entity migrates from one host to another.
handler | The NotifyEntityMigrationEvent Handler to add |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Adds a ServerAcceptanceReceived Handler which is invoked when the client receives the accept packet from the server.
handler | The ServerAcceptanceReceived Handler to add |
Implements Multiplayer::IMultiplayer.
|
inlineoverridevirtual |
Implements Multiplayer::IMultiplayer.
|
inlineoverridevirtual |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Adds a VersionMismatchEvent Handler which is invoked whenever two multiplayer endpoints have a version mismatch. For example, the provided handler will be triggered if a client tries connecting to a server that's using a different multiplayer version.
handler | The VersionMismatchEvent handler to add |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Completes a client migration event by informing the appropriate client to migrate between hosts.
temporaryUserIdentifier | the temporary user identifier used to identify a player across hosts |
connectionId | the connection id of the player being migrated |
publicHostId | the public address of the new host the client should connect to |
migratedClientInputId | the last clientInputId processed prior to migration |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Connects to the specified IP as a Client.
remoteAddress | The domain or IP to connect to |
port | The port to connect to |
Implements Multiplayer::IMultiplayer.
void Multiplayer::MultiplayerSystemComponent::DumpStats | ( | const AZ::ConsoleCommandContainer & | arguments | ) |
Console commands.
|
overridevirtual |
IMultiplayer interface
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Returns the current blend factor for client side interpolation. This value is only relevant on the client and is used to smooth between host frames
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Returns the current server time in milliseconds. This can be one of three possible values:
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Returns the network entity manager instance bound to this multiplayer instance.
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Returns the network time instance bound to this multiplayer instance.
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Retrieves the current network entity instantiation behaviour.
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Sets the type of this Multiplayer connection and calls any related callback.
state | The state of this connection |
Implements Multiplayer::IMultiplayer.
|
override |
AzFramework::RootSpawnableNotificationBus::Handler
|
override |
SessionNotificationBus::Handler overrides.
|
override |
AZ::TickBus::Handler overrides.
|
overridevirtual |
Registers a temp userId to allow a host to look up a players controlled entity in the event of a rejoin or migration event.
temporaryUserIdentifier | the temporary user identifier used to identify a player across hosts |
controlledEntityId | the controlled entityId of the players autonomous entity |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
ISessionHandlingClientRequests interface
Implements Multiplayer::ISessionHandlingClientRequests.
|
overridevirtual |
Signals a NotifyClientMigrationEvent with the provided parameters.
connectionId | the connection id of the client that is migrating |
hostId | the host id of the host the client is migrating to |
userIdentifier | the user identifier the client will provide the new host to validate identity |
lastClientInputId | the last processed clientInputId by the current host |
controlledEntityId | the entityId of the clients autonomous entity |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Signals a NotifyEntityMigrationEvent with the provided parameters.
entityHandle | the network entity handle of the entity being migrated |
remoteHostId | the host id of the host the entity is migrating to |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Sends a packet telling if entity update messages can be sent.
readyForEntityUpdates | Ready for entity updates or not |
Implements Multiplayer::IMultiplayer.
|
overridevirtual |
Enables or disables automatic instantiation of netbound entities. This setting is controlled by the networking layer and should not be touched If enabled, netbound entities will instantiate as spawnables are loaded into the game world, generally true for the server If disabled, netbound entities will only stream from a host, always true for a client
value | boolean value controlling netbound entity instantiation behaviour |
Implements Multiplayer::IMultiplayer.
|
override |
AzFramework::LevelLoadBlockerBus::Handler overrides.
|
overridevirtual |
reason | The reason for terminating connections |
Implements Multiplayer::IMultiplayer.
|
override |
IConnectionListener interface