Openttd Server Port

Posted on  by 



I'm playing with some friends OpenTTD about once a week and currently I'm using a 10$ droplet on DigitalOcean where I'm also hosting some other projects. Soon I will dismiss such projects and I'm wondering where I could host the OpenTTD server considering that.

November 8, 2015

Update: Check out part two for a more up to date guide.

I recently setup an OpenTTD server and I thought I might document the steps I took to do so.

I choose to use a Digital Ocean (DO) to host my server since I’ve been wanting to try them out for some time. It also helps that their cheapest hosting option is rather cheap - only $5 per month. And since I don’t think OpenTTD will be particularily memory intensive I am fairly certain that the extra 512MB of RAM for the $10 per month DO droplet will be needed.

After creating my $5 per month droplet running Ubuntu 14.04 LTS I followed DO’s handy initial server setup to get my server ready for installing OpenTTD.

Installing OpenTTD

  • Where to host an OpenTTD server? I prefer to not host the game on my private network because then it is always messy with the port forwarding and in general my friends would depend on my computer being on to start playing. Sometimes I join a bit later or some friend prefers to start a bit earlier and it's cool to have the game.
  • You can either do that through the multiplayer window or by using the following command line syntax: openttd -n IP:port#CompanyID Example: openttd -n 192.168.0.1:3979#1 I mean, if I start a a server, my details appear there but it still states 'Server offline' - even to me and most certainly to my friend as well.

The first step to installing OpenTTD is downloading it:

Then to install OpenTTD and it’s dependencies:

Installing Graphics

Before you can kick off your OpenTTD server you need to install some graphics. If you don’t have your original Transport Tycoon Deluxe CDs handy the bare minimum for this is to download OpenGFX which provides free replacements for the game’s graphics. To install it:

OpenttdOpenttd server not showing up

Adding An OpenTTD Service

Openttd can

With OpenTTD installed one of the last steps is to setup an OpenTTD service. Luckily for us, Frodus has kindly created an OpenTTD init script available here.

First we need to download and unzip it:

Then we need to add a symlink of the openttd file to /etc/init.d, update its permissions and add the OpenTTD service to the Ubuntu startup scripts.

Finally rename ~/openttd-init/config.example to config and edit the variables to suitable values.

OpenTTD Configuration

The last step before starting to play is setting up the openttd.cfg file - a list of the available options is on the OpenTTD wiki. A good overview of what options to change is also available on the OpenTTD Coop Wiki.

Openttd Can't Find Server

One setting of great importance is the sever_port (default value 3979) setting. Whatever option you choose, make sure to add a firewall rule. If you are using the default Ubuntu firewall ufw it is as simple as:

iptables configuration is left as an exercise to the reader.

Some of the other settings I like to change are:

  • min_active_clients set this to 1 so the game is paused when noone is connected.
  • inflation set this to false since after a while money is no object.
  • forbid_90_deg set this to false as 90 degree turns are ugly.
  • train_acceleration_model set this to realistic otherwise slopes will seriously slow your trains down.
  • vehicle_breakdowns breakdowns are annoying so no breakdowns please.
  • no_servicing_if_no_breakdowns no servicing when there are no breakdowns.

Joining Your Server

Openttd Server Port Forward

Once you have setup your config it’s finally time to fire up your OpenTTD server:

To join your server in the Multiplayer settings window click the Add Server button and add your server with the port number like so:

Openttd Server Portal

And after joining you should be greeted with your shiny new OpenTTD game. Happy network building!

Tasklist

FS#5793 - Openttd Dedicated server crashes when failing to load a recent savegame

Attached to Project: OpenTTD
Opened by T Werkhoven (twerkhoven) - Saturday, 26 October 2013, 16:52 GMT
Last edited by frosch (frosch) - Thursday, 31 October 2013, 20:31 GMT
TypeBug
Category Core
Status Closed
Assigned To No-one
Operating SystemLinux
SeverityLow
PriorityNormal
Reported Versiontrunk
Due in Version Undecided
Due Date Undecided
Percent Complete
Votes 0
Private No

Details

Openttd Revision: 25912
OS: CentOS 6.4 64bit
OpenTTD is started with -D -f options (dedicated server, forked to background)
When loading a more recent game, which then fails to load (eg due to missing newgrf), the game crashes with below assertion error. The error does not occur when its an older savegame failing to load, the error is handled gracefully and the server generates a random map and keeps running.
crash.sav and log are included, dmp and png are not created. Non-dedicated clients do not exhibit this behaviour. The gui will refuse to load the game in the first place. When forcing the client to load the game via console, it will load the game and simply ignore missing grfs.
Savegames which cause this error if they fail to load:
http://www.openttdcoop.org/files/publicserver_archive/PublicServerGame_260_Final.sav
http://www.openttdcoop.org/files/publicserver_archive/PublicServerGame_268_Final.sav
Savegame where failing to load it is handled gracefully and keeps the server up with a random map:
http://www.openttdcoop.org/files/publicserver_archive/PublicServerGame_207_Final.sav
** below is the console before it generates crash.log:
[2013-10-26 20:04:16] dbg: [net] Loading game failed, so a new (random) game will be started!
Error: Assertion failed at line 351 of /home/openttd/svn-devserver/src/linkgraph/../core/smallvec_type.hpp: index < this->items
Crash encountered, generating crash log...
** This is what should happen, and happens with older games.
[2013-10-26 20:27:28] dbg: [net] Loading game failed, so a new (random) game will be started!
[2013-10-26 20:27:28] dbg: [net] Generating map, please wait...
[2013-10-26 20:27:28] dbg: [net] Map generation percentage complete: 5
[2013-10-26 20:27:28] dbg: [net] Map generation percentage complete: 10
...
[2013-10-26 20:27:28] dbg: [net] Map generation percentage complete: 90
[2013-10-26 20:27:28] dbg: [net] Map generation percentage complete: 99
[2013-10-26 20:27:28] dbg: [net] Map generated, starting game
[2013-10-26 20:27:28] ERROR: Game Load Failed?NewGRF mismatch

Openttd Server Admin Port

Closed by frosch (frosch)
Thursday, 31 October 2013, 20:31 GMT
Reason for closing: Fixed
Additional comments about closing: in r25934
Tasks related to this task (0)
Duplicate tasks of this task (0)




Coments are closed