IMultiplayer provides insight into the Multiplayer session and its Agents.
More...
#include <IMultiplayer.h>
Inherited by Multiplayer::MultiplayerSystemComponent.
|
| AZ_RTTI (IMultiplayer, "{90A001DD-AD31-46C7-9FBE-1059AFB7F5E9}") |
|
virtual MultiplayerAgentType | GetAgentType () const =0 |
|
virtual void | InitializeMultiplayer (MultiplayerAgentType state)=0 |
|
virtual bool | StartHosting (uint16_t port=UseDefaultHostPort, bool isDedicated=true)=0 |
|
virtual bool | Connect (const AZStd::string &remoteAddress, uint16_t port)=0 |
|
virtual void | Terminate (AzNetworking::DisconnectReason reason)=0 |
|
virtual void | AddClientMigrationStartEventHandler (ClientMigrationStartEvent::Handler &handler)=0 |
|
virtual void | AddClientMigrationEndEventHandler (ClientMigrationEndEvent::Handler &handler)=0 |
|
virtual void | AddEndpointDisconnectedHandler (EndpointDisconnectedEvent::Handler &handler)=0 |
|
virtual void | AddNotifyClientMigrationHandler (NotifyClientMigrationEvent::Handler &handler)=0 |
|
virtual void | AddNotifyEntityMigrationEventHandler (NotifyEntityMigrationEvent::Handler &handler)=0 |
|
virtual void | AddConnectionAcquiredHandler (ConnectionAcquiredEvent::Handler &handler)=0 |
|
virtual void | AddServerAcceptanceReceivedHandler (ServerAcceptanceReceivedEvent::Handler &handler)=0 |
|
virtual void | AddNetworkInitHandler (NetworkInitEvent::Handler &handler)=0 |
|
virtual void | AddSessionInitHandler (SessionInitEvent::Handler &handler)=0 |
|
virtual void | AddSessionShutdownHandler (SessionShutdownEvent::Handler &handler)=0 |
|
virtual void | AddLevelLoadBlockedHandler (LevelLoadBlockedEvent::Handler &handler)=0 |
|
virtual void | AddNoServerLevelLoadedHandler (NoServerLevelLoadedEvent::Handler &handler)=0 |
|
virtual void | AddVersionMismatchHandler (VersionMismatchEvent::Handler &handler)=0 |
|
virtual void | SendNotifyClientMigrationEvent (AzNetworking::ConnectionId connectionId, const HostId &hostId, uint64_t userIdentifier, ClientInputId lastClientInputId, NetEntityId controlledEntityId)=0 |
|
virtual void | SendNotifyEntityMigrationEvent (const ConstNetworkEntityHandle &entityHandle, const HostId &remoteHostId)=0 |
|
virtual void | SendReadyForEntityUpdates (bool readyForEntityUpdates)=0 |
|
virtual AZ::TimeMs | GetCurrentHostTimeMs () const =0 |
|
virtual float | GetCurrentBlendFactor () const =0 |
|
virtual INetworkTime * | GetNetworkTime ()=0 |
|
virtual INetworkEntityManager * | GetNetworkEntityManager ()=0 |
|
virtual void | RegisterPlayerIdentifierForRejoin (uint64_t temporaryUserIdentifier, NetEntityId controlledEntityId)=0 |
|
virtual void | CompleteClientMigration (uint64_t temporaryUserIdentifier, AzNetworking::ConnectionId connectionId, const HostId &publicHostId, ClientInputId migratedClientInputId)=0 |
|
virtual void | SetShouldSpawnNetworkEntities (bool value)=0 |
|
virtual bool | GetShouldSpawnNetworkEntities () const =0 |
|
MultiplayerStats & | GetStats () |
|
IMultiplayer provides insight into the Multiplayer session and its Agents.
IMultiplayer is an AZ::Interface<T> that provides applications access to multiplayer session information and events. IMultiplayer is implemented on the MultiplayerSystemComponent and is used to define and access information about the type of session and the role held by the current agent. An Agent is defined here as an actor in a session. Types of Agents included by default are a Client, a Client Server and a Dedicated Server.
IMultiplayer also provides events to allow developers to receive and respond to notifications relating to the session. These include Session Init and Shutdown and on acquisition of a new connection. These events are only fired on Client Server or Dedicated Server. These events are useful for services that talk to matchmaking services that may run in an entirely different layer which may need insight to the gameplay session.
◆ AddClientMigrationEndEventHandler()
virtual void Multiplayer::IMultiplayer::AddClientMigrationEndEventHandler |
( |
ClientMigrationEndEvent::Handler & |
handler | ) |
|
|
pure virtual |
Adds a ClientMigrationEndEvent Handler which is invoked when a client completes migration.
- Parameters
-
handler | The ClientMigrationEndEvent Handler to add |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ AddClientMigrationStartEventHandler()
virtual void Multiplayer::IMultiplayer::AddClientMigrationStartEventHandler |
( |
ClientMigrationStartEvent::Handler & |
handler | ) |
|
|
pure virtual |
Adds a ClientMigrationStartEvent Handler which is invoked at the start of a client migration.
- Parameters
-
handler | The ClientMigrationStartEvent Handler to add |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ AddConnectionAcquiredHandler()
virtual void Multiplayer::IMultiplayer::AddConnectionAcquiredHandler |
( |
ConnectionAcquiredEvent::Handler & |
handler | ) |
|
|
pure virtual |
Adds a ConnectionAcquiredEvent Handler which is invoked when a new endpoint connects to the session.
- Parameters
-
handler | The ConnectionAcquiredEvent Handler to add |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ AddEndpointDisconnectedHandler()
virtual void Multiplayer::IMultiplayer::AddEndpointDisconnectedHandler |
( |
EndpointDisconnectedEvent::Handler & |
handler | ) |
|
|
pure virtual |
Adds a EndpointDisconnectedEvent Handler which is invoked on the client when a disconnection occurs.
- Parameters
-
handler | The EndpointDisconnectedEvent Handler to add |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ AddLevelLoadBlockedHandler()
virtual void Multiplayer::IMultiplayer::AddLevelLoadBlockedHandler |
( |
LevelLoadBlockedEvent::Handler & |
handler | ) |
|
|
pure virtual |
Adds a LevelLoadBlockedEvent Handler which is invoked whenever the multiplayer system blocks a level load.
- Parameters
-
handler | The LevelLoadBlockedEvent handler to add |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ AddNetworkInitHandler()
virtual void Multiplayer::IMultiplayer::AddNetworkInitHandler |
( |
NetworkInitEvent::Handler & |
handler | ) |
|
|
pure virtual |
Adds a NetworkInitEvent Handler which is invoked when the network is initialized on the dedicated server or client-server.
- Parameters
-
handler | The NetworkInitEvent Handler to add |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ AddNoServerLevelLoadedHandler()
virtual void Multiplayer::IMultiplayer::AddNoServerLevelLoadedHandler |
( |
NoServerLevelLoadedEvent::Handler & |
handler | ) |
|
|
pure virtual |
Adds a NoServerLevelLoadedEvent Handler which is invoked whenever a client connects to a server that doesn't have any level loaded.
- Parameters
-
handler | The NoServerLevelLoadedEvent handler to add |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ AddNotifyClientMigrationHandler()
virtual void Multiplayer::IMultiplayer::AddNotifyClientMigrationHandler |
( |
NotifyClientMigrationEvent::Handler & |
handler | ) |
|
|
pure virtual |
Adds a NotifyClientMigrationEvent Handler which is invoked when a client migrates from one host to another.
- Parameters
-
handler | The NotifyClientMigrationEvent Handler to add |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ AddNotifyEntityMigrationEventHandler()
virtual void Multiplayer::IMultiplayer::AddNotifyEntityMigrationEventHandler |
( |
NotifyEntityMigrationEvent::Handler & |
handler | ) |
|
|
pure virtual |
Adds a NotifyEntityMigrationEvent Handler which is invoked when an entity migrates from one host to another.
- Parameters
-
handler | The NotifyEntityMigrationEvent Handler to add |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ AddServerAcceptanceReceivedHandler()
virtual void Multiplayer::IMultiplayer::AddServerAcceptanceReceivedHandler |
( |
ServerAcceptanceReceivedEvent::Handler & |
handler | ) |
|
|
pure virtual |
Adds a ServerAcceptanceReceived Handler which is invoked when the client receives the accept packet from the server.
- Parameters
-
handler | The ServerAcceptanceReceived Handler to add |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ AddSessionInitHandler()
virtual void Multiplayer::IMultiplayer::AddSessionInitHandler |
( |
SessionInitEvent::Handler & |
handler | ) |
|
|
pure virtual |
◆ AddSessionShutdownHandler()
virtual void Multiplayer::IMultiplayer::AddSessionShutdownHandler |
( |
SessionShutdownEvent::Handler & |
handler | ) |
|
|
pure virtual |
◆ AddVersionMismatchHandler()
virtual void Multiplayer::IMultiplayer::AddVersionMismatchHandler |
( |
VersionMismatchEvent::Handler & |
handler | ) |
|
|
pure virtual |
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.
- Parameters
-
handler | The VersionMismatchEvent handler to add |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ CompleteClientMigration()
virtual void Multiplayer::IMultiplayer::CompleteClientMigration |
( |
uint64_t |
temporaryUserIdentifier, |
|
|
AzNetworking::ConnectionId |
connectionId, |
|
|
const HostId & |
publicHostId, |
|
|
ClientInputId |
migratedClientInputId |
|
) |
| |
|
pure virtual |
Completes a client migration event by informing the appropriate client to migrate between hosts.
- Parameters
-
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 |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ Connect()
virtual bool Multiplayer::IMultiplayer::Connect |
( |
const AZStd::string & |
remoteAddress, |
|
|
uint16_t |
port |
|
) |
| |
|
pure virtual |
Connects to the specified IP as a Client.
- Parameters
-
remoteAddress | The domain or IP to connect to |
port | The port to connect to |
- Returns
- if a connection was successfully created
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ GetAgentType()
virtual MultiplayerAgentType Multiplayer::IMultiplayer::GetAgentType |
( |
| ) |
const |
|
pure virtual |
◆ GetCurrentBlendFactor()
virtual float Multiplayer::IMultiplayer::GetCurrentBlendFactor |
( |
| ) |
const |
|
pure virtual |
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
- Returns
- the current blend factor
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ GetCurrentHostTimeMs()
virtual AZ::TimeMs Multiplayer::IMultiplayer::GetCurrentHostTimeMs |
( |
| ) |
const |
|
pure virtual |
Returns the current server time in milliseconds. This can be one of three possible values:
- On the host outside of rewind scope, this will return the latest application elapsed time in ms.
- On the host within rewind scope, this will return the rewound time in ms.
- On the client, this will return the most recently replicated server time in ms.
- Returns
- the current server time in milliseconds
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ GetNetworkEntityManager()
Returns the network entity manager instance bound to this multiplayer instance.
- Returns
- pointer to the network entity manager instance bound to this multiplayer instance
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ GetNetworkTime()
virtual INetworkTime* Multiplayer::IMultiplayer::GetNetworkTime |
( |
| ) |
|
|
pure virtual |
Returns the network time instance bound to this multiplayer instance.
- Returns
- pointer to the network time instance bound to this multiplayer instance
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ GetShouldSpawnNetworkEntities()
virtual bool Multiplayer::IMultiplayer::GetShouldSpawnNetworkEntities |
( |
| ) |
const |
|
pure virtual |
Retrieves the current network entity instantiation behaviour.
- Returns
- boolean true if netbound entities should be auto instantiated, false if not
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ GetStats()
Retrieve the stats object bound to this multiplayer instance.
- Returns
- the stats object bound to this multiplayer instance
◆ InitializeMultiplayer()
virtual void Multiplayer::IMultiplayer::InitializeMultiplayer |
( |
MultiplayerAgentType |
state | ) |
|
|
pure virtual |
◆ RegisterPlayerIdentifierForRejoin()
virtual void Multiplayer::IMultiplayer::RegisterPlayerIdentifierForRejoin |
( |
uint64_t |
temporaryUserIdentifier, |
|
|
NetEntityId |
controlledEntityId |
|
) |
| |
|
pure virtual |
Registers a temp userId to allow a host to look up a players controlled entity in the event of a rejoin or migration event.
- Parameters
-
temporaryUserIdentifier | the temporary user identifier used to identify a player across hosts |
controlledEntityId | the controlled entityId of the players autonomous entity |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ SendNotifyClientMigrationEvent()
virtual void Multiplayer::IMultiplayer::SendNotifyClientMigrationEvent |
( |
AzNetworking::ConnectionId |
connectionId, |
|
|
const HostId & |
hostId, |
|
|
uint64_t |
userIdentifier, |
|
|
ClientInputId |
lastClientInputId, |
|
|
NetEntityId |
controlledEntityId |
|
) |
| |
|
pure virtual |
Signals a NotifyClientMigrationEvent with the provided parameters.
- 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 |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ SendNotifyEntityMigrationEvent()
virtual void Multiplayer::IMultiplayer::SendNotifyEntityMigrationEvent |
( |
const ConstNetworkEntityHandle & |
entityHandle, |
|
|
const HostId & |
remoteHostId |
|
) |
| |
|
pure virtual |
Signals a NotifyEntityMigrationEvent with the provided parameters.
- Parameters
-
entityHandle | the network entity handle of the entity being migrated |
remoteHostId | the host id of the host the entity is migrating to |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ SendReadyForEntityUpdates()
virtual void Multiplayer::IMultiplayer::SendReadyForEntityUpdates |
( |
bool |
readyForEntityUpdates | ) |
|
|
pure virtual |
◆ SetShouldSpawnNetworkEntities()
virtual void Multiplayer::IMultiplayer::SetShouldSpawnNetworkEntities |
( |
bool |
value | ) |
|
|
pure virtual |
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
- Parameters
-
value | boolean value controlling netbound entity instantiation behaviour |
Implemented in Multiplayer::MultiplayerSystemComponent.
◆ Terminate()
virtual void Multiplayer::IMultiplayer::Terminate |
( |
AzNetworking::DisconnectReason |
reason | ) |
|
|
pure virtual |
◆ UseDefaultHostPort
const uint16_t Multiplayer::IMultiplayer::UseDefaultHostPort = 0 |
|
static |
Starts hosting a server.
- Parameters
-
port | The port to listen for connection on, 0 means use the currently configured port value of sv_port |
isDedicated | Whether the server is dedicated or client hosted |
- Returns
- if the application successfully started hosting
The documentation for this class was generated from the following file:
- Gems/Multiplayer/Code/Include/Multiplayer/IMultiplayer.h