Masterserveruplink: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| Line 1: | Line 1: | ||
Why do you need to specify any master server if you want to run a server that is not advertised?! | Why do you need to specify any master server even if you want to run a server that is not advertised?! | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
Latest revision as of 16:30, 13 March 2026
Why do you need to specify any master server even if you want to run a server that is not advertised?!
class MasterServerLauncher extends Info; //[3369] Issue #1
function BeginPlay()
{
local MasterServerUplink M;
local int i;
for(i = 0; i < class'MasterServerLink'.default.MasterServerList.Length; i++)
{
Log("Creating master server uplink for" @ class'MasterServerLink'.default.MasterServerList[i].Address $ ":" $ class'MasterServerLink'.default.MasterServerList[i].Port, 'MasterServerLauncher');
M = Spawn(class'MasterServerUplink');
M.myMasterServer = i;
//This must only be called on one master server link
if (i == 0)
M.UplinkAndStats();
M.Reconnect();
if (! class'MasterServerUplink'.default.DoUplink) break;
}
Destroy();
}
The MasterServerUplink object isn't solely for reporting information to a master server. It has multiple functions:
- Establishing network play
- Starting up the link to GameSpy, if
UplinkToGamespyis requested in addition toDoUplink - Starting up the link to GameStats if
SendStatsis requested in addition toDoUplink - Starting up the link to a master server, if
DoUplinkis requested
The reason one of these objects is always required is for activity 1, even if things 2, 3 and 4 are configured off.
In the code above there is a call to M.UplinkAndStats(); which performs steps 1 to 3 from the list above. Here it is (cut down) so you can follow the logic:
function UplinkAndStats()
{
local class<UdpLink> LinkClass;
NetworkConnect(); // this is my point 1 above
if( DoUplink )
{
if( UplinkToGamespy )
{
// set up link to gamespy
}
if( SendStats )
{
// set up link to stats server
}
}
}
The next line after M.UplinkAndStats(); in the code you quoted is a call to the C++ engine code:
M.Reconnect();
Within that engine function there is a check on DoUplink. If it is set to true, it starts up a master server link. If not, it does not establish that link and instead outputs this line in the log:
MasterServerUplink: DoUplink is False, not connecting to master server(s)
