Help wanted / HowTo: Dedicated hosting
Moderator: Moderators
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Help wanted / HowTo: Dedicated hosting
Where to get:
Its in svn under "tools/DedicatedServer"
How to build:
It can be build using the cmake buildsystem. Do the following if you use linux: "cmake . && make"
In windows: Install cmake, set path to "tools/DedicatedServer", push configure, adjust the MINGWLIBS -path, press OK and then build it using make.
How to use
The stand alone way
After building, there is a "dedicated" executable. Just run it. It takes two commandline arguments: first the full path to the script.txt, second the port for communication with the server (can be left out).
Some notes about the script: Only a few of the options are actually used, like playernames, teams, allys etc. Some others will be completely ignored.
Update:
It now only takes the full path to the startscript as argument, yust like spring-executable. The "AutohostPort" option in the startscript has replaced the commandline-option, so is has to be set in script.
The scripts the clients use don't need to be changed (except address and port of course). But spring needs to be started with the "-c" option to tell the engine its a client. Otherwise the first player will start its own server and won't connect to the dedicated one.
The built-in way
Its rather simple
1. Include "GameSetupData.h" and "Game/GameServer.h"
2. Create a GameSetupData object and fill it with game details (similar to the startscript)
3. Create the server object (see the example in "tools/DedicatedServer/main.cpp"). It will start its own thread and continue to run until the game ends.
4. Delete the server after the game has ended.
Just don't forget to link against the server library.
It would be great if someone could set up a dedicated server in for buildbot.no-ip.org.
Its in svn under "tools/DedicatedServer"
How to build:
It can be build using the cmake buildsystem. Do the following if you use linux: "cmake . && make"
In windows: Install cmake, set path to "tools/DedicatedServer", push configure, adjust the MINGWLIBS -path, press OK and then build it using make.
How to use
The stand alone way
After building, there is a "dedicated" executable. Just run it. It takes two commandline arguments: first the full path to the script.txt, second the port for communication with the server (can be left out).
Some notes about the script: Only a few of the options are actually used, like playernames, teams, allys etc. Some others will be completely ignored.
Update:
It now only takes the full path to the startscript as argument, yust like spring-executable. The "AutohostPort" option in the startscript has replaced the commandline-option, so is has to be set in script.
The scripts the clients use don't need to be changed (except address and port of course). But spring needs to be started with the "-c" option to tell the engine its a client. Otherwise the first player will start its own server and won't connect to the dedicated one.
The built-in way
Its rather simple
1. Include "GameSetupData.h" and "Game/GameServer.h"
2. Create a GameSetupData object and fill it with game details (similar to the startscript)
3. Create the server object (see the example in "tools/DedicatedServer/main.cpp"). It will start its own thread and continue to run until the game ends.
4. Delete the server after the game has ended.
Just don't forget to link against the server library.
It would be great if someone could set up a dedicated server in for buildbot.no-ip.org.
Last edited by Auswaschbar on 12 Feb 2008, 19:39, edited 2 times in total.
Re: Help wanted / HowTo: Dedicated hosting
Oh, so you did the startscript part, nice =)
Actually I already tested my Perl Lobby and AutoHost interfaces with your dedicated server through a test script that acts like a very very basic autohost, and it was working (for what it was supposed to do for the moment of course
).
I don't have a real autohost for the moment as I'm still specifying its configuration files (I don't have much free time currently :/ ). However, as I already did the UnitSync, Lobby, and AutoHost interfaces modules, it will be really quick to write a basic autohost. I'm gonna try to set it up right now...
Actually I already tested my Perl Lobby and AutoHost interfaces with your dedicated server through a test script that acts like a very very basic autohost, and it was working (for what it was supposed to do for the moment of course

I don't have a real autohost for the moment as I'm still specifying its configuration files (I don't have much free time currently :/ ). However, as I already did the UnitSync, Lobby, and AutoHost interfaces modules, it will be really quick to write a basic autohost. I'm gonna try to set it up right now...
Re: Help wanted / HowTo: Dedicated hosting
As the buildbot.no-ip.org server seems down for the moment, I had to set up the autohost on the normal lobby. I replaced the 0.76b1+ sdz files in "base" directory of the dedicated server with the 0.76b1 ones, so that anyone can join with the current stable spring version. I tested it quickly and the server seems to load correctly the start-script my autohost generated (but I was alone so it's a very basic script):
--------------------
BIG FAT WARNING: this server is currently under development. If you find any errors (you most likely will) report them to mantis or the forums.
Loading script: xxxxxxxx/spring/startscript.txt
Starting server on port 8452
Connecting to autohost on port 8454
Client connected on slot 1 (wanted number was 1)
Player bibim joined as 1
---------------------
However, as before, the game can't start because the autohost player do not connect (which is normal because it's a dedicated server...). And I can't force a game start as client.
--------------------
BIG FAT WARNING: this server is currently under development. If you find any errors (you most likely will) report them to mantis or the forums.
Loading script: xxxxxxxx/spring/startscript.txt
Starting server on port 8452
Connecting to autohost on port 8454
Client connected on slot 1 (wanted number was 1)
Player bibim joined as 1
---------------------
However, as before, the game can't start because the autohost player do not connect (which is normal because it's a dedicated server...). And I can't force a game start as client.
Re: Help wanted / HowTo: Dedicated hosting
yeahAuswaschbar wrote: It would be great if someone could set up a dedicated server in for buildbot.no-ip.org.
Re: Help wanted / HowTo: Dedicated hosting
After some tests, it seems that there are problems when trying to start a multiplayer game with the dedicated server. Clients get following errors while loading: "Unknown net-msg recieved from CPreGame: 3". Then they exit immediatly. Maybe this is due to the fact we were using Spring 0.76b1 for the tests (because test lobby is currently down)...
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Help wanted / HowTo: Dedicated hosting
Yeah, its only working with the svn version, 76b1 won't work.
Re: Help wanted / HowTo: Dedicated hosting
Ok the test lobby seems back, so I've set up an instance of my basic autohost on it. I can't test multiplayer right now though, as I'm currently at work...
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Help wanted / HowTo: Dedicated hosting
The startscript should not contain an extra player for the host.bibim wrote:However, as before, the game can't start because the autohost player do not connect (which is normal because it's a dedicated server...).
<edit>I see the problem now...
But you can forcestart with your autohost. You need to send ".forcestart".bibim wrote:And I can't force a game start as client.
Last edited by Auswaschbar on 31 Jan 2008, 18:24, edited 1 time in total.
Re: Help wanted / HowTo: Dedicated hosting
Yeah I though about removing the host entry in the start script. But how can the lobby clients know that they must remove the host ? From their point of view it's a standard host, which is present in the battle lobby before the game start...Auswaschbar wrote:The startscript should not contain an extra player for the host.bibim wrote:However, as before, the game can't start because the autohost player do not connect (which is normal because it's a dedicated server...).
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Help wanted / HowTo: Dedicated hosting
The clients will remove the host when the game starts. When there is no such player in the startscript from the server, it will think all players have connected and start the game.
Not an ideal solution...
Not an ideal solution...
Re: Help wanted / HowTo: Dedicated hosting
I will try to fix that when I'm home. For the moment, maybe you can try entering "!say .forcestart" in battle lobby after you started a game.
Re: Help wanted / HowTo: Dedicated hosting
Hum, I just tried removing the autohost player from the server startscript, and the game did not start neither.
My client joined as number 1 because the client startscript still contains the host player, and the server allowed the client to keep the number 1. So I guess the server didn't think all clients had joined...
Beside this it seems that sending the ".forcestart" command through AutoHost interface doesn't work neither.
My client joined as number 1 because the client startscript still contains the host player, and the server allowed the client to keep the number 1. So I guess the server didn't think all clients had joined...
Beside this it seems that sending the ".forcestart" command through AutoHost interface doesn't work neither.
Re: Help wanted / HowTo: Dedicated hosting
After a rebuild, the forcestart command is now "functional": it freezes my spring client. Here is the server side output:
Client connected on slot 1 (wanted number was 1)
Player bibim joined as 1
sending ".forcestart" to game server
No response from bibim for frame 1
No response from bibim for frame 402
Lost connection to player 1 (timeout)
No clients connected, exiting...
Client connected on slot 1 (wanted number was 1)
Player bibim joined as 1
sending ".forcestart" to game server
No response from bibim for frame 1
No response from bibim for frame 402
Lost connection to player 1 (timeout)
No clients connected, exiting...
Re: Help wanted / HowTo: Dedicated hosting
Ok so I forgot to update my client during my last test. Now it seems to start normally at least with one player. However I think it would be better if the dedicated server would really appear as connected in the player list, with the autohost "player" name. That way we would avoid the non-joining-dedicated-autohost bug at client side. And the autohost player (actually the dedicated server player) would have a ping of 0, but its CPU usage would be the dedicated server CPU usage, which could be interesting...
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Help wanted / HowTo: Dedicated hosting
I don't think this is a good idea because players (clients) have to bother with lots of stuff you don't need (and simply can't do) like sync checking.bibim wrote:Ok so I forgot to update my client during my last test. Now it seems to start normally at least with one player. However I think it would be better if the dedicated server would really appear as connected in the player list, with the autohost "player" name. That way we would avoid the non-joining-dedicated-autohost bug at client side. And the autohost player (actually the dedicated server player) would have a ping of 0, but its CPU usage would be the dedicated server CPU usage, which could be interesting...
Also the server can't measure the cpu usage because there is no simulation going on.
Re: Help wanted / HowTo: Dedicated hosting
I though there was a way to bypass this beeing the server :/Auswaschbar wrote:I don't think this is a good idea because players (clients) have to bother with lots of stuff you don't need (and simply can't do) like sync checking.
Oh ok so the CPU usage is based on simulation time only, all other stuffs aren't taken into account ?Auswaschbar wrote:Also the server can't measure the cpu usage because there is no simulation going on.
Then I suppose the dedicated autohost will have to send the forcestart command. In "Choose start pos" mode it will have to wait that everyone has joined and is ready. In other modes it will just have to wait that everyone has joined. That's it ?
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Help wanted / HowTo: Dedicated hosting
This would work.
It should also work if you give your host the last available player number (is number 31) and don't add him to the server's script. Then the server will autostart if all players have joined and eventually set their startpositions.
You may even give him number 127 or something like this, then it won't be read from the script at all (on server and client), but I don't know if this will trigger lobby bugs.
It should also work if you give your host the last available player number (is number 31) and don't add him to the server's script. Then the server will autostart if all players have joined and eventually set their startpositions.
You may even give him number 127 or something like this, then it won't be read from the script at all (on server and client), but I don't know if this will trigger lobby bugs.
Re: Help wanted / HowTo: Dedicated hosting
Hum... I don't think I can change the player numbers in the client startscripts, it's basically the join order. And as specified here, the host player number must be 0 in startscripts. So all clients respect this rule and I don't think I can change anything about it.Auswaschbar wrote:This would work.
It should also work if you give your host the last available player number (is number 31) and don't add him to the server's script. Then the server will autostart if all players have joined and eventually set their startpositions.
You may even give him number 127 or something like this, then it won't be read from the script at all (on server and client), but I don't know if this will trigger lobby bugs.
I've just added the "!rebuild" command in order to update my local svn working copy and rebuild all necessary objects automatically. It might be usefull as I will be offline for one week, starting tomorrow morning...
Re: Help wanted / HowTo: Dedicated hosting
I've implemented the auto ".forcestart" command when all players have joined the server. However, I just tested it in monoplayer mode (noone on test lobby :/ )
Re: Help wanted / HowTo: Dedicated hosting
So, anything new ? Autohosts for dedicated servers will have to send the ".forcestart" command, as my test autohost is doing right now ?