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

The interface for managing all networked entities. More...

#include <INetworkEntityManager.h>

Inherited by Multiplayer::NetworkEntityManager.

Public Types

using EntityList = AZStd::vector< NetworkEntityHandle >
 

Public Member Functions

 AZ_RTTI (INetworkEntityManager, "{109759DE-9492-439C-A0B1-AE46E6FD029C}")
 
virtual void Initialize (const HostId &hostId, AZStd::unique_ptr< IEntityDomain > entityDomain)=0
 
virtual bool IsInitialized () const =0
 
virtual IEntityDomainGetEntityDomain () const =0
 
virtual NetworkEntityTrackerGetNetworkEntityTracker ()=0
 
virtual NetworkEntityAuthorityTrackerGetNetworkEntityAuthorityTracker ()=0
 
virtual MultiplayerComponentRegistryGetMultiplayerComponentRegistry ()=0
 
virtual const HostId & GetHostId () const =0
 
virtual EntityList CreateEntitiesImmediate (const PrefabEntityId &prefabEntryId, NetEntityRole netEntityRole, const AZ::Transform &transform, AutoActivate autoActivate=AutoActivate::Activate)=0
 
virtual EntityList CreateEntitiesImmediate (const PrefabEntityId &prefabEntryId, NetEntityId netEntityId, NetEntityRole netEntityRole, AutoActivate autoActivate, const AZ::Transform &transform)=0
 
virtual AZStd::unique_ptr< AzFramework::EntitySpawnTicket > RequestNetSpawnableInstantiation (const AZ::Data::Asset< AzFramework::Spawnable > &netSpawnable, const AZ::Transform &transform)=0
 
virtual void SetupNetEntity (AZ::Entity *netEntity, PrefabEntityId prefabEntityId, NetEntityRole netEntityRole)=0
 
virtual ConstNetworkEntityHandle GetEntity (NetEntityId netEntityId) const =0
 
virtual uint32_t GetEntityCount () const =0
 
virtual NetEntityId GetNetEntityIdById (const AZ::EntityId &entityId) const =0
 
virtual NetworkEntityHandle AddEntityToEntityMap (NetEntityId netEntityId, AZ::Entity *entity)=0
 
virtual void RemoveEntityFromEntityMap (NetEntityId netEntityId)=0
 
virtual void MarkForRemoval (const ConstNetworkEntityHandle &entityHandle)=0
 
virtual bool IsMarkedForRemoval (const ConstNetworkEntityHandle &entityHandle) const =0
 
virtual void ClearEntityFromRemovalList (const ConstNetworkEntityHandle &entityHandle)=0
 
virtual void ClearAllEntities ()=0
 Clears out and deletes all entities registered with the entity manager.
 
virtual void AddEntityMarkedDirtyHandler (AZ::Event<>::Handler &entityMarkedDirtyHandle)=0
 
virtual void AddEntityNotifyChangesHandler (AZ::Event<>::Handler &entityNotifyChangesHandle)=0
 
virtual void AddEntityExitDomainHandler (EntityExitDomainEvent::Handler &entityExitDomainHandler)=0
 
virtual void AddControllersActivatedHandler (ControllersActivatedEvent::Handler &controllersActivatedHandler)=0
 
virtual void AddControllersDeactivatedHandler (ControllersDeactivatedEvent::Handler &controllersDeactivatedHandler)=0
 
virtual void NotifyEntitiesDirtied ()=0
 Notifies entities that they should process their dirty state.
 
virtual void NotifyEntitiesChanged ()=0
 Notifies entities that they should process change notifications.
 
virtual void NotifyControllersActivated (const ConstNetworkEntityHandle &entityHandle, EntityIsMigrating entityIsMigrating)=0
 
virtual void NotifyControllersDeactivated (const ConstNetworkEntityHandle &entityHandle, EntityIsMigrating entityIsMigrating)=0
 
virtual void HandleLocalRpcMessage (NetworkEntityRpcMessage &message)=0
 
virtual void HandleEntitiesExitDomain (const NetEntityIdSet &entitiesNotInDomain)=0
 
virtual void ForceAssumeAuthority (const ConstNetworkEntityHandle &entityHandle)=0
 
virtual void MarkAlwaysRelevantToClients (const ConstNetworkEntityHandle &entityHandle, bool alwaysRelevant)=0
 
virtual void MarkAlwaysRelevantToServers (const ConstNetworkEntityHandle &entityHandle, bool alwaysRelevant)=0
 
virtual const NetEntityHandleSet & GetAlwaysRelevantToClientsSet () const =0
 
virtual const NetEntityHandleSet & GetAlwaysRelevantToServersSet () const =0
 
virtual void SetMigrateTimeoutTimeMs (AZ::TimeMs timeoutTimeMs)=0
 
