I’m currently implementing a server browser for my game (following this guide: Implementing ServerBrowser Functionality with Steam - Epic Games Forums). However I’m never able to find the advertised game.
Here’s my basic setup:
In my class extending UDKGame:
class ColdGame extends UDKGame
simulated function PostBeginPlay()
{
super.PostBeginPlay();
InitOnlineSubSystem();
}
function InitOnlineSubSystem() {
OnlineSub = class'GameEngine'.static.GetOnlineSubsystem();
if (OnlineSub == None) {
return;
}
GameInterface = OnlineSub.GameInterface;
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
// Creates the OnlineGame with the Settings we want
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function CreateOnlineGame() {
// Create the desired GameSettings
currentGameSettings = new class'ColdOnlineGameSettings';
currentGameSettings.bShouldAdvertise = true;
currentGameSettings.NumPublicConnections = 32;
currentGameSettings.NumPrivateConnections = 32;
currentGameSettings.NumOpenPrivateConnections = 32;
currentGameSettings.NumOpenPublicConnections = 32;
currentGameSettings.bIsLanMatch = false;
currentGameSettings.setServerName("MyTestServeronSteam");
// Create the online game
// First, set the delegate thats called when the game was created (cause this is async)
GameInterface.AddCreateOnlineGameCompleteDelegate(OnGameCreated);
// Try to create the game. If it fails, clear the delegate
// Note: the playerControllerId == 0 is the default and noone seems to know what it actually does...
if (GameInterface.CreateOnlineGame(class'UIInteraction'.static.GetPlayerControllerId(0), 'Game', currentGameSettings) == FALSE ) {
GameInterface.ClearCreateOnlineGameCompleteDelegate(OnGameCreated);
`Log("CreateOnlineGame - Failed to create online game.");
}
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
// Delegate that gets called when the OnlineGame has been created.
// Actually sends the player to the game
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function OnGameCreated(name SessionName, bool bWasSuccessful) {
local string TravelURL;
local Engine Eng;
local PlayerController PC;
`log("Game created!!!"@SessionName@bWasSuccessful);
// Clear the delegate we set.
GameInterface.ClearCreateOnlineGameCompleteDelegate(OnGameCreated);
if (bWasSuccessful) {
Eng = class'Engine'.static.GetEngine();
PC = Eng.GamePlayers[0].Actor;
// Creation was successful, so send the player on the host to the level
// Build the URL
currentGameSettings.BuildURL(TravelURL);
TravelURL = "open "
$ "ColdMap1"
$ "?game=ColdGame"
$ TravelURL $ "?listen?steamsockets";
// Do the server travel.
PC.ConsoleCommand(TravelURL);
} else {
`Log("OnGameCreated: Creation of OnlineGame failed!");
}
}
My online game settings class:
class ColdOnlineGameSettings extends UDKGameSettingsCommon;
`include(ColdOnlineConstants.uci)
/** The UID of the steam game server, for use with steam sockets */
var databinding string SteamServerId;
/**
* Builds a URL string out of the properties/contexts and databindings of this object.
*/
function BuildURL(out string OutURL) {
local int SettingIdx;
local name PropertyName;
OutURL = "";
// Append properties marked with the databinding keyword to the URL
AppendDataBindingsToURL(OutURL);
// add all properties
for (SettingIdx = 0; SettingIdx < Properties.length; SettingIdx++) {
PropertyName = GetPropertyName(Properties[SettingIdx].PropertyId);
if (PropertyName != '') {
switch(Properties[SettingIdx].PropertyId) {
default:
OutURL $= "?" $ PropertyName $ "=" $ GetPropertyAsString(Properties[SettingIdx].PropertyId);
break;
}
}
}
}
function setServerName(string serverName) {
SetStringProperty(PROPERTY_MYSERVERNAME, serverName);
}
function string getServerName() {
return GetPropertyAsString(PROPERTY_MYSERVERNAME);
}
DefaultProperties
{
// Properties and their mappings
Properties(0)=(PropertyId=PROPERTY_MYSERVERNAME,Data=(Type=SDT_String),AdvertisementType=ODAT_QoS)
PropertyMappings(0)=(Id=PROPERTY_MYSERVERNAME,Name="ColdServerName")
}
So when I launch launch the game I call CreateOnlineGame() while on my menu map. The main map starts fine and I see the following in my log file:
[0009.42] DevOnline: Steam server wants VAC: 0
[0009.42] DevOnline: WARNING!!! VAC mode set through bUseVac in .ini; can't be modified ingame. VAC status: 1
[0009.42] Log: Initializing Steam game server
[0009.42] DevOnline: Refreshing published game settings...
[0009.42] DevOnline: Server data: Ver: 9188, Ded: 0, Region: 255, Slots: 64, Pass: 0, Server: UDK Server, Map: coldmenumap, Players: 0 Bots: 0, Game: ColdGame
[0009.42] DevOnline: Advertising: SteamEngineVersion=12466
[0009.42] DevOnline: Advertising: OwningPlayerId=76561197997089271
[0009.42] DevOnline: Advertising: NumPublicConnections=32
[0009.42] DevOnline: Advertising: bUsesStats=True
[0009.42] DevOnline: Advertising: bIsDedicated=False
[0009.42] DevOnline: Advertising: OwningPlayerName=UDK Server
[0009.42] DevOnline: Advertising: p1073741825=MyColdTestServeronSteam
[0009.43] DevOnline: RegisterLocalTalker(0) returned 0x00000000
[0009.43] ScriptLog: Game created!!! Game True
[0009.43] ScriptLog: Current build url ?SteamServerId=?NumPublicConnections=32?NumPrivateConnections=32?NumOpenPublicConnections=32?NumOpenPrivateConnections=32?bShouldAdvertise=True?bIsLanMatch=False?bUsesStats=True?bAllowJoinInProgress=True?bAllowInvites=True?bUsesPresence=True?bAllowJoinViaPresence=True?bAllowJoinViaPresenceFriendsOnly=False?bUsesArbitration=False?bAntiCheatProtected=False?bIsDedicated=False?PingInMs=0?MatchQuality=0.000000?GameState=OGS_Pending?ColdServerName=MyColdTestServeronSteam
[0009.43] ScriptLog: Map ending
[0009.43] DevNet: Browse: ColdMap1?Name=coldscooter?Team=255?game=ColdGame?listen?steamsockets?SteamServerId=?NumPublicConnections=32?NumPrivateConnections=32?NumOpenPublicConnections=32?NumOpenPrivateConnections=32?bShouldAdvertise=True?bIsLanMatch=False?bUsesStats=True?bAllowJoinInProgress=True?bAllowInvites=True?bUsesPresence=True?bAllowJoinViaPresence=True?bAllowJoinViaPresenceFriendsOnly=False?bUsesArbitration=False?bAntiCheatProtected=False?bIsDedicated=False?PingInMs=0?MatchQuality=0.000000?GameState=OGS_Pending?ColdServerName=MyColdTestServeronSteam
[0009.43] Log: LoadMap: ColdMap1?Name=coldscooter?Team=255?game=ColdGame?listen?steamsockets?SteamServerId=?NumPublicConnections=32?NumPrivateConnections=32?NumOpenPublicConnections=32?NumOpenPrivateConnections=32?bShouldAdvertise=True?bIsLanMatch=False?bUsesStats=True?bAllowJoinInProgress=True?bAllowInvites=True?bUsesPresence=True?bAllowJoinViaPresence=True?bAllowJoinViaPresenceFriendsOnly=False?bUsesArbitration=False?bAntiCheatProtected=False?bIsDedicated=False?PingInMs=0?MatchQuality=0.000000?GameState=OGS_Pending?ColdServerName=MyColdTestServeronSteam
[0009.43] Log: --- LOADING MOVIE START ---
[0009.50] ScriptWarning: Invalid user index (255) specified for ClearReadProfileSettingsCompleteDelegate()
OnlineSubsystemSteamworks Transient.OnlineSubsystemSteamworks_0
Function OnlineSubsystemSteamworks.OnlineSubsystemSteamworks:ClearReadProfileSettingsCompleteDelegate:00FE
[0009.50] DevOnline: Clearing online delegates for ColdPlayerController_0 (Player:LocalPlayer_0)
[0011.96] Warning: Warning, Failed to load 'Class None.ColdGame': Failed to find object 'Class None.ColdGame'
[0011.96] Warning: Warning, Failed to find object 'Class None.ColdGame'
[0011.96] Log: Game class is 'ColdGame'
[0011.96] Init: WinSock: Socket queue 131072 / 131072
[0011.96] DevNet: TcpNetDriver_0 TcpNetDriver listening on port 7777
[0011.98] Log: NetMode is now 2
[0012.35] Log: Primary PhysX scene will be in software.
[0012.35] Log: Creating Primary PhysX Scene.
[0012.57] Log: *** WARNING - PATHS MAY NOT BE VALID ***
[0012.57] Log: Bringing World coldmap1.TheWorld up for play (0) at 2017.09.07-20.45.48
[0012.65] Log: Bringing up level for play took: 0.677172
[0012.65] ScriptLog: Spawning player controller now.
[0012.65] DevOnline: Remote talker is being re-registered
[0012.65] DevOnline: StartRemoteVoiceProcessing(0x011000010231E1F7) returned 0x00000000
[0012.92] DevOnline: ServerUserStatsReceived: bIOFailure: 0, UID: 76561197997089271, Result: '1' k_EResultOK (success)
[0012.92] DevOnline: Async task 'FOnlineAsyncTaskSteamServerUserStatsReceived completed bWasSuccessful: 1, User: 76561197997089271, Result: '1' k_EResultOK (success)' completed in 0.200958 seconds with 1
[0012.92] DevOnline: UserStatsReceived: bIOFailure: 0, UID: 76561197997089271, Result: '1' k_EResultOK (success)
[0012.92] DevOnline: Async task 'FOnlineAsyncTaskSteamUserStatsReceived completed bWasSuccessful: 1, User: 76561197997089271, Result: '1' k_EResultOK (success)' completed in 0.200964 seconds with 1
[0012.92] DevGFxUI: Failed loading SWF "/ package/UDKFrontEnd/udk_ime": ActionScript version mismatch
[0012.92] Log: ########### Finished loading level: 3.489602 seconds
[0012.97] DevOnline: Refreshing published game settings...
[0012.97] DevOnline: Server data: Ver: 9188, Ded: 0, Region: 255, Slots: 64, Pass: 0, Server: UDK Server, Map: coldmap1, Players: 0 Bots: 0, Game: ColdGame
[0012.97] DevOnline: Advertising: SteamEngineVersion=12466
[0012.98] DevOnline: Advertising: OwningPlayerId=76561197997089271
[0012.98] DevOnline: Advertising: NumPublicConnections=32
[0012.98] DevOnline: Advertising: bUsesStats=True
[0012.98] DevOnline: Advertising: bIsDedicated=False
[0012.98] DevOnline: Advertising: OwningPlayerName=UDK Server
[0012.98] DevOnline: Advertising: p1073741825=MyColdTestServeronSteam
[0012.98] DevOnline: Updating session info, address: 199.195.151.36:7777, ServerUID: 90110975859234816, bSteamSockets: 0
[0012.98] DevOnline: Successfully set the friend join URL: -SteamConnectIP=199.195.151.36:7777
[0012.98] Log: Steam game server UID: 90110975859234816
[0012.98] DevOnline: Steam Servers Connected
[0012.98] ScriptLog: Kicking off listen auth session
[0012.98] DevOnline: AntiCheatStatus: VAC Secured: 1
[0012.98] DevOnline: Refreshing published game settings...
[0012.98] DevOnline: Server data: Ver: 9188, Ded: 0, Region: 255, Slots: 64, Pass: 0, Server: UDK Server, Map: coldmap1, Players: 0 Bots: 0, Game: ColdGame
[0012.98] DevOnline: Advertising: SteamEngineVersion=12466
[0012.98] DevOnline: Advertising: OwningPlayerId=76561197997089271
[0012.98] DevOnline: Advertising: NumPublicConnections=32
[0012.98] DevOnline: Advertising: bUsesStats=True
[0012.98] DevOnline: Advertising: bIsDedicated=False
[0012.98] DevOnline: Advertising: OwningPlayerName=UDK Server
[0012.98] DevOnline: Advertising: p1073741825=MyColdTestServeronSteam
[0012.98] DevOnline: Obtained steam user stats, user: 76561197997089271
This all looks like things should be working (apart from the line that reads: “DevOnline: Updating session info, address: 199.195.151.36:7777, ServerUID: 90110975859234816, bSteamSockets: 0”). I don’t know why is bSteamSockets: 0…
I then load up another instance of the game and call SearchOnlineGames() in my ColdGame class:
function SearchOnlineGames() {
SearchSetting = new class'ColdOnlineSearchSettings';
SearchSetting.bIsLanQuery = false;
SearchSetting.MaxSearchResults = 50;
// Cancel the Search first...cause there may be a former search still in progress
GameInterface.CancelFindOnlineGames();
GameInterface.AddFindOnlineGamesCompleteDelegate(OnServerQueryComplete);
GameInterface.FindOnlineGames(class'UIInteraction'.static.GetPlayerControllerId(0), SearchSetting);
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
// Delegate that gets called when the ServerSearch is finished
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function OnServerQueryComplete(bool bWasSuccessful) {
local int i;
local ColdOnlineGameSettings gs;
searchResults = SearchSetting.Results;
//Do something with search results...
GameInterface.ClearFindOnlineGamesCompleteDelegate(OnServerQueryComplete);
}
Class ColdOnlineSearchSettings:
class ColdOnlineSearchSettings extends OnlineGameSearch;
defaultproperties
{
GameSettingsClass=class'ColdOnlineGameSettings'
}
When I search this is what logs:
[0012.38] ScriptLog: in SearchOnlineGames
[0012.38] DevOnline: Can't cancel a search that isn't in progress
[0012.38] DevOnline: Starting search for Internet games...
[0013.23] DevOnline: Server browser query timed out after '0.000000' seconds
[0013.23] ScriptLog: success 0
[0013.25] DevOnline: Async task 'FOnlineAsyncTaskSteamServerListRequest completed FinalResponse: 0' completed in 0.853009 seconds with 1
[0013.25] DevOnline: ServerListRefreshComplete: Got server list response without matching query
I honestly don’t know what i’m missing here. Has anyone had any experience with this that can share some insight?
Thanks