FastGeo doesn't appear to fully strip components that aren't needed on a target platform

Hey,

It appears that on a server cooked build, the fast-geo containers keep around components which aren’t necessarily server relevant (e.g have visibility, but no collision), although only as a reference (from what we’ve seen).

Due to our setup, where we have to disable server streaming, this contributes to a death by a thousand cuts.

I’m not sure if this has been dealt with in more recent updates, but locally I’ve mainly done something like this (not totally sure if this is really the best way to do this):

template<typename FuncType>
static void ForEachCurrentCookingPlatform(FuncType&& Func)
{
  if (GUnrealEd && GUnrealEd->CookServer && GUnrealEd->CookServer->IsInSession())
  {
    const TArray<const ITargetPlatform*> Platforms = GUnrealEd->CookServer->GetSessionPlatforms();
    for (const ITargetPlatform* Platform : Platforms)
    {
      if (!Func(Platform))
      {
        break;
      }
    }
  }
  else if (IsRunningCookCommandlet())
  {
    ITargetPlatformManagerModule& TPM = GetTargetPlatformManagerRef();
    const TArray<ITargetPlatform*>& Platforms = TPM.GetActiveTargetPlatforms();
    for (const ITargetPlatform* Platform : Platforms)
    {
      if (!Func(Platform))
      {
        break;
      }
    }
  }
}
 
 
...
 
 
void UFastGeoWorldPartitionRuntimeCellTransformer::Transform(ULevel* InLevel)
{
 
...
  bool bServerOnly = false;
 
  ForEachCurrentCookingPlatform([&bServerOnly](const ITargetPlatform* Platform)
    {
      bServerOnly = Platform->IsServerOnly();
      return bServerOnly;
    });
   
  if (IsDebugMode())
  {
    UE_LOG(LogFastGeoStreaming, Log, TEXT("- Server Only: %s"), bServerOnly ? TEXT("true") : TEXT("false"));
  }
 
...
 
for (UActorComponent* Component : Components)
{
  bool bShouldKillComponent= bServerOnly && !Component->NeedsLoadForServer();
  if (!bShouldKillComponent)
  {
    FFastGeoElementType FastGeoComponentType = FastGeo::GetFastGeoComponentType(Component->GetClass());
    check(FastGeoComponentType.IsValid());
 
    FFastGeoComponent& FastGeoComponent = CurrentComponentCluster->AddComponent(FastGeoComponentType);
    FastGeoComponent.InitializeFromComponent(Component);
  }
  // Remove the component from the actor
  Actor->RemoveOwnedComponent(Component);
  Component->MarkAsGarbage();
}
 
...
 
if (FastGeoHLOD.IsValid() && FastGeoHLOD->HasComponents())

Many thanks,

Alister

Hi,

Do you mind sharing the repro steps for this issue?

Thanks,

Ryan

I confirmed with the dev familiar with this code that it’s an issue and created a JIRA for it. I don’t have an ETA as priorities for bugs and features can shift at any time.

-Ryan