virtual void DebugDraw () const =0
 Visualization of network entity manager state.
 

Detailed Description

The interface for managing all networked entities.

Member Function Documentation

◆ AddControllersActivatedHandler()

virtual void Multiplayer::INetworkEntityManager::AddControllersActivatedHandler ( ControllersActivatedEvent::Handler &  controllersActivatedHandler)
pure virtual

Adds an event handler to be invoked when an entities controllers have activated

Parameters
controllersActivatedHandlerevent handler for the entity

Implemented in Multiplayer::NetworkEntityManager.

◆ AddControllersDeactivatedHandler()

virtual void Multiplayer::INetworkEntityManager::AddControllersDeactivatedHandler ( ControllersDeactivatedEvent::Handler &  controllersDeactivatedHandler)
pure virtual

Adds an event handler to be invoked when an entities controllers have been deactivated

Parameters
controllersDeactivatedHandlerevent handler for the entity

Implemented in Multiplayer::NetworkEntityManager.

◆ AddEntityExitDomainHandler()

virtual void Multiplayer::INetworkEntityManager::AddEntityExitDomainHandler ( EntityExitDomainEvent::Handler &  entityExitDomainHandler)
pure virtual

Adds an event handler to be invoked when we notify entities to send their change notifications.

Parameters
entityNotifyChangesHandleevent handler for the dirtied entity

Implemented in Multiplayer::NetworkEntityManager.

◆ AddEntityMarkedDirtyHandler()

virtual void Multiplayer::INetworkEntityManager::AddEntityMarkedDirtyHandler ( AZ::Event<>::Handler &  entityMarkedDirtyHandle)
pure virtual

Adds an event handler to be invoked when we notify which entities have been marked dirty.

Parameters
entityMarkedDirtyHandleevent handler for the dirtied entity

Implemented in Multiplayer::NetworkEntityManager.

◆ AddEntityNotifyChangesHandler()

virtual void Multiplayer::INetworkEntityManager::AddEntityNotifyChangesHandler ( AZ::Event<>::Handler &  entityNotifyChangesHandle)
pure virtual

Adds an event handler to be invoked when we notify entities to send their change notifications.

Parameters
entityNotifyChangesHandleevent handler for the dirtied entity

Implemented in Multiplayer::NetworkEntityManager.

◆ AddEntityToEntityMap()

virtual NetworkEntityHandle Multiplayer::INetworkEntityManager::AddEntityToEntityMap ( NetEntityId  netEntityId,
AZ::Entity *  entity 
)
pure virtual

Adds the provided entity to the internal entity map identified by the provided netEntityId.

Parameters
netEntityIdthe identifier to use for the added entity
entitythe entity to add to the internal entity map
Returns
a NetworkEntityHandle for the newly added entity

Implemented in Multiplayer::NetworkEntityManager.

◆ ClearEntityFromRemovalList()

virtual void Multiplayer::INetworkEntityManager::ClearEntityFromRemovalList ( const ConstNetworkEntityHandle entityHandle)
pure virtual

Unmarks the specified entity so it will no longer be removed and deleted.

Parameters
entityHandlethe entity to unmark for removal and deletion

Implemented in Multiplayer::NetworkEntityManager.

◆ CreateEntitiesImmediate() [1/2]

virtual EntityList Multiplayer::INetworkEntityManager::CreateEntitiesImmediate ( const PrefabEntityId prefabEntryId,
NetEntityId  netEntityId,
NetEntityRole  netEntityRole,
AutoActivate  autoActivate,
const AZ::Transform &  transform 
)
pure virtual

Creates new entities of the given archetype This interface is internally used to spawn replicated entities

Parameters
prefabEntryIdthe name of the spawnable to spawn

Implemented in Multiplayer::NetworkEntityManager.

◆ CreateEntitiesImmediate() [2/2]

virtual EntityList Multiplayer::INetworkEntityManager::CreateEntitiesImmediate ( const PrefabEntityId prefabEntryId,
NetEntityRole  netEntityRole,
const AZ::Transform &  transform,
AutoActivate  autoActivate = AutoActivate::Activate 
)
pure virtual

Creates new entities of the given archetype

Parameters
prefabEntryIdthe name of the spawnable to spawn

Implemented in Multiplayer::NetworkEntityManager.

◆ ForceAssumeAuthority()

virtual void Multiplayer::INetworkEntityManager::ForceAssumeAuthority ( const ConstNetworkEntityHandle entityHandle)
pure virtual

Forcibly assumes authoritative control over the given entity. This should only be used in the event of the unexpected loss of the previous authority, any other usage could corrupt the simulation.

Parameters
entityHandlethe entity to forcibly assume authoritative control over

Implemented in Multiplayer::NetworkEntityManager.

◆ GetAlwaysRelevantToClientsSet()

