Author Topic: Dedicated Server Howto  (Read 10544 times)

GGLucas

  • Dr. Evil
  • BMS Staff
  • Delusional
  • *
  • Posts: 1877
  • Karma: +300/-6
    • View Profile
Dedicated Server Howto
« on: January 15, 2011, 01:55:54 PM »
Running a Dedicated Server
To run a dedicated server, just run the srds executable. The defaults should work fine to start with, but you'll probably want to modify some things.

Server Settings
When starting srds.exe, you can add command line parameters. For example:
Code: [Select]
srds.exe +servername "My Dedicated Server" +serverpass "Secret" +quickstart "dedicated"
This names your dedicated server and sets the remote command password. It also runs the quickstart profile "dedicated", which decides your game settings.

If you are connected to your dedicated server, you can remotely run console commands by using "remote <Password> <Command>". For example:

Code: [Select]
remote Secret set_speed_factor 10
Running a mod

You can start a dedicated server running a mod you have installed by adding the following to the command you use to run the server. For example:

Code: [Select]
srds.exe ..... +mod "ModDirectory"

Where ModDirectory is the name of the directory that the mod is installed in in Mods/.

Game Settings
Game settings are decided in Game Data/quickstart.xml. Create a new profile in there called "dedicated" (or whatever profile name you used in your command line). You can use some special settings in here. A typical profile would look like this:

Code: [Select]
<profile id="dedicated" name="Dedicated">
<map file="spiral.as" /> <!-- Sets the map used -->
<settings>
<!-- Map settings -->
<SYSTEM_COUNT val="60" /> <!-- Amount of systems to generate -->
<MAP_SYSTEM_SPACING val="3000" /> <!-- Spacing -->
<MAP_FLATTEN val="0" /> <!-- Flatten the map? -->
<AI_COUNT val="6" /> <!-- Amount of AIs to put on the map -->
<AI_DIFFICULTY val="5" /> <!-- Difficulty of the AIs -->

<SV_AUTO_PAUSE val="1" /> <!-- Whether to pause when no players are connected -->
<SV_PUBLIC val="1" /> <!-- Whether to announce the server to the master server and list it -->
<SV_PORT val="12100" /> <!-- Port to host on -->
<SV_ENABLE_VOTES val="1" /> <!-- Whether to enable !votes -->
<SV_RESTART_INTERVAL val="0" /> <!-- Amount of minutes a game lasts before an automated restart -->

<!-- Amount of players that can be connected at a time. Note only
AI_COUNT players can actually play as an empire -->
<SV_MAX_PLAYERS val="6" />
</settings>
</profile>
« Last Edit: February 03, 2011, 08:40:04 PM by GGLucas »

Nico Flows

  • Newbie
  • *
  • Posts: 11
  • Karma: +1/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #1 on: January 31, 2011, 07:27:51 PM »

in my quickstart.xml
file which lives in
C:\Program Files (x86)\Indie Games\Star Ruler\Game Data

I added the following section at the bottom

<profile id="dedicated" name="Dedicated">
   <map file="spiral.as" /> <!-- Sets the map used -->
   <settings>
      <!-- Map settings -->
      <SYSTEM_COUNT val="1000" /> <!-- Amount of systems to generate -->
      <MAP_SYSTEM_SPACING val="6000" /> <!-- Spacing -->
      <MAP_FLATTEN val="0" /> <!-- Flatten the map? -->
      <AI_COUNT val="50" /> <!-- Amount of AIs to put on the map -->
      <AI_DIFFICULTY val="5" /> <!-- Difficulty of the AIs -->

      <SV_AUTO_PAUSE val="0" /> <!-- Whether to pause when no players are connected -->
      <SV_PUBLIC val="0" /> <!-- Whether to announce the server to the master server and list it -->
      <SV_PORT val="12100" /> <!-- Port to host on -->
      <SV_ENABLE_VOTES val="1" /> <!-- Whether to enable !votes -->
      <SV_RESTART_INTERVAL val="0" /> <!-- Amount of minutes a game lasts before an automated restart -->

      <!-- Amount of players that can be connected at a time. Note only
          AI_COUNT players can actually play as an empire -->
      <SV_MAX_PLAYERS val="100" />
   </settings>
</profile>


I used the following command line

C:\Program Files (x86)\Indie Games\Star Ruler>srds.exe +servername "DedServer" +
serverpass "password" +quickstart "Dedicated"

however when I run the client and click on the MULTIPLAYER option in the main menu I see a server but not one that has the name of the number of players I specified

what am I missing? 

GGLucas

  • Dr. Evil
  • BMS Staff
  • Delusional
  • *
  • Posts: 1877
  • Karma: +300/-6
    • View Profile
