Game Development Community

Server without mission specified

by Toks · in RTS Starter Kit · 01/03/2008 (2:10 am) · 4 replies

Has anyone tried creating a server without the mission being specified already. This would be nice to, for example, not define this until we are all in the lobby, so that all the players can decide what map they want to play.

I've got a little working now. I believe I have created a server without a mission defined (which takes some tweaking in the common directory) and it should be listed on the master since i get this in my console:

Sending heartbeat to master server [IP:69.64.50.217:28002]

but when i try to find it with the joinServerGui it does not find any servers on my LAN (nor the master for that matter)

#1
01/03/2008 (10:45 am)
Intresting indeed, I haven't paid attention to this till you mention it.

I think you could hack it on the createServer function (.\common\server\server.cs). Although you have to pass to it an specific mission from the begining, one of the last lines of the procedure is:
$MissionToLoad = %mission;

Maybe you could try changing $MissionToLoad to some other mission than the original one and see what happen. Its a dirty trick, but its only to see if it actually works. I'll be checking this out later today. If you do it first, tell me what you get.
#2
01/04/2008 (3:31 am)
Yes ive been in there and changed the function a bit. The strangest part, though, is that i can run a dedicated server without a mission now.

function initDedicated()
{
   enableWinConsole(true);
   echo("\n--------- Starting Dedicated Server ---------");

   // Make sure this variable reflects the correct state.
   $Server::Dedicated = true;

   // Start the server
   createServer("MultiPlayer");
}

but when i try to create a non-dedicated server (think they call it a listen server) using the same createServer("MultiPlayer"); command, and then connecting local, it doesnt show up in the joinServerGui. though it seems to initialize the server correctly and send a heartbeat to the master.

Im not so sure this has anything to do with the mission anymore since the dedicated server does work.
#3
01/04/2008 (9:22 am)
I didnt finally test it, busy day yesterday, thanks for the info. I'll be checking this out later today (I hope).

Could be just a visual issue in the joinServerGui? It could be expecting some mission info, and if it actually does not receive it, get broken?
#4
01/05/2008 (1:43 pm)
Ok, this is how mission chosing works:

1) StartMissionGui.gui - function SM_StartMission()
here it calls createServer function with the chosen mission (from the missions list)

2) server.cs - function createServer(%serverType, %mission);
here it sets $MissionToLoad = %mission;

3) LobbyGui.gui - function LobbyGui::markReady()
here it calls commandToServer('PlayerReady', ); and goes again to server.cs

4) server.cs - function serverCmdPlayerReady(%client, %ready)
once all clients are ready it calls schedule(2000, 0, "loadMission", $MissionToLoad, true);

5) missionLoad.cs - function loadMission( %missionName, %isFirstMission )
and here finally begings the mission loading process, with the mission specified on %missionName


So, as you can see, the server is created with a mission specified, but actually that data can be changed at any time you wish, prior to the loading itself.

I think the recomended place to do what you want is LobbyGui.gui, there you could mimic the mission chosing GUI, and add a parameter %mission, to the serverCmdPlayerReady, pass it from LobbyGui::markReady(), and server side set $MissionToLoad = %mission, just as stock kit do on createServer() (obviously, prior to the scheduled call to loadMission function).

To do tests by hand, just remeber to include the path to the mission file, ie:

$MissionToLoad = "starter.RTS/data/missions/newMisssion.mis";


Note: this way, makes no diference if you create the server with a mission or not, but could be a good detail to allow to create with a specified mission, and then let that chosen one appear as selected on the new GUI that you would create on the Lobby. That is how actually works for example, the Company of Heroes.