My game is on Steam now with a page and a demo!

Before you call CreateOnlineGame(), set your callback for OnlineGameComplete:

gameInterface.AddCreateOnlineGameCompleteDelegate(OnGameCreated);

gameInterface.CreateOnlineGame(class'UIInteraction'.static.GetPlayerControllerId(0), 'Game', CurrentGameSettings);

...
function OnGameCreated(name SessionName, bool bWasSuccessful) 
{
}

When the online session has been created you will see a unique Steam id in your console. This is the id you will use for your client to connect to the session (essentially will route the client to the server without needing to connect using their specific ip or needing to have ports open etc).

Then in your OnGameCreated() for your host you can actually launch your listen server:

function OnGameCreated(name SessionName, bool bWasSuccessful) 
{
    ConsoleCommand("start YourMapName?listen?steamsockets");
}

Then try connecting to your hosts session steam id (the one generated from calling CreateOnlineGame()) on the client side (from the in-game console):

start steam.123456789

Once you have that working you are now hosting and connecting using Steam sockets rather than using specific ips and worrying about opening ports etc.

After that you can tackle the game advertising. One easy way to do this, which i do with my game Subsistence is to just use ReadFriendsList() in OnlineSubsystemSteamworks.

When it calls back (use AddReadFriendsCompleteDelegate), you can use GetFriendsList() to pull a list of their online Steam friends then call GetFriendJoinURL() to get the unique steam id for the session they are hosting (or playing on).

So basically when the joining client is sitting in your in-game join MP game UI, just poll their friends list and check for friends hosting a session for your game.

2 Likes