virtual const NetEntityHandleSet& Multiplayer::INetworkEntityManager::GetAlwaysRelevantToClientsSet ( ) const
pure virtual

Retrieves the set of network entities that should always be relevant to client connections.

Returns
the set of network entities that should always be relevant to client connections

Implemented in Multiplayer::NetworkEntityManager.

◆ GetAlwaysRelevantToServersSet()

virtual const NetEntityHandleSet& Multiplayer::INetworkEntityManager::GetAlwaysRelevantToServersSet ( ) const
pure virtual

Retrieves the set of network entities that should always be relevant to server connections.

Returns
the set of network entities that should always be relevant to server connections

Implemented in Multiplayer::NetworkEntityManager.

◆ GetEntity()

virtual ConstNetworkEntityHandle Multiplayer::INetworkEntityManager::GetEntity ( NetEntityId  netEntityId) const
pure virtual

Returns an ConstEntityPtr for the provided entityId.

Parameters
netEntityIdthe netEntityId to get an ConstEntityPtr for
Returns
the requested ConstEntityPtr

Implemented in Multiplayer::NetworkEntityManager.

◆ GetEntityCount()

virtual uint32_t Multiplayer::INetworkEntityManager::GetEntityCount ( ) const
pure virtual

Returns the total number of entities tracked by this INetworkEntityManager instance.

Returns
the total number of entities tracked by this INetworkEntityManager instance

Implemented in Multiplayer::NetworkEntityManager.

◆ GetEntityDomain()

virtual IEntityDomain* Multiplayer::INetworkEntityManager::GetEntityDomain ( ) const
pure virtual

Returns the entity domain associated with this network entity manager, this will be nullptr on clients.

Returns
boolean the entity domain for this network entity manager

Implemented in Multiplayer::NetworkEntityManager.

◆ GetHostId()

virtual const HostId& Multiplayer::INetworkEntityManager::GetHostId ( ) const
pure virtual

Returns the HostId for this INetworkEntityManager instance.

Returns
the HostId for this INetworkEntityManager instance

Implemented in Multiplayer::NetworkEntityManager.

◆ GetMultiplayerComponentRegistry()

virtual MultiplayerComponentRegistry* Multiplayer::INetworkEntityManager::GetMultiplayerComponentRegistry ( )
pure virtual

◆ GetNetEntityIdById()

virtual NetEntityId Multiplayer::INetworkEntityManager::GetNetEntityIdById ( const AZ::EntityId &  entityId) const
pure virtual

Returns the Net Entity ID for a given AZ Entity ID.

Parameters
entityIdthe AZ Entity ID
Returns
the Net Entity ID

Implemented in Multiplayer::NetworkEntityManager.

◆ GetNetworkEntityAuthorityTracker()

virtual NetworkEntityAuthorityTracker* Multiplayer::INetworkEntityManager::GetNetworkEntityAuthorityTracker ( )
pure virtual

◆ GetNetworkEntityTracker()

virtual NetworkEntityTracker* Multiplayer::INetworkEntityManager::GetNetworkEntityTracker ( )
pure virtual

Returns the NetworkEntityTracker for this INetworkEntityManager instance.

Returns
the NetworkEntityTracker for this INetworkEntityManager instance

Implemented in Multiplayer::NetworkEntityManager.

◆ HandleEntitiesExitDomain()

virtual void Multiplayer::INetworkEntityManager::HandleEntitiesExitDomain ( const NetEntityIdSet &  entitiesNotInDomain)
pure virtual

Handles a set of entities transitioning between entity domains.

Parameters
entitiesNotInDomainthe set of entities that are no longer contained within our entity domain

Implemented in Multiplayer::NetworkEntityManager.

◆ HandleLocalRpcMessage()

virtual void Multiplayer::INetworkEntityManager::HandleLocalRpcMessage ( NetworkEntityRpcMessage message)
pure virtual

Handle a local rpc message.

Parameters
entityRpcMessagethe local rpc message to handle

Implemented in Multiplayer::NetworkEntityManager.

◆ Initialize()

virtual void Multiplayer::INetworkEntityManager::Initialize ( const HostId &  hostId,
AZStd::unique_ptr< IEntityDomain entityDomain 
)
pure virtual

Configures the NetworkEntityManager.

Parameters
hostIdthe hostId of this NetworkEntityManager (invalid for clients)
entityDomainthe entity domain used to determine which entities this manager has authority over

Implemented in Multiplayer::NetworkEntityManager.

◆ IsInitialized()

virtual bool Multiplayer::INetworkEntityManager::IsInitialized ( ) const
pure virtual

Returns whether or not the network entity manager has been initialized.

Returns
boolean true if this network entity manager has been intialized

Implemented in Multiplayer::NetworkEntityManager.

◆ IsMarkedForRemoval()

virtual bool Multiplayer::INetworkEntityManager::IsMarkedForRemoval ( const ConstNetworkEntityHandle entityHandle) const
pure virtual

