squad comms

squad comms, ltms now work less (this will return better in a later update), performance, fixed some versions, fixed vulnerabilities
This commit is contained in:
Milxnor
2023-06-15 22:04:53 -04:00
parent ed0c9005e6
commit 4482192a2b
46 changed files with 444 additions and 427 deletions

View File

@@ -319,7 +319,7 @@ static UActorChannel* FindChannel(AActor * Actor, UNetConnection * Connection)
// LOG_INFO(LogReplication, "OpenChannels.Num(): {}", OpenChannels.Num());
for (int i = 0; i < OpenChannels.Num(); i++)
for (int i = 0; i < OpenChannels.Num(); ++i)
{
auto Channel = OpenChannels.at(i);
@@ -342,7 +342,9 @@ static UActorChannel* FindChannel(AActor * Actor, UNetConnection * Connection)
return (UActorChannel*)Channel;
}
return NULL;
// LOG_INFO(LogDev, "Failed to find channel for {}!", Actor->GetName());
return nullptr;
}
static bool IsActorRelevantToConnection(AActor * Actor, std::vector<FNetViewer>&ConnectionViewers)
@@ -461,8 +463,6 @@ int32 UNetDriver::ServerReplicateActors()
if (ShouldUseNetworkObjectList())
ConsiderList.reserve(GetNetworkObjectList().ActiveNetworkObjects.Num());
// std::cout << "ConsiderList.size(): " << GetNetworkObjectList(NetDriver).ActiveNetworkObjects.Num() << '\n';
auto World = GetWorld();
ServerReplicateActors_BuildConsiderList(ConsiderList, ServerTickTime);
@@ -621,15 +621,18 @@ int32 UNetDriver::ServerReplicateActors()
{
if (ReplicateActor(Channel))
{
// LOG_INFO(LogReplication, "Replicated Actor!");
auto TimeSeconds = UGameplayStatics::GetTimeSeconds(World);
const float MinOptimalDelta = 1.0f / Actor->GetNetUpdateFrequency();
const float MaxOptimalDelta = max(1.0f / Actor->GetMinNetUpdateFrequency(), MinOptimalDelta);
const float DeltaBetweenReplications = (TimeSeconds - ActorInfo->LastNetReplicateTime);
if (ShouldUseNetworkObjectList())
{
// LOG_INFO(LogReplication, "Replicated Actor!");
auto TimeSeconds = UGameplayStatics::GetTimeSeconds(World);
const float MinOptimalDelta = 1.0f / Actor->GetNetUpdateFrequency();
const float MaxOptimalDelta = max(1.0f / Actor->GetMinNetUpdateFrequency(), MinOptimalDelta);
const float DeltaBetweenReplications = (TimeSeconds - ActorInfo->LastNetReplicateTime);
// Choose an optimal time, we choose 70% of the actual rate to allow frequency to go up if needed
ActorInfo->OptimalNetUpdateDelta = std::clamp(DeltaBetweenReplications * 0.7f, MinOptimalDelta, MaxOptimalDelta); // should we use fmath?
ActorInfo->LastNetReplicateTime = TimeSeconds;
// Choose an optimal time, we choose 70% of the actual rate to allow frequency to go up if needed
ActorInfo->OptimalNetUpdateDelta = std::clamp(DeltaBetweenReplications * 0.7f, MinOptimalDelta, MaxOptimalDelta); // should we use fmath?
ActorInfo->LastNetReplicateTime = TimeSeconds;
}
}
}
}