Re: Dedicated Server Howto
« Reply #2 on: January 31, 2011, 07:50:27 PM »
Code: [Select]
<SV_PUBLIC val="0" /> <!-- Whether to announce the server to the master server and list it -->

You need to set this to 1 for it to appear in the server list. The 0 you specified tells the server to not be public and not announce itself to the master server.

Nico Flows

  • Newbie
  • *
  • Posts: 11
  • Karma: +1/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #3 on: February 02, 2011, 11:03:16 PM »
Cool thanks for the reply... one more question is there a parameter I can put in there to reduce game speed Like you can in single player?

GGLucas

  • Dr. Evil
  • BMS Staff
  • Delusional
  • *
  • Posts: 1877
  • Karma: +300/-6
    • View Profile
Re: Dedicated Server Howto
« Reply #4 on: February 03, 2011, 08:49:59 AM »
Not in the configuration, but there are two ways to reduce the game speed after connecting to your dedicated server.

If you have votes enabled, you can type a speed vote in the chat, for example:
Code: [Select]
!speed 0.5

If you have a server password set with +serverpass, connect to your server, open the console (with the ~` key on most keyboards) and do:
Code: [Select]
remote password set_speed_factor 0.5

xandalis

  • Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #5 on: February 03, 2011, 08:35:43 PM »
How do you setup a server to run a mod?

GGLucas

  • Dr. Evil
  • BMS Staff
  • Delusional
  • *
  • Posts: 1877
  • Karma: +300/-6
    • View Profile
Re: Dedicated Server Howto
« Reply #6 on: February 03, 2011, 08:39:21 PM »
I've added how to run mods to the original post.

Quote
Running a mod

You can start a dedicated server running a mod you have installed by adding the following to the command you use to run the server. For example:

Code: [Select]
srds.exe ..... +mod "ModDirectory"

Where ModDirectory is the name of the directory that the mod is installed in in Mods/.

xandalis

  • Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #7 on: February 03, 2011, 08:48:10 PM »
Doh. sorry, blind moment there... or would that be blonde moment?

GGLucas

  • Dr. Evil
  • BMS Staff
  • Delusional
  • *
  • Posts: 1877
  • Karma: +300/-6
    • View Profile
Re: Dedicated Server Howto
« Reply #8 on: February 03, 2011, 08:49:21 PM »
Considering I added it because you asked about it, I would say neither :P

xandalis

  • Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #9 on: February 03, 2011, 08:50:51 PM »
ROFL. well, seems I'm batting .100... misread your post either way :P

EaglePryde

  • Sentient
  • **
  • Posts: 128
  • Karma: +7/-1
    • View Profile
Re: Dedicated Server Howto
« Reply #10 on: April 08, 2011, 04:22:40 PM »
Is there a way to setup a race for every player joining or even load their saved empire into the game if playing/creating a dedicated server?
Or is there a way to setup the dedicated server where every player can customize their race bevor entering?

EDIT:

I have this as commandline

srds.exe +servername "EaglePryde's Server" +mod "GalacticArmory" +serverpass "password" +quickstart "Dedicated"

but it seems that the Mod isn't loaded althought the folders name is exactly what i entered.
« Last Edit: April 08, 2011, 04:49:20 PM by EaglePryde »

XTRMNTR2K

  • Modder Extraordinaire
  • Delusional
  • ****
  • Posts: 1564
  • Karma: +178/-2
  • I aim to misbehave.
    • View Profile
Re: Dedicated Server Howto
« Reply #11 on: April 08, 2011, 05:06:57 PM »
I have this as commandline

srds.exe +servername "EaglePryde's Server" +mod "GalacticArmory" +serverpass "password" +quickstart "Dedicated"

but it seems that the Mod isn't loaded althought the folders name is exactly what i entered.

It's not the name of the folder, but the name of the mod in the modinfo.txt you have to enter ("Galactic Armory 1.6.2").

EaglePryde

  • Sentient
  • **
  • Posts: 128
  • Karma: +7/-1
    • View Profile
Re: Dedicated Server Howto
« Reply #12 on: April 08, 2011, 06:06:44 PM »
ok misunderstood it then. thanks alot  ;D

Airith

  • Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #13 on: June 08, 2011, 10:57:52 AM »
I'm hoping to set up a dedicated server on my Ubuntu box. I've run other Windows programs through Wine on there and that works fine, but I'm wondering if there's anything that would get in the way before I attempted it. I'll try anyways and post back here, sometime in the next week.

As for settings, I know there's an option to put a cap on the number of ships, but does that mean that the cap is evenly distributed for each player/ai, or is it a race to reach the cap?

GGLucas

  • Dr. Evil
  • BMS Staff
  • Delusional
  • *
  • Posts: 1877
  • Karma: +300/-6
    • View Profile
Re: Dedicated Server Howto
« Reply #14 on: June 08, 2011, 10:59:35 AM »
The cap is per empire, or it would indeed be a race, and that wouldn't be fun.

The dedicated server runs under wine, but I don't think it'll run without an X server up. The best solution I've found for that is to run a 1x1 px  Xvfb fake X server and run it on that (a blatant hack, yes).

Airith

  • Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #15 on: June 08, 2011, 11:03:04 PM »
I got it to work in Windows 7 just fine, although I'm wondering how I would shutdown gracefully?

Running into troubles on Ubuntu:

$ Xvfb :1 -screen 0 800x600x16 &
Some font warnings, don't seem important.
$ DISPLAY=localhost:1.0 wineconsole --backend=curses srds.exe +servername "name" +serverpass "password" +quickstart "dedicated"
Screen flickers then goes back to displaying nothing. Any ideas?

I'm also unsure which files the dedicated server requires, or is it all of them?

edit:
$ DISPLAY=localhost:1.0 wine srds.exe +servername "server" +serverpass "password" +quickstart "dedicated"
Gets me:
$ fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.VC90.CRT" (9.0.21022.8)
$ X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  1 (X_CreateWindow)
  Serial number of failed request:  195
  Current serial number in output stream:  199

edit2:
Got past the fixme error.
Seems to be running, I can see Xvfb and srds.exe in my ps -a, however it appears to be frozen. Trying to run:
$ xwd -root -display :1.0 -out xwdout
Gives me:
$ X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  91 (X_QueryColors)
  Value in failed request:  0xf7039fb8
  Serial number of failed request:  31
  Current serial number in output stream:  31

edit3:
Are any of the files from My Games/Star Ruler needed?

edit4:
Got this to display, GUI error box:
Runtime Error!
Program: Z:\home\starruler\srds.exe
R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application's support team for more information.
« Last Edit: June 09, 2011, 12:03:52 AM by Airith »

GGLucas

  • Dr. Evil
  • BMS Staff
  • Delusional
  • *
  • Posts: 1877
  • Karma: +300/-6
    • View Profile
Re: Dedicated Server Howto
« Reply #16 on: June 09, 2011, 12:16:44 AM »
You need to run the vrredist_x86.exe from the game folder to install the runtime (you can also install vcrun2010 from winetricks if you prefer).

Airith

  • Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #17 on: June 09, 2011, 12:53:05 AM »
Why thank you! I had an inkling that it was something to do with that, but when running the vcredist_x86.exe it just complained. Winetricks worked wonderfully and told me I needed msxml.exe or some such. It's in the server list and I just joined from my home PC, hurrah!

So now just questions about commands:
How to shutdown? (Other than pkill)
How to save? (I'll set the Multiplayer Host Autosave on but is there a way to force it, if it's even possible?)

GGLucas

  • Dr. Evil
  • BMS Staff
  • Delusional
  • *
  • Posts: 1877
  • Karma: +300/-6
    • View Profile
Re: Dedicated Server Howto
« Reply #18 on: June 09, 2011, 02:26:56 AM »
There's no way to shut down a server other than sending it an SIGINT or SIGKILL at this time.

For saving games, if you've set a remote password for your server as explained in the OP you can use the savegame console command (I don't have the game handy right now, but if I remember correctly it is "savegame <save_name>", check the "list" command if that doesn't work) through the remote execution. So:

Code: [Select]
remote ServerPassword savegame mysave

Ataman

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #19 on: June 26, 2011, 12:22:52 PM »
Hi there

Thanks for the howto in the first place but there are some serious infos missing in the OP:
- How to enable autosave on the server? I tried some random settings without success. It's fun how many insiders are talking about "I enabled autosave" but nowhere actually stands HOW they did it.
- How to LOAD a saved game. 'remote myPassword load_game mySave' doesn't work the slightest. If the server would at least respond with something like "couldn't load the save" or something...

I got 1.0.0.80 from Steam could that be the problem?

Greetings and thanks in advance
Ataman



GGLucas

  • Dr. Evil
  • BMS Staff
  • Delusional
  • *
  • Posts: 1877
  • Karma: +300/-6
    • View Profile
Re: Dedicated Server Howto
« Reply #20 on: June 26, 2011, 12:25:48 PM »
Quote
- How to enable autosave on the server? I tried some random settings without success. It's fun how many insiders are talking about "I enabled autosave" but nowhere actually stands HOW they did it.

That's a config.cfg setting. In My Games/Star Ruler/config.cfg, it's the bServerAutosave value.

Quote
- How to LOAD a saved game. 'remote myPassword load_game mySave' doesn't work the slightest. If the server would at least respond with something like "couldn't load the save" or something...

Oh... that might be an oversight, sorry. I'll make it possible to load a game on a dedicated server for the next patch.

Ataman

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #21 on: June 26, 2011, 12:34:20 PM »
Wow, great reaction times. :D

The setting is alrdy true in bServerAutosave. There is one autosave being created if I send a remote disconnect. However, the server runs now about one hour without any additional saves.

Peons

  • Newbie
  • *
  • Posts: 21
  • Karma: +1/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #22 on: June 26, 2011, 02:41:27 PM »
Any way to allow custom races on dedicated servers?

Valerian

  • Newbie
  • *
  • Posts: 33
  • Karma: +1/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #23 on: July 21, 2011, 08:44:21 PM »
I am currently starting a project for allowing custom races in a dedicated server, and also a web-based interface to control the server and upload / set a race profile.

Spider0804

  • Newbie
  • *
  • Posts: 18
  • Karma: +1/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #24 on: November 16, 2011, 02:44:07 AM »
Id also like to see more variability with servers
« Last Edit: November 16, 2011, 04:01:04 AM by Spider0804 »

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #25 on: January 29, 2012, 02:23:41 PM »
I came up with this by request of my wife. If you like, please give it a try.
When the srds starts up, it will look for XML files in the \Star Ruler\Game Data\Script Data\Races for custom races. They must be named with R and empire ID. The srds, for some reason starts the ID from 2, (client start with 1, go figure).

Example, if you want to customize the 1st race on the dedicated server, you must name it "R2.xml"
You can make the XML file in customize race in game client.

chrisaut

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #26 on: November 24, 2012, 03:59:50 AM »
One question remains for me: How to i setup the starting research levels in the dedicated server?

I wanna try if my friend and i still experience the crashes with using Galactic Armory when we run it on a dedicated server. Would be more than cool if you could point me to some kind of overview, where i can see all allowed settings in the quickstart.xml

Edit:
I found the answer already, by checking the xml in the setup folder :)
« Last Edit: November 28, 2012, 10:05:17 AM by chrisaut »

daraptor0

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #27 on: December 20, 2012, 01:52:00 AM »
I have a question, The server runs fine. But when I goto multiplayer and attempt to connect, it gives me the ol' unable to connect server may have... blah blah. How ever if I go on LAN i can connect just fine. Does the host machine have to connect via lan? Wish I had another computer to try this out on but only the one.

I guess what I'm asking is, if the srds is ran on the same machine the game is, do you have to connect via lan or is this just some crazy issue I'm having?


Ok, never mind, I followed this guide http://portforward.com/routers.htm#a and was able to forward a range of ports, after which I launched a server and attempted to connect via internet game. I'll be leaving the server up and running if anyone wants to connect, it will all be default atm. If you get a chance hop on and see if you can connect with out any issues. Let me know the results. If you'd like to play a game or 2 with me my SteamID is DaRaptor0
« Last Edit: December 20, 2012, 09:26:14 AM by daraptor0 »

csinger

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #28 on: December 30, 2012, 02:51:54 PM »
I also have a little question about multiplayer games using a dedicated server.

Concerning AIs: As far as I understand, a game has a fixed amount of AI/player slots, like having for example 6 slots aka 6 empires. At the beginning of the game, all empires are controlled by an AI (AI difficulty is set for all in the quickstart.xml). When a player logs into the server, he takes control of one of the empires (previously controlled by AI), and if a player looses connection (quits game, ...), control is given back to the AI.

Is that correct?

Is there any way to alter this behavior, like not assigning an AI at all when a player quits, or at least assign only some kind of a "fake AI" which does nothing?

Background:
The basic idea was to set up a very (very) slow paced game (like 0.01 game speed or something like that), using the dedicated server on my home server machine, which runs kind of permanently/persistantly, and to only log in every few hours, give orders to ships, handle planets and systems and react to AI appearance, and then log out again (just like playing a browser game).
But during the time I'm NOT in the game, there shouldn't be any AI active for my empire that messes up my orders and plans. Of course, the other empires should be controlled by normal AIs as usual.

Any way to achieve that?

Thanks in advance. :)

csinger

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Dedicated Server Howto
« Reply #29 on: January 03, 2013, 12:39:13 PM »
Okay, I just tried to setup the dedicated server, and it seems to run just fine.

I tried it out and it seems that I was right concerning empires are given back to the AI when the player quits the game. Anyway, I managed to alter the scripts/server/empire_ai.as, so that the first empire slot just does not get any AI assigned. Maybe that is already enough for my plans. For now.

Now, I will integrate the feature to define custom races using xml files based on Jyin's script files.

On the long hand, I will try to advance this thing a bit making it configurable without touching script files any further, and pack it into a mod.

Valerian never finished his server configuration project, I think? Too bad, it sounded very interesting. :-/