Slackware-current and a dedicated Terraria Server
by BenV on Jun.30, 2015, under Software
With the v1.3 patch coming soon ™, hopefully today, it’s time to play Terraria again! ๐
One of the claims is that it will now be easier / at all possible to run multiplayer games through steam. Well, we’ll see about that, but I figured this would be a great time to get my own dedicated headless server up and running.
In order to run a dedicated Terraria server under linux, we need to be able to run .NET stuff. So mono it is.
Before we build mono, we’ll first need to install libgdiplus, so let’s get to it. Make sure you have the latest libjpeg-turbo, giflib, tifflib, so that configure will say:
* Codecs supported:
– TIFF: yes
– JPEG: yes
– GIF: yes
– PNG: yes
Next I needed a patch to make it actually compile against the latest giflib, which can be found here: https://github.com/Mailaender/libgdiplus/commit/somebignumber
(for better viewing remove the .diff from the url like this, the .diff a nice github trick to get a workable diff file)
benv@tds:~/src$ wget -q https://github.com/mono/libgdiplus/archive/3.12.tar.gz -O libgdiplus-3.12.tar.gz
benv@tds:~/src$ tar axf !$:t
benv@tds:~/src$ cd libgdiplus-3.12
benv@tds:~/src/libgdiplus-3.12$ wget -q https://github.com/Mailaender/libgdiplus/commit/0da7cde2a9d8248fe8f6472777d63ba5ba5d4303.diff
benv@tds:~/src/libgdiplus-3.12$ patch -p1 < 0da7cde2a9d8248fe8f6472777d63ba5ba5d4303.diff
benv@tds:~/src/libgdiplus-3.12$ ./configure --prefix=/usr && make && sudo make install
Or simply use slackbuild.pl or your own build scripts ๐
Note that in order to get libtiff to be found by libgdiplus I needed to get rid of some old cruft libraries like an ancient libjpeg.so.6.2 and libtiff.so.3.9.6, they were still lying around but unused.
After that we continue with the big beast - Mono. Latest stable version at this time is 4.0.1.44, which you can fetch here. Compilation was relatively straightforward for me, as long as you don't enable extra cruft in configure. As soon as you see stuff like it not being able to find mini-generic-sharing-gsharedvt.c or "error: โkNaClBundleSizeโ undeclared (first use in this function)" you know you have some cruft enabled that should not be ๐
The only things I fed configure were a prefix (note that I have my usual config.site that autoconf uses for the paths), but even with the libdir set to /usr/lib64 mono insists on putting stuff in /usr/lib. Assholes, I have a 64bit linux, fuck off with your 32 bit garbage. I don't need a /usr/lib! *sigh*.
Anyway, if everything went for you like it went for me you now have a working mono.
For Terraria there are two options. Option 1 is download the game and try to run
TerrariaServer.exe through mono. From what I've heard that won't fly on linux due to some things not being implemented properly yet. Guess that's why the linux port isn't out yet too ๐
Trying it out gave me this blurb:
benv@tds:~/terraria$ mono TerrariaServer.exe
Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553' or one of its dependencies.
File name: 'Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553'
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553' or one of its dependencies.
File name: 'Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553'
Well, no big surprise. I could of course go on a hunt and try to get all the missing pieces if possible (there are some mono xna libs out there), but I'm too lazy for that, since we have option 2.
Option 2:
Use TShock, found on https://tshock.co/. This does have the notice that you'll have to wait a bit until they reverse engineer the patch though.
TShock for Terraria 1.3 has not been released. The TShock Team will start reverse engineering and building the updated ServerAPI for Terraria 1.3 at 1:01pm EST on June 30th, 2015. When the update has been released, this notice will be disabled. No plugin updates will be approved until API version 1.18 is released, and plugin updates that ensure compatibility with 4.3 before 1.18 will be deleted.
Anyhow, let's get it up and running so that when their new version comes out you can simply drop it in place ๐
benv@tds:~/terraria$ wget -q https://github.com/NyxStudios/TShock/releases/download/4.3.0GM1/tshock_4.3.0_gm1.zip
benv@tds:~/terraria$ unzip tshock_4.3.0_gm1.zip
Archive: tshock_4.3.0_gm1.zip
extracting: TerrariaServer.exe
extracting: sqlite3.dll
extracting: ServerPlugins/HttpServer.dll
extracting: ServerPlugins/Newtonsoft.Json.dll
extracting: ServerPlugins/BCrypt.Net.dll
extracting: ServerPlugins/Mono.Data.Sqlite.dll
extracting: ServerPlugins/MySql.Data.dll
extracting: ServerPlugins/MySql.Web.dll
extracting: ServerPlugins/TShockAPI.dll
benv@tds:~/terraria$
Now we can simply run it, right?
WRONG!
benv@tds:~/terraria$ mono TerrariaServer.exe
TerrariaAPI Version: 1.17.0.0 (Protocol v1.2.4.1)
[Server API] Error Startup aborted due to an exception in the Server API initialization:
System.InvalidOperationException: Failed to load assembly "MySql.Web.dll". ---> System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetExportedTypes () [0x00000] in
at TerrariaApi.Server.ServerApi.LoadPlugins () [0x00000] in
--- End of inner exception stack trace ---
at TerrariaApi.Server.ServerApi.LoadPlugins () [0x00000] in
at TerrariaApi.Server.ServerApi.Initialize (System.String[] commandLineArgs, Terraria.Main game) [0x00000] in
at Terraria.ProgramServer.Main (System.String[] args) [0x00000] in
Wut? Apparently you need to remove the MySql.Web.dll and then run this with a different mono runtime, like this:
benv@tds:~/terraria$ rm ServerPlugins/MySql.Web.dll
benv@tds:~/terraria$ mono-boehm TerrariaServer.exe
TerrariaAPI Version: 1.17.0.0 (Protocol v1.2.4.1)
TShock 4.3.0.0 (TShock Slim) now running.
AutoSave Enabled
Backups Disabled
Welcome to TShock for Terraria. Initialization complete.
[Server API] Info Plugin TShock v4.3.0.0 (by The TShock Team) initiated.
Terraria Server v1.2.4.1
n New World
d
Choose World:
Yay, it's up. After generating a world and starting the server on a free port (7777 was already taken here by InspirCD) it is up and running:
Terraria Server v1.2.4.1
Listening on port 8888
Type 'help' for a list of commands.
TShock Notice: authcode.txt is still present, and the AuthToken located in that file will be used.
To become superadmin, join the game and type /auth 1362887
This token will display until disabled by verification. (/auth-verify)
: serverinfo
Server executed: /serverinfo.
Memory usage: 728121344
Allocated memory: 1517178880
Total processor time: 00:00:14.6610000
WinVer: Unix 3.18.0.0
Proc count: 4
Machine name: tds
And after I fire up my Terraria client and try to connect it:
: 192.168.1.225:61268 is connecting...
BenV has joined.
Of course this is before the 1.3 patch, but I'm happy it's up and running ๐