Changes to get client migration partially functional

Signed-off-by: kberg-amzn <karlberg@amazon.com>
This commit is contained in:
kberg-amzn
2021-10-06 18:57:45 -07:00
parent eb2470fe38
commit 18340f2b1b
15 changed files with 273 additions and 168 deletions
@@ -91,17 +91,10 @@ namespace Multiplayer
return m_isPoorConnection ? sv_MinEntitiesToReplicate : sv_MaxEntitiesToReplicate;
}
bool ServerToClientReplicationWindow::IsInWindow(const ConstNetworkEntityHandle& entityHandle, NetEntityRole& outNetworkRole) const
bool ServerToClientReplicationWindow::IsInWindow([[maybe_unused]] const ConstNetworkEntityHandle& entityHandle, NetEntityRole& outNetworkRole) const
{
// TODO: Clean up this interface, this function is used for server->server migrations, and probably shouldn't be exposed in it's current setup
AZ_Assert(false, "IsInWindow should not be called on the ServerToClientReplicationWindow");
outNetworkRole = NetEntityRole::InvalidRole;
auto iter = m_replicationSet.find(entityHandle);
if (iter != m_replicationSet.end())
{
outNetworkRole = iter->second.m_netEntityRole;
return true;
}
return false;
}
@@ -145,7 +138,7 @@ namespace Multiplayer
NetworkEntityTracker* networkEntityTracker = GetNetworkEntityTracker();
IFilterEntityManager* filterEntityManager = GetMultiplayer()->GetFilterEntityManager();
// Add all the neighbors
// Add all the neighbours
for (AzFramework::VisibilityEntry* visEntry : gatheredEntries)
{
AZ::Entity* entity = static_cast<AZ::Entity*>(visEntry->m_userData);
@@ -300,7 +293,6 @@ namespace Multiplayer
void ServerToClientReplicationWindow::AddEntityToReplicationSet(ConstNetworkEntityHandle& entityHandle, float priority, [[maybe_unused]] float distanceSquared)
{
// Assumption: the entity has been checked for filtering prior to this call.
if (!sv_ReplicateServerProxies)
{
NetBindComponent* netBindComponent = entityHandle.GetNetBindComponent();
@@ -311,11 +303,11 @@ namespace Multiplayer
}
}
const bool isQueueFull = (m_candidateQueue.size() >= sv_MaxEntitiesToTrackReplication); // See if have the maximum number of entities in our set
const bool isQueueFull = (m_candidateQueue.size() >= sv_MaxEntitiesToTrackReplication); // See if have the maximum number of entities in our set
const bool isInReplicationSet = m_replicationSet.find(entityHandle) != m_replicationSet.end();
if (!isInReplicationSet)
{
if (isQueueFull) // if our set is full, then we need to remove the worst priority in our set
if (isQueueFull) // If our set is full, then we need to remove the worst priority in our set
{
ConstNetworkEntityHandle removeEnt = m_candidateQueue.top().m_entityHandle;
m_candidateQueue.pop();