enable/disable subsystem depending on server/client when launched from editor

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;
}
}`

Hello Spephane,

Let me clarify a few questions.

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?

  • does it work well in visual studio debug? How do you launch it?
  • does it work with Switchboard Launcher?

command line with parameters -server

Please elaborate more on how the dedicated server and packaging functionality are involved.

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_Standalone EVEN on client instance.

Stephane, what is the use case and scenario here? You can run nDisplay via Quick Launch or Switchboard Launcher. At this moment, the editor’s multiplayer infrastructure is not connected to nDisplay.

Do you want to use both multiplayer and nDisplay at the same time?

Thanks!

vitalii