IMultiplayer provides insight into the Multiplayer session and its Agents.
More...
#include <IMultiplayer.h>
|
|
| 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, 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 | AddSessionInitHandler (SessionInitEvent::Handler &handler)=0 |
| |
| virtual void | AddSessionShutdownHandler (SessionShutdownEvent::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 |
◆ 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 |
◆ 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 |
◆ 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 |
◆ 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 |
◆ 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 |
◆ 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 |
◆ AddSessionInitHandler()
| virtual void Multiplayer::IMultiplayer::AddSessionInitHandler |
( |
SessionInitEvent::Handler & |
handler | ) |
|
|
pure virtual |
Adds a SessionInitEvent Handler which is invoked when a new network session starts.
- Parameters
-
| handler | The SessionInitEvent Handler to add |
◆ AddSessionShutdownHandler()
| virtual void Multiplayer::IMultiplayer::AddSessionShutdownHandler |
( |
SessionShutdownEvent::Handler & |
handler | ) |
|
|
pure virtual |
Adds a SessionShutdownEvent Handler which is invoked when the current network session ends.
- Parameters
-
| handler | The SessionShutdownEvent handler to add |
◆ 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 |
◆ 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
◆ GetAgentType()
| virtual MultiplayerAgentType Multiplayer::IMultiplayer::GetAgentType |
( |
| ) |
const |
|
pure virtual |
Gets the type of Agent this IMultiplayer impl represents.
- Returns
- The type of agents represented
◆ 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
◆ 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
◆ 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
◆ 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
◆ 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
◆ 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 |
Sets the type of this Multiplayer connection and calls any related callback.
- Parameters
-
| state | The state of this connection |
◆ 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 |
◆ 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 |
◆ 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 |
◆ SendReadyForEntityUpdates()
| virtual void Multiplayer::IMultiplayer::SendReadyForEntityUpdates |
( |
bool |
readyForEntityUpdates | ) |
|
|
pure virtual |
Sends a packet telling if entity update messages can be sent.
- Parameters
-
| readyForEntityUpdates | Ready for entity updates or not |
◆ 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 |
◆ StartHosting()
| virtual bool Multiplayer::IMultiplayer::StartHosting |
( |
uint16_t |
port, |
|
|
bool |
isDedicated = true |
|
) |
| |
|
pure virtual |
Starts hosting a server.
- Parameters
-
| port | The port to listen for connection on |
| isDedicated | Whether the server is dedicated or client hosted |
- Returns
- if the application successfully started hosting
◆ Terminate()
| virtual void Multiplayer::IMultiplayer::Terminate |
( |
AzNetworking::DisconnectReason |
reason | ) |
|
|
pure virtual |
- Parameters
-
| reason | The reason for terminating connections |
The documentation for this class was generated from the following file:
- Gems/Multiplayer/Code/Include/Multiplayer/IMultiplayer.h