Download

What is the correct way to connect to hosts and clients?

The current most popular method seems to be the console commands. Where one instance of your application starts with:


"open map?listen"

and the other with (for local host):


"open 127.0.0.1"

The problem is that when you do a ‘shipping’ build the console is ripped out so this is pretty much a beta testing feature.

The alternative is the exceedingly complicated OnlineSubsystem for which finding documentation/tutorials are comparable to finding diamond deposits in your garden soil.
At first I tried to make it work with Steam, but after installing the SDK and confirming that the Steam overlay shows up in my game, I didn’t know where to start with the code.
So before tackling Steam I tried to get the online subsystem to work on my LAN first:



// Clicking H on my keyboard runs this:
FOnlineSessionSettings SessionSettings;
SessionSettings.bIsLANMatch = true;
SessionSettings.bAllowJoinInProgress = true;

IOnlineSubsystem* OSInst = IOnlineSubsystem::Get();
IOnlineSubsystemPtr OSPtr = OSInst->GetSessionInterface();
OSPtr->CreateSession(0, "NewSession", SessionSettings);*




// Clicking J on my keyboard runs this:
IOnlineSubsystem* OSInst = IOnlineSubsystem::Get();
IOnlineSubsystemPtr OSPtr = OSInst->GetSessionInterface();
OSPtr->JoinSession(0, "NewSession", ???);


I don’t really know if I’m on the right track, nor do I know what last parameter I should pass JoinSession.
I tried the obvious FOnlineSessionSearchResult, but didn’t know what arguments the data members wanted.
Could someone please explain how I could achieve this?