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.
|
Component that provides net-binding to a networked entity. More...
#include <NetBindComponent.h>
Inherits AZ::Component.
Public Member Functions | |
AZ_COMPONENT (NetBindComponent, "{DAA076B3-1A1C-4FEF-8583-1DF696971604}") | |
NetEntityRole | GetNetEntityRole () const |
bool | IsNetEntityRoleAuthority () const |
bool | IsNetEntityRoleAutonomous () const |
bool | IsNetEntityRoleServer () const |
bool | IsNetEntityRoleClient () const |
void | SetAllowEntityMigration (EntityMigration value) |
EntityMigration | GetAllowEntityMigration () const |
bool | ValidatePropertyRead (const char *propertyName, NetEntityRole replicateFrom, NetEntityRole replicateTo) const |
bool | ValidatePropertyWrite (const char *propertyName, NetEntityRole replicateFrom, NetEntityRole replicateTo, bool isPredictable) const |
bool | HasController () const |
NetEntityId | GetNetEntityId () const |
const PrefabEntityId & | GetPrefabEntityId () const |
void | SetPrefabEntityId (const PrefabEntityId &prefabEntityId) |
const AZ::Data::AssetId & | GetPrefabAssetId () const |
void | SetPrefabAssetId (const AZ::Data::AssetId &val) |
ConstNetworkEntityHandle | GetEntityHandle () const |
NetworkEntityHandle | GetEntityHandle () |
void | SetOwningConnectionId (AzNetworking::ConnectionId connectionId) |
AzNetworking::ConnectionId | GetOwningConnectionId () const |
void | EnablePlayerHostAutonomy (bool enabled) |
MultiplayerComponentInputVector | AllocateComponentInputs () |
bool | IsProcessingInput () const |
bool | IsReprocessingInput () const |
void | CreateInput (NetworkInput &networkInput, float deltaTime) |
void | ProcessInput (NetworkInput &networkInput, float deltaTime) |
void | ReprocessInput (NetworkInput &networkInput, float deltaTime) |
bool | HandleRpcMessage (AzNetworking::IConnection *invokingConnection, NetEntityRole remoteRole, NetworkEntityRpcMessage &message) |
bool | HandlePropertyChangeMessage (AzNetworking::ISerializer &serializer, bool notifyChanges=true) |
RpcSendEvent & | GetSendAuthorityToClientRpcEvent () |
RpcSendEvent & | GetSendAuthorityToAutonomousRpcEvent () |
RpcSendEvent & | GetSendServerToAuthorityRpcEvent () |
RpcSendEvent & | GetSendAutonomousToAuthorityRpcEvent () |
const ReplicationRecord & | GetPredictableRecord () const |
void | MarkDirty () |
void | NotifyLocalChanges () |
void | NotifySyncRewindState () |
void | NotifyServerMigration (const HostId &remoteHostId) |
void | NotifyPreRender (float deltaTime) |
void | NotifyCorrection () |
void | NetworkActivated () |
void | AddEntityStopEventHandler (EntityStopEvent::Handler &eventHandler) |
void | AddEntityDirtiedEventHandler (EntityDirtiedEvent::Handler &eventHandler) |
void | AddEntitySyncRewindEventHandler (EntitySyncRewindEvent::Handler &eventHandler) |
void | AddEntityServerMigrationEventHandler (EntityServerMigrationEvent::Handler &eventHandler) |
void | AddEntityPreRenderEventHandler (EntityPreRenderEvent::Handler &eventHandler) |
void | AddEntityCorrectionEventHandler (EntityCorrectionEvent::Handler &handler) |
void | AddNetworkActivatedEventHandler (AZ::Event<>::Handler &handler) |
bool | SerializeEntityCorrection (AzNetworking::ISerializer &serializer) |
bool | SerializeStateDeltaMessage (ReplicationRecord &replicationRecord, AzNetworking::ISerializer &serializer) |
void | NotifyStateDeltaChanges (ReplicationRecord &replicationRecord) |
void | FillReplicationRecord (ReplicationRecord &replicationRecord) const |
void | FillTotalReplicationRecord (ReplicationRecord &replicationRecord) const |
void | Init () override |
void | Activate () override |
void | Deactivate () override |
Component that provides net-binding to a networked entity.
MultiplayerComponentInputVector Multiplayer::NetBindComponent::AllocateComponentInputs | ( | ) |
This allocates and returns an appropriate MultiplayerComponentInputVector for the components bound to this entity.
void Multiplayer::NetBindComponent::EnablePlayerHostAutonomy | ( | bool | enabled | ) |
Allows a player host to autonomously control their player entity, even though the entity is in an authority role. Note: If this entity is already activated this will reactivate all of the multiplayer component controllers in order for them to reactivate under autonomous control.
EntityMigration Multiplayer::NetBindComponent::GetAllowEntityMigration | ( | ) | const |
Retrieves whether or not the netbound entity is allowed to migrate between hosts.
NetworkEntityHandle Multiplayer::NetBindComponent::GetEntityHandle | ( | ) |
Returns a non-const network entity handle for this entity, this allows controller access so use it with great caution. Warning, this function is dangerous to use in game code as it makes it easy to write logic that will function incorrectly within multihost environments. Use carefully.
ConstNetworkEntityHandle Multiplayer::NetBindComponent::GetEntityHandle | ( | ) | const |
Returns a const network entity handle to this entity.
NetEntityId Multiplayer::NetBindComponent::GetNetEntityId | ( | ) | const |
Returns the bound NetworkEntityId that represents this entity.
AzNetworking::ConnectionId Multiplayer::NetBindComponent::GetOwningConnectionId | ( | ) | const |
Returns the AzNetworking::ConnectionId of the connection that owns this entity form a local prediction standpoint.
const AZ::Data::AssetId& Multiplayer::NetBindComponent::GetPrefabAssetId | ( | ) | const |
Returns the PrefabAssetId of the prefab this entity was loaded from.
const PrefabEntityId& Multiplayer::NetBindComponent::GetPrefabEntityId | ( | ) | const |
Returns the PrefabEntityId that this entity was loaded from.
bool Multiplayer::NetBindComponent::HasController | ( | ) | const |
Returns whether or not a controller exists for the bound network entity. Warning, this function is dangerous to use in game code as it makes it easy to write logic that will function incorrectly within multihost environments. Use carefully. The recommended solution for communicating from proxy level to a controller is to use a Server to Authority RPC, as the network layer can route the RPC appropriately.
|
override |
AZ::Component overrides.
bool Multiplayer::NetBindComponent::IsNetEntityRoleAuthority | ( | ) | const |
IsNetEntityRoleAuthority
bool Multiplayer::NetBindComponent::IsNetEntityRoleAutonomous | ( | ) | const |
IsNetEntityRoleAutonomous
bool Multiplayer::NetBindComponent::IsNetEntityRoleClient | ( | ) | const |
IsNetEntityRoleClient
bool Multiplayer::NetBindComponent::IsNetEntityRoleServer | ( | ) | const |
IsNetEntityRoleServer
bool Multiplayer::NetBindComponent::IsProcessingInput | ( | ) | const |
Return true if we're currently processing inputs.
bool Multiplayer::NetBindComponent::IsReprocessingInput | ( | ) | const |
Return true if we're currently replaying inputs after a correction. If this value returns true, effects, audio, and other cosmetic triggers should be suppressed
void Multiplayer::NetBindComponent::SetAllowEntityMigration | ( | EntityMigration | value | ) |
Sets whether or not a netbound entity is allowed to migrate between hosts. Use this feature carefully, as replication is spatially based. If migration is disabled chances are you want to mark the entity as always persistent as well. See INetworkEntityManager::MarkAlwaysRelevantToClients and INetworkEntityManager::MarkAlwaysRelevantToServers
value | whether to enable or disable host migrations for this entity |
void Multiplayer::NetBindComponent::SetOwningConnectionId | ( | AzNetworking::ConnectionId | connectionId | ) |
Sets the AzNetworking::ConnectionId that 'owns' this entity from a local prediction standpoint. This is important for correct rewind operation during backward reconciliation, as we shouldn't rewind anything owned by the autonomous entity itself.
connectionId | the AzNetworking::ConnectionId to mark as the owner of this entity |
void Multiplayer::NetBindComponent::SetPrefabAssetId | ( | const AZ::Data::AssetId & | val | ) |
Sets the PrefabAssetId of the prefab that this entity was loaded from.
val | the PrefabAssetId to mark as bound to this entity |
void Multiplayer::NetBindComponent::SetPrefabEntityId | ( | const PrefabEntityId & | prefabEntityId | ) |
Sets the PrefabEntityId that this entity was loaded from.
prefabEntityId | the PrefabEntityId to mark as bound to this entity |
bool Multiplayer::NetBindComponent::ValidatePropertyRead | ( | const char * | propertyName, |
NetEntityRole | replicateFrom, | ||
NetEntityRole | replicateTo | ||
) | const |
This is a helper that validates the owning entity is in the correct role to read from a network property that matches the relicateFrom and replicateTo parameters.
propertyName | the name of the property, for logging and debugging purposes |
replicateFrom | the network entity role that the property replicates from |
replicateTo | the network entity role that the property replicates to |
bool Multiplayer::NetBindComponent::ValidatePropertyWrite | ( | const char * | propertyName, |
NetEntityRole | replicateFrom, | ||
NetEntityRole | replicateTo, | ||
bool | isPredictable | ||
) | const |
This is a helper that validates the owning entity is in the correct role to write to a network property that matches the relicateFrom, replicateTo parameters, and isPredictable parameters.
propertyName | the name of the property, for logging and debugging purposes |
replicateFrom | the network entity role that the property replicates from |
replicateTo | the network entity role that the property replicates to |
isPredictable | true if the property is predictable, false otherwise |