Returns true if the indicated entity is marked for removal.

Parameters
entityHandlethe entity to test if marked for removal
Returns
boolean true if the specified entity is marked for removal, false otherwise

Implemented in Multiplayer::NetworkEntityManager.

◆ MarkAlwaysRelevantToClients()

virtual void Multiplayer::INetworkEntityManager::MarkAlwaysRelevantToClients ( const ConstNetworkEntityHandle entityHandle,
bool  alwaysRelevant 
)
pure virtual

Will toggle whether or not the provided entity should always be relevant to client connections. Use carefully, as this will cause the entity to bypass normal relevancy checks and could cause bandwidth issues.

Parameters
entityHandleconst network entity handle to the entity to override relevancy for
alwaysRelevanta true value will enable always relevant, false will disable

Implemented in Multiplayer::NetworkEntityManager.

◆ MarkAlwaysRelevantToServers()

virtual void Multiplayer::INetworkEntityManager::MarkAlwaysRelevantToServers ( const ConstNetworkEntityHandle entityHandle,
bool  alwaysRelevant 
)
pure virtual

Will toggle whether or not the provided entity should always be relevant to server connections. Use carefully, as this will cause the entity to bypass normal relevancy checks and could cause bandwidth issues.

Parameters
entityHandleconst network entity handle to the entity to override relevancy for
alwaysRelevanta true value will enable always relevant, false will disable

Implemented in Multiplayer::NetworkEntityManager.

◆ MarkForRemoval()

virtual void Multiplayer::INetworkEntityManager::MarkForRemoval ( const ConstNetworkEntityHandle entityHandle)
pure virtual

Marks the specified entity for removal and deletion.

Parameters
entityHandlethe entity to remove and delete

Implemented in Multiplayer::NetworkEntityManager.

◆ NotifyControllersActivated()

virtual void Multiplayer::INetworkEntityManager::NotifyControllersActivated ( const ConstNetworkEntityHandle entityHandle,
EntityIsMigrating  entityIsMigrating 
)
pure virtual

Notifies that an entities controllers have activated.

Parameters
entityHandlehandle to the entity whose controllers have activated
entityIsMigratingtrue if the entity is activating after a migration

Implemented in Multiplayer::NetworkEntityManager.

◆ NotifyControllersDeactivated()

virtual void Multiplayer::INetworkEntityManager::NotifyControllersDeactivated ( const ConstNetworkEntityHandle entityHandle,
EntityIsMigrating  entityIsMigrating 
)
pure virtual

Notifies that an entities controllers have been deactivated.

Parameters
entityHandlehandle to the entity whose controllers have been deactivated
entityIsMigratingtrue if the entity is deactivating due to a migration

Implemented in Multiplayer::NetworkEntityManager.

◆ RemoveEntityFromEntityMap()

virtual void Multiplayer::INetworkEntityManager::RemoveEntityFromEntityMap ( NetEntityId  netEntityId)
pure virtual

Removes the provided netEntityId from the internal entity map.

Parameters
netEntityIdthe identifier to use for the added entity

Implemented in Multiplayer::NetworkEntityManager.

◆ RequestNetSpawnableInstantiation()

virtual AZStd::unique_ptr<AzFramework::EntitySpawnTicket> Multiplayer::INetworkEntityManager::RequestNetSpawnableInstantiation ( const AZ::Data::Asset< AzFramework::Spawnable > &  netSpawnable,
const AZ::Transform &  transform 
)
pure virtual

Requests a network spawnable to instantiate at a given transform This is an async function. The instantiated entities are not available immediately but will be constructed by the spawnable system The spawnable ticket has to be kept for the whole lifetime of the entities

Parameters
netSpawnablethe network spawnable to spawn
transformthe transform where the spawnable should be spawned
Returns
the ticket for managing the spawned entities

Implemented in Multiplayer::NetworkEntityManager.

◆ SetMigrateTimeoutTimeMs()

virtual void Multiplayer::INetworkEntityManager::SetMigrateTimeoutTimeMs ( AZ::TimeMs  timeoutTimeMs)
pure virtual

Overrides the default timeout time used during entity migrations.

Parameters
timeoutTimeMsthe timeout time to use in milliseconds

Implemented in Multiplayer::NetworkEntityManager.

◆ SetupNetEntity()

virtual void Multiplayer::INetworkEntityManager::SetupNetEntity ( AZ::Entity *  netEntity,
PrefabEntityId  prefabEntityId,
NetEntityRole  netEntityRole 
)
pure virtual

Configures new networked entity

Parameters
netEntitythe entity to setup
prefabEntryIdthe name of the spawnable the entity originated from
netEntityRolethe net role the entity should be setup for

Implemented in Multiplayer::NetworkEntityManager.


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