#include <NetworkEntityManager.h>
Inherits Multiplayer::INetworkEntityManager, AzFramework::RootSpawnableNotificationBus::Handler, and AzFramework::SpawnableAssetEventsBus::Handler.
Public Member Functions | |
void | DispatchLocalDeferredRpcMessages () |
void | Reset () |
Used to release all memory prior to shutdown. | |
void | Initialize (const HostId &hostId, AZStd::unique_ptr< IEntityDomain > entityDomain) override |
bool | IsInitialized () const override |
IEntityDomain * | GetEntityDomain () const override |
NetworkEntityTracker * | GetNetworkEntityTracker () override |
NetworkEntityAuthorityTracker * | GetNetworkEntityAuthorityTracker () override |
MultiplayerComponentRegistry * | GetMultiplayerComponentRegistry () override |
const HostId & | GetHostId () const override |
ConstNetworkEntityHandle | GetEntity (NetEntityId netEntityId) const override |
NetEntityId | GetNetEntityIdById (const AZ::EntityId &entityId) const override |
EntityList | CreateEntitiesImmediate (const AzFramework::Spawnable &spawnable, NetEntityRole netEntityRole, const AZ::Transform &transform, AutoActivate autoActivate) |
EntityList | CreateEntitiesImmediate (const PrefabEntityId &prefabEntryId, NetEntityRole netEntityRole, const AZ::Transform &transform, AutoActivate autoActivate=AutoActivate::Activate) override |
EntityList | CreateEntitiesImmediate (const PrefabEntityId &prefabEntryId, NetEntityId netEntityId, NetEntityRole netEntityRole, AutoActivate autoActivate, const AZ::Transform &transform) override |
AZStd::unique_ptr< AzFramework::EntitySpawnTicket > | RequestNetSpawnableInstantiation (const AZ::Data::Asset< AzFramework::Spawnable > &netSpawnable, const AZ::Transform &transform) override |
void | SetupNetEntity (AZ::Entity *netEntity, PrefabEntityId prefabEntityId, NetEntityRole netEntityRole) override |
uint32_t | GetEntityCount () const override |
NetworkEntityHandle | AddEntityToEntityMap (NetEntityId netEntityId, AZ::Entity *entity) override |
void | RemoveEntityFromEntityMap (NetEntityId netEntityId) override |
void | MarkForRemoval (const ConstNetworkEntityHandle &entityHandle) override |
bool | IsMarkedForRemoval (const ConstNetworkEntityHandle &entityHandle) const override |
void | ClearEntityFromRemovalList (const ConstNetworkEntityHandle &entityHandle) override |
void | ClearAllEntities () override |
Clears out and deletes all entities registered with the entity manager. | |
void | AddEntityMarkedDirtyHandler (AZ::Event<>::Handler &entityMarkedDirtyHandle) override |
void | AddEntityNotifyChangesHandler (AZ::Event<>::Handler &entityNotifyChangesHandle) override |
void | AddEntityExitDomainHandler (EntityExitDomainEvent::Handler &entityExitDomainHandler) override |
void | AddControllersActivatedHandler (ControllersActivatedEvent::Handler &controllersActivatedHandler) override |
void | AddControllersDeactivatedHandler (ControllersDeactivatedEvent::Handler &controllersDeactivatedHandler) override |
void | NotifyEntitiesDirtied () override |
Notifies entities that they should process their dirty state. | |
void | NotifyEntitiesChanged () override |
Notifies entities that they should process change notifications. | |
void | NotifyControllersActivated (const ConstNetworkEntityHandle &entityHandle, EntityIsMigrating entityIsMigrating) override |
void | NotifyControllersDeactivated (const ConstNetworkEntityHandle &entityHandle, EntityIsMigrating entityIsMigrating) override |
void | HandleLocalRpcMessage (NetworkEntityRpcMessage &message) override |
void | HandleEntitiesExitDomain (const NetEntityIdSet &entitiesNotInDomain) override |
void | ForceAssumeAuthority (const ConstNetworkEntityHandle &entityHandle) override |
void | MarkAlwaysRelevantToClients (const ConstNetworkEntityHandle &entityHandle, bool alwaysRelevant) override |
void | MarkAlwaysRelevantToServers (const ConstNetworkEntityHandle &entityHandle, bool alwaysRelevant) override |
const NetEntityHandleSet & | GetAlwaysRelevantToClientsSet () const override |
const NetEntityHandleSet & | GetAlwaysRelevantToServersSet () const override |
void | SetMigrateTimeoutTimeMs (AZ::TimeMs timeoutTimeMs) override |
void | DebugDraw () const override |
Visualization of network entity manager state. | |
void | OnRootSpawnableAssigned (AZ::Data::Asset< AzFramework::Spawnable > rootSpawnable, uint32_t generation) override |
void | OnRootSpawnableReleased (uint32_t generation) override |
void | OnResolveAliases (AzFramework::Spawnable::EntityAliasVisitor &aliases, const AzFramework::SpawnableMetaData &metadata, const AzFramework::Spawnable::EntityList &entities) override |
Public Member Functions inherited from Multiplayer::INetworkEntityManager | |
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 IEntityDomain * | GetEntityDomain () const =0 |
virtual NetworkEntityTracker * | GetNetworkEntityTracker ()=0 |
virtual NetworkEntityAuthorityTracker * | GetNetworkEntityAuthorityTracker ()=0 |
virtual MultiplayerComponentRegistry * | GetMultiplayerComponentRegistry ()=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. | |
Static Public Attributes | |
static constexpr AZ::Crc32 | NetworkEntityTag = AZ_CRC_CE("Network") |
Additional Inherited Members | |
Public Types inherited from Multiplayer::INetworkEntityManager | |
using | EntityList = AZStd::vector< NetworkEntityHandle > |
Implementation of the networked entity manager interface. This class creates and manages all networked entities.
|
overridevirtual |
Adds an event handler to be invoked when an entities controllers have activated
controllersActivatedHandler | event handler for the entity |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Adds an event handler to be invoked when an entities controllers have been deactivated
controllersDeactivatedHandler | event handler for the entity |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Adds an event handler to be invoked when we notify entities to send their change notifications.
entityNotifyChangesHandle | event handler for the dirtied entity |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Adds an event handler to be invoked when we notify which entities have been marked dirty.
entityMarkedDirtyHandle | event handler for the dirtied entity |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Adds an event handler to be invoked when we notify entities to send their change notifications.
entityNotifyChangesHandle | event handler for the dirtied entity |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Adds the provided entity to the internal entity map identified by the provided netEntityId.
netEntityId | the identifier to use for the added entity |
entity | the entity to add to the internal entity map |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Clears out and deletes all entities registered with the entity manager.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Unmarks the specified entity so it will no longer be removed and deleted.
entityHandle | the entity to unmark for removal and deletion |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Creates new entities of the given archetype This interface is internally used to spawn replicated entities
prefabEntryId | the name of the spawnable to spawn |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Creates new entities of the given archetype
prefabEntryId | the name of the spawnable to spawn |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Visualization of network entity manager state.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
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.
entityHandle | the entity to forcibly assume authoritative control over |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Retrieves the set of network entities that should always be relevant to client connections.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Retrieves the set of network entities that should always be relevant to server connections.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Returns an ConstEntityPtr for the provided entityId.
netEntityId | the netEntityId to get an ConstEntityPtr for |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Returns the total number of entities tracked by this INetworkEntityManager instance.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Returns the entity domain associated with this network entity manager, this will be nullptr on clients.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Returns the HostId for this INetworkEntityManager instance.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Returns the MultiplayerComponentRegistry for this INetworkEntityManager instance.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Returns the Net Entity ID for a given AZ Entity ID.
entityId | the AZ Entity ID |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Returns the NetworkEntityAuthorityTracker for this INetworkEntityManager instance.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Returns the NetworkEntityTracker for this INetworkEntityManager instance.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Handles a set of entities transitioning between entity domains.
entitiesNotInDomain | the set of entities that are no longer contained within our entity domain |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Handle a local rpc message.
entityRpcMessage | the local rpc message to handle |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
INetworkEntityManager overrides.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Returns whether or not the network entity manager has been initialized.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Returns true if the indicated entity is marked for removal.
entityHandle | the entity to test if marked for removal |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
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.
entityHandle | const network entity handle to the entity to override relevancy for |
alwaysRelevant | a true value will enable always relevant, false will disable |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
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.
entityHandle | const network entity handle to the entity to override relevancy for |
alwaysRelevant | a true value will enable always relevant, false will disable |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Marks the specified entity for removal and deletion.
entityHandle | the entity to remove and delete |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Notifies that an entities controllers have activated.
entityHandle | handle to the entity whose controllers have activated |
entityIsMigrating | true if the entity is activating after a migration |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Notifies that an entities controllers have been deactivated.
entityHandle | handle to the entity whose controllers have been deactivated |
entityIsMigrating | true if the entity is deactivating due to a migration |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Notifies entities that they should process change notifications.
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Notifies entities that they should process their dirty state.
Implements Multiplayer::INetworkEntityManager.
|
override |
SpawnableAssetEventsBus
|
override |
RootSpawnableNotificationBus
|
overridevirtual |
Removes the provided netEntityId from the internal entity map.
netEntityId | the identifier to use for the added entity |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
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
netSpawnable | the network spawnable to spawn |
transform | the transform where the spawnable should be spawned |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Overrides the default timeout time used during entity migrations.
timeoutTimeMs | the timeout time to use in milliseconds |
Implements Multiplayer::INetworkEntityManager.
|
overridevirtual |
Configures new networked entity
netEntity | the entity to setup |
prefabEntryId | the name of the spawnable the entity originated from |
netEntityRole | the net role the entity should be setup for |
Implements Multiplayer::INetworkEntityManager.