Entity migrations now totally functional again, plus some fixes to network rigid bodies to make them work properly as they migrate around
Signed-off-by: kberg-amzn <karlberg@amazon.com>
This commit is contained in:
@@ -61,10 +61,11 @@ namespace Multiplayer
|
||||
{
|
||||
public:
|
||||
NetworkRigidBodyComponentController(NetworkRigidBodyComponent& parent);
|
||||
|
||||
void OnActivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
|
||||
void OnDeactivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
|
||||
|
||||
void HandleSendApplyImpulse(AzNetworking::IConnection* invokingConnection, const AZ::Vector3& impulse, const AZ::Vector3& worldPoint) override;
|
||||
private:
|
||||
void OnTransformUpdate();
|
||||
AZ::TransformChangedEvent::Handler m_transformChangedHandler;
|
||||
};
|
||||
} // namespace Multiplayer
|
||||
|
||||
@@ -39,8 +39,7 @@ namespace Multiplayer
|
||||
virtual void ActivateTracking(const INetworkEntityManager::OwnedEntitySet& ownedEntitySet) = 0;
|
||||
|
||||
//! Return the set of netbound entities not included in this domain.
|
||||
//! @param outEntitiesNotInDomain the set of known networked entities not included in this domain
|
||||
virtual void RetrieveEntitiesNotInDomain(EntitiesNotInDomain& outEntitiesNotInDomain) const = 0;
|
||||
virtual const EntitiesNotInDomain& RetrieveEntitiesNotInDomain() const = 0;
|
||||
|
||||
//! Debug draw to visualize host entity domains.
|
||||
virtual void DebugDraw() const = 0;
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Multiplayer
|
||||
using ClientMigrationEndEvent = AZ::Event<>;
|
||||
using ClientDisconnectedEvent = AZ::Event<>;
|
||||
using NotifyClientMigrationEvent = AZ::Event<const HostId&, uint64_t, ClientInputId>;
|
||||
using NotifyEntityMigrationEvent = AZ::Event<const ConstNetworkEntityHandle&, const HostId&>;
|
||||
using ConnectionAcquiredEvent = AZ::Event<MultiplayerAgentDatum>;
|
||||
using SessionInitEvent = AZ::Event<AzNetworking::INetworkInterface*>;
|
||||
using SessionShutdownEvent = AZ::Event<AzNetworking::INetworkInterface*>;
|
||||
@@ -113,6 +114,10 @@ namespace Multiplayer
|
||||
//! @param handler The NotifyClientMigrationEvent Handler to add
|
||||
virtual void AddNotifyClientMigrationHandler(NotifyClientMigrationEvent::Handler& handler) = 0;
|
||||
|
||||
//! Adds a NotifyEntityMigrationEvent Handler which is invoked when an entity migrates from one host to another.
|
||||
//! @param handler The NotifyEntityMigrationEvent Handler to add
|
||||
virtual void AddNotifyEntityMigrationEventHandler(NotifyEntityMigrationEvent::Handler& handler) = 0;
|
||||
|
||||
//! Adds a ConnectionAcquiredEvent Handler which is invoked when a new endpoint connects to the session.
|
||||
//! @param handler The ConnectionAcquiredEvent Handler to add
|
||||
virtual void AddConnectionAcquiredHandler(ConnectionAcquiredEvent::Handler& handler) = 0;
|
||||
@@ -131,6 +136,11 @@ namespace Multiplayer
|
||||
//! @param lastClientInputId the last processed clientInputId by the current host
|
||||
virtual void SendNotifyClientMigrationEvent(const HostId& hostId, uint64_t userIdentifier, ClientInputId lastClientInputId) = 0;
|
||||
|
||||
//! Signals a NotifyEntityMigrationEvent with the provided parameters.
|
||||
//! @param entityHandle the network entity handle of the entity being migrated
|
||||
//! @param remoteHostId the host id of the host the entity is migrating to
|
||||
virtual void SendNotifyEntityMigrationEvent(const ConstNetworkEntityHandle& entityHandle, const HostId& remoteHostId) = 0;
|
||||
|
||||
//! Sends a packet telling if entity update messages can be sent.
|
||||
//! @param readyForEntityUpdates Ready for entity updates or not
|
||||
virtual void SendReadyForEntityUpdates(bool readyForEntityUpdates) = 0;
|
||||
|
||||
+5
-3
@@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Multiplayer/IMultiplayer.h>
|
||||
#include <Multiplayer/NetworkEntity/EntityReplication/EntityReplicator.h>
|
||||
#include <Multiplayer/Components/NetBindComponent.h>
|
||||
#include <Multiplayer/EntityDomains/IEntityDomain.h>
|
||||
@@ -71,8 +72,8 @@ namespace Multiplayer
|
||||
|
||||
bool HasRemoteAuthority(const ConstNetworkEntityHandle& entityHandle) const;
|
||||
|
||||
void SetEntityDomain(AZStd::unique_ptr<IEntityDomain> entityDomain);
|
||||
IEntityDomain* GetEntityDomain();
|
||||
void SetRemoteEntityDomain(AZStd::unique_ptr<IEntityDomain> entityDomain);
|
||||
IEntityDomain* GetRemoteEntityDomain();
|
||||
void SetReplicationWindow(AZStd::unique_ptr<IReplicationWindow> replicationWindow);
|
||||
IReplicationWindow* GetReplicationWindow();
|
||||
|
||||
@@ -125,7 +126,7 @@ namespace Multiplayer
|
||||
|
||||
void MigrateEntityInternal(NetEntityId entityId);
|
||||
void OnEntityExitDomain(const ConstNetworkEntityHandle& entityHandle);
|
||||
void OnPostEntityMigration(const ConstNetworkEntityHandle& entityHandle, const HostId& remoteHostId, AzNetworking::ConnectionId connectionId);
|
||||
void OnPostEntityMigration(const ConstNetworkEntityHandle& entityHandle, const HostId& remoteHostId);
|
||||
|
||||
EntityReplicator* AddEntityReplicator(const ConstNetworkEntityHandle& entityHandle, NetEntityRole netEntityRole);
|
||||
|
||||
@@ -193,6 +194,7 @@ namespace Multiplayer
|
||||
AZ::Event<NetEntityId> m_autonomousEntityReplicatorCreated;
|
||||
EntityExitDomainEvent::Handler m_entityExitDomainEventHandler;
|
||||
SendMigrateEntityEvent m_sendMigrateEntityEvent;
|
||||
NotifyEntityMigrationEvent::Handler m_notifyEntityMigrationHandler;
|
||||
|
||||
AZ::ScheduledEvent m_clearRemovedReplicators;
|
||||
AZ::ScheduledEvent m_updateWindow;
|
||||
|
||||
@@ -180,5 +180,8 @@ namespace Multiplayer
|
||||
//! Handle a local rpc message.
|
||||
//! @param entityRpcMessage the local rpc message to handle
|
||||
virtual void HandleLocalRpcMessage(NetworkEntityRpcMessage& message) = 0;
|
||||
|
||||
//! Visualization of network entity manager state.
|
||||
virtual void DebugDraw() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -30,18 +30,8 @@ namespace Multiplayer
|
||||
//! Constructs a ConstNetworkEntityHandle given an entity, an entity tracker
|
||||
//! @param entity pointer to the entity to construct a ConstNetworkEntityHandle for
|
||||
//! @param entityTracker pointer to the entity tracker that tracks the entity
|
||||
ConstNetworkEntityHandle(AZ::Entity* entity, const NetworkEntityTracker* entityTracker);
|
||||
|
||||
//! Constructs a ConstNetworkEntityHandle given an entity, a networkEntityId, and an entity tracker
|
||||
//! @param entity pointer to the entity to construct a ConstNetworkEntityHandle for
|
||||
//! @param netEntityId the networkEntityId of the entity
|
||||
//! @param entityTracker pointer to the entity tracker that tracks the entity
|
||||
ConstNetworkEntityHandle(AZ::Entity* entity, NetEntityId netEntityId, const NetworkEntityTracker* entityTracker);
|
||||
|
||||
//! Constructs a ConstNetworkEntityHandle given an entity, a networked entityId, an entity tracker, and a dirty version
|
||||
//! @param netBindComponent pointer to the entities NetBindComponent
|
||||
//! @param entityTracker pointer to the entity tracker that tracks the entity
|
||||
ConstNetworkEntityHandle(NetBindComponent* netBindComponent, const NetworkEntityTracker* entityTracker);
|
||||
//! can optionally be null in which case the entity tracker will be looked up
|
||||
ConstNetworkEntityHandle(AZ::Entity* entity, const NetworkEntityTracker* entityTracker = nullptr);
|
||||
|
||||
ConstNetworkEntityHandle(const ConstNetworkEntityHandle&) = default;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user