Fixes to sending entity updates and entity rpcs within an environment set up for cross host entity migration
Signed-off-by: kberg-amzn <karlberg@amazon.com>
This commit is contained in:
+25
-1
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <Source/ReplicationWindows/ServerToClientReplicationWindow.h>
|
||||
#include <Source/AutoGen/Multiplayer.AutoPackets.h>
|
||||
#include <Multiplayer/Components/NetBindComponent.h>
|
||||
#include <AzFramework/Visibility/IVisibilitySystem.h>
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
@@ -50,7 +51,7 @@ namespace Multiplayer
|
||||
return m_priority < rhs.m_priority;
|
||||
}
|
||||
|
||||
ServerToClientReplicationWindow::ServerToClientReplicationWindow(NetworkEntityHandle controlledEntity, const AzNetworking::IConnection* connection)
|
||||
ServerToClientReplicationWindow::ServerToClientReplicationWindow(NetworkEntityHandle controlledEntity, AzNetworking::IConnection* connection)
|
||||
: m_controlledEntity(controlledEntity)
|
||||
, m_entityActivatedEventHandler([this](AZ::Entity* entity) { OnEntityActivated(entity); })
|
||||
, m_entityDeactivatedEventHandler([this](AZ::Entity* entity) { OnEntityDeactivated(entity); })
|
||||
@@ -179,6 +180,29 @@ namespace Multiplayer
|
||||
//}
|
||||
}
|
||||
|
||||
AzNetworking::PacketId ServerToClientReplicationWindow::SendEntityUpdateMessages(NetworkEntityUpdateVector& entityUpdateVector)
|
||||
{
|
||||
MultiplayerPackets::EntityUpdates entityUpdatePacket;
|
||||
entityUpdatePacket.SetHostTimeMs(GetNetworkTime()->GetHostTimeMs());
|
||||
entityUpdatePacket.SetHostFrameId(GetNetworkTime()->GetHostFrameId());
|
||||
entityUpdatePacket.SetEntityMessages(entityUpdateVector);
|
||||
return m_connection->SendUnreliablePacket(entityUpdatePacket);
|
||||
}
|
||||
|
||||
void ServerToClientReplicationWindow::SendEntityRpcs(NetworkEntityRpcVector& entityRpcVector, bool reliable)
|
||||
{
|
||||
MultiplayerPackets::EntityRpcs entityRpcsPacket;
|
||||
entityRpcsPacket.SetEntityRpcs(entityRpcVector);
|
||||
if (reliable)
|
||||
{
|
||||
m_connection->SendReliablePacket(entityRpcsPacket);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_connection->SendUnreliablePacket(entityRpcsPacket);
|
||||
}
|
||||
}
|
||||
|
||||
void ServerToClientReplicationWindow::DebugDraw() const
|
||||
{
|
||||
//static const float BoundaryStripeHeight = 1.0f;
|
||||
|
||||
Reference in New Issue
Block a user