In a nDisplay context, we want to enable/disable some subsystems depending on primary/secondary nodes (and kept them alive on the primary node). To do so I’m planning to test the primary information directly in the cluster with:
`bool IsPrimaryNode()
{
if (IDisplayCluster::IsAvailable())
{
const IDisplayClusterClusterManager* ClusterMgr = IDisplayCluster::Get().GetClusterMgr();
if (ClusterMgr)
{
return ClusterMgr->IsPrimary();
}
}
// If nDisplay is not available, assume primary (common in PIE or standalone)
return true;
}`1/ To adapt our code for nDisplay purpose, coudl you confirm the right direction of testing? When lauching a local cluster with nDisplay Launch plugin, the ClusterMgr seems empty. Any idea why?
2/ In order to ease debugging and initial setup without running all the nDisplay, I’m also planning to do the same kind of selective initialization with server/game information in order to launch from the editor. It the there a correct way to get a working code that detect correctly server/client either with :
- command line with parameters -server or -client (with UnrealEditor-*-Cmd.exe and package)
- with launch from editor with “Play as listen server” an a number of clients >= 2. Note that I’ve tried to launch several processes for each server/client unckecking settings “Run under one process” but that doesn’t change anything.
My first attempt is with the code below ut it always has the NetNode() to NM_StandaloneEVEN on client instance.
`UGameInstance* vGameInstance = Cast(aOuter);
if (vGameInstance) {
UWorld* vWorld = vGameInstance->GetWorld();
if (vWorld) {
return vWorld->GetNetMode() == NM_DedicatedServer || vWorld->GetNetMode() == NM_ListenServer || vWorld->GetNetMode() == NM_Standalone;
}
}`