Hosting Football Manager 2018 On Linux

Yes, that’s right. I don’t get to analytics in public much these days, so I’m bringing you analytics-adjacent content, because I broke down this weekend and bought Football Manager 2018 (twice, read on). And this, despite being overlooked for inclusion in the database for another year despite all those SciSports guys getting in.

Whatever.

So Football (née Championship) Manager was obviously a big part of my youth, like the rest of you. One of the things that I realised upon becoming a proper grown up with a job and everything is that toys are actually really cheap. Like, you get £10 pocket money a week to spend on Optimus Prime or Mask toys, but then suddenly you’re getting all these extra zeroes and fuck it, you can just buy a WHOLE SHELF in Toys R Us (but then you have kids and realise that all these toys have to be put away and every day you tread on lego and it’s a nightmare). And so it is with computers – I remember running CM97/98 on my Pentium II 266MHz with 64MB RAM and being entirely happy.

But then, dear reader, I became a professional proper data science football analytics thingy, and if there’s one thing we have, it’s CPU cycles to burn. So this weekend I installed Football Manager 2018 on a 24 core Xeon server with 128GB RAM BECAUSE I CAN THAT’S WHY.

From the beginning, I have always run Football Manager at maximum detail. I need to be able to watch U23 games in Guatemala in full detail. I need the option of rebuilding my career in the Finnish 2nd division. I am after ABSOLUTE REALISM here. And so I want to run FM18 with its full complement of 350k players and 115 leagues in maximum detail without my laptop incinerating my manparts (FYI we’ve got our 3rd and FINAL child on the way, so it’s really just the pain, not a fertility thing).

Requirements

You will need:

  • A computer you want to use as a server. To be honest, FM doesn’t seem to use tons of RAM so I expect even 16GB is fine even if you do the RAMDISK shenanigans later. More cores is better though.
  • If you’re using an actual server, a VNC client to talk to it.
  • Probably two Steam accounts (if you don’t want to play over VNC)

Setup

The basic process is this:

  1. Get a server
  2. Install Steam
  3. Set up VNC
  4. Create a game
  5. Connect to the game from your own PC
  6. Go on holiday on the server
  7. Abandon all human relationships

Server Configuration

Unfortunately there’s no way to just run an FM server process as a daemon, you need a proper desktop environment and Steam etc. My server’s an Online.net Dedibox, but you might be able to do this on AWS or whatever hardware you have running around. As far as I can tell, Steam only really has two requirements on Linux:

  • XRandR support (to detect monitor dimensions)
  • 24bpp colour (which seems arbitrary)

Unfortunately, the first of these means you can’t use Xrdp, which was my first attempt. RDP is a bit more efficient than VNC but ultimately you’re not going to be using the server interactively that much so it doesn’t matter.

Instead, I used x11vnc, which directly serves your X server’s output over VNC. It supports XRandR because it’s really just replicating your server’s local X setup. Maybe, I dunno, it works though.

$ sudo apt install x11vnc lightdm xfce4-desktop

That’ll give you a minimal X11 setup. It’s Linux though, so it probably won’t work. But if you’re lucky, LightDM starts. You’ll want to set a password for VNC first, with:

$ sudo x11vnc -storepasswd

That’ll prompt you for a password to use when you connect to the server with a VNC client later. After that, you can run x11vnc to listen to connections thusly:

$ sudo x11vnc -ncache 10 -ncache_cr -xkb -noxrecord -noxfixes -noxdamage -display :0 -auth /var/run/lightdm/root/:0 -usepw

You probably shouldn’t do this as root, but whatever, live a little. If you’re extremely lucky, you’ll now be able to connect to your machine via VNC over an SSH tunnel. You can now browse to the steam site and grab the DPKG file they offer to Linux clients, and:

$ sudo dpkg -i steam_latest.deb

Again, if you’re lucky, you’ll now just be able to run Steam, either by its menu entry, or at the command line. Me, I had to monkey a bit with my /etc/xorg.conf like it was 1997. Here’s my setup, on a machine with an old Matrox G200 card. You can configure the monitor/modeline settings for your own machine, here I’m just connecting with a crappy old netbook:

Section "Device"
	Identifier "Matrox G200"
	Driver "mga"
	Option "UseFBDev" "On"
	Option "ShadowFB" "On"
EndSection

Section "Monitor"
	Identifier "Netbook Monitor"
	Modeline "1366x768" 60.0 1366 1404 1426 1494 768 772 778 788 -HSync -Vsync
EndSection

Section "Screen"
	Identifier "24-bit Depth Screen"
	Monitor "Netbook Monitor"
	Device "Matrox G200"
	DefaultDepth 24
	SubSection "Display"
		Depth 24
		Modes "1366x768"
	EndSubSection
EndSection

The most important thing here is ensuring you’re using 24 (or 32) bit colour. Even though you don’t actually care about display quality on the server, Steam won’t run with 16bpp colour.

One other thing to notice is UseFBDev and ShadowFB – instead of actually setting up your card for DRI and stuff, writing to a framebuffer results in the best possible VNC performance, because ultimately all x11vnc wants to do is copy the contents of your framebuffer and send it over VNC.

Okay, if all this worked, you can run Steam, purchase/install FM18 and then launch it. If not, well, 2019 is the year of the Linux desktop, so maybe wait until then.

Network Game Setup

Once you’re running FM over VNC, create a new network game. TICK ALL THE BOXES TO MAKE IT RUN AS SLOW AS POSSIBLE. Once it’s up and running, you should be able to connect from another machine. Because Richard Stallman makes people uncomfortable, we live in an age where you have to purchase two copies of FM18 to run it on two machines at once, so I did this. Then, you can connect to your network game and add a manager. Once that’s done, go to the server game and send your manager on holiday indefinitely. At this point, your remote FM connection has basically complete control of the game, but with all the resources of the server, so things run fast and your fans don’t go bonkers.

Additional Optimisations

If you want to experiment further, you can move FM’s temporary files to a RAMDISK. Linux generally does a good job of caching filesystem writes, but personally I’ve copied the following to /dev/shm for maximum performance:

  • ~/.local/share/Sports\ Interactive/Football\ Manager\ 2018/Caches
  • ~/.local/share/Sports\ Interactive/Football\ Manager\ 2018/Temporary
  • ~/.steam/steamapps/common/Football\ Manager\ 2018/data

Symlink them from their original locations, and FM is basically running everything within RAM.

Conclusion

This is how I spent my weekend, anyway. Your mileage may vary. Of course, I don’t now have time to spend playing the actual game, but it’s nice to know it’s up there waiting for me over Christmas. If you fancy joining in the slowest game of Football Manager 2018 in the world, DM me on Twitter for the server details. The game runs at a rate of about a month of game time per real evening.

Hosting Football Manager 2018 On Linux

One thought on “Hosting Football Manager 2018 On Linux

  1. This is fascinating. I don’t understand it all, but it seems like exactly what my friends and I want to do. Well except the sports universe we are in we would only move ahead 1 day at a time every day. Seeing this shows me it is technically possible, so thank you very much.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s