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::IMultiplayerSpawner Class Referenceabstract

IMultiplayerSpawner routes spawning requests for connecting players from the Muliplayer Gem to game logic utilizing it. More...

#include <IMultiplayerSpawner.h>

Inherited by Multiplayer::SimplePlayerSpawnerComponent.

Public Member Functions

 AZ_RTTI (IMultiplayerSpawner, "{E5525317-A476-4209-BE45-477FB9D96083}")
 
virtual Multiplayer::NetworkEntityHandle OnPlayerJoin (uint64_t userId, const Multiplayer::MultiplayerAgentDatum &agentDatum)=0
 
virtual void OnPlayerLeave (Multiplayer::ConstNetworkEntityHandle entityHandle, const Multiplayer::ReplicationSet &replicationSet, AzNetworking::DisconnectReason reason)=0
 

Detailed Description

IMultiplayerSpawner routes spawning requests for connecting players from the Muliplayer Gem to game logic utilizing it.

IMultiplayerSpawner is an AZ::Interface<T> that provides a mechanism to tell the Multiplayer Gem what to spawn on player connection. IMultiplayerSpawner is intended to be implemented on games utilizing the Multiplayer Gem. The Multiplayer Gem then calls the implementation via AZ::Interface.

Member Function Documentation

◆ OnPlayerJoin()

virtual Multiplayer::NetworkEntityHandle Multiplayer::IMultiplayerSpawner::OnPlayerJoin ( uint64_t  userId,
const Multiplayer::MultiplayerAgentDatum agentDatum 
)
pure virtual

Invoked when a Client connects/ClientHost starts a session to determine what autonomous Prefab should be spawned where

Parameters
userIdUser ID of joining player
agentDatumDatum containing connection data that can be used to inform join logic
Returns
A NetworkEntityHandle of the entity the player will have autonomy over

Implemented in Multiplayer::SimplePlayerSpawnerComponent.

◆ OnPlayerLeave()

virtual void Multiplayer::IMultiplayerSpawner::OnPlayerLeave ( Multiplayer::ConstNetworkEntityHandle  entityHandle,
const Multiplayer::ReplicationSet &  replicationSet,
AzNetworking::DisconnectReason  reason 
)
pure virtual

Invoked when a Client disconnects from the session to determine how the autonomous prefab should be cleaned up

Parameters
entityHandleThe entity handle to consider on leaving, generally the connection's primary player entity
replicationSetThe replication set of the related connection
reasonThe cause of disconnection

Implemented in Multiplayer::SimplePlayerSpawnerComponent.


The documentation for this class was generated from the following file: