Opinions expressed here belong to your're mom
This blogpost details a bit of my personal history with the game, some recent (at the time of writing) news in the game's development, and how you can go about setting up your own dedicated STK server.
When people ask about free software videogames, SuperTuxKart is one of the most frequently cited examples of a fully funcitonal game that you can play. Before Steam came to Linux and popularized playing proprietary videogames on the platform, STK was one of the most polished games that you could play without a proprietary operating system or the (then anemic) WINE.
When I was in elementary school, my uncle (who was in middle school at the time) blew my mind by showing me that he could play Gameboy games on his computer with something called an "emulator". He explained that an emulator is when your computer pretends to be a Gameboy so that it can play Gameboy games. If this was sorcery, what I saw next was black magic. He showed me some basic texture replacement and he made Professor Oak at the beginning of Pokemon Blue say my name instead of his normal "Hello there! Welcome to the world of POKEMON!". He showed me so much cool stuff that he could do on his computer and at the end he said "but if you really want to do hardcore stuff, you need Linux". We then had to eat dinner so he couldn't tell me more.
In the Summer of 2011, my mother insisted that I take a course at Portland's Saturday Academy because she didn't want me sitting around playing videogames and doing nothing for the entirety of Summer break(just 6 out of 7 days each week). I looked through their course catalog and saw one course that said "Linux" in the title. The name stuck out because it's not something that you hear very often when you're just a regular kid, but I remembered it from the conversation that I had had with my uncle all those years ago. Armed with a O'Reilly Linux Pocket Guide from my mom and a hope that I might get to modify Pokemon Blue, I walked into class. We were taught the basics of building a computer, installing Linux, using Linux, and to finish it all off we downloaded and played SuperTuxKart. This content was spread out over the whole summer, and I left the class with the foundational knowledge and skills that would someday become my career and main hobby.
My impression of STK from this first interaction was that it was clunky but functional.
Despite having received this book a whopping 14 years ago and becoming a professional full-time tax-paying bill-having Linux Sysadmin, I still have not read more than the first 3 pages of this book.
Almost exactly 8 years later, in the Summer of 2019, I was on a motorcycle camping trip on the Mongolian steppe with some dudes from the Internet. The camping trip was a week long, and I don't remember the exact details of how , but we were able to charge our phones. Additionally, there was surprisingly good 4G connectivity nearly everywhere we went, even when you could scarcely see a building in the distance. Everyone had Android and one guy also had an iPhone as a "travel phone". One of the last days of the trip, we couldn't find wood to build a fire so we didn't want to sit outside and get eaten up by mosquitos, secluding us to our respective tents. It was also a rare occasion where we had poor Internet connectivity. I wanted to play SuperTuxKart with everyone but our Internet connection was too poor for everyone to be able to download it quickly. F-Droid has a built-in feature to share installed apps over a local network connection, but for whatever reason we couldn't get it to work. All we wanted to do was shared the software and raced karts together. After several failed downloads each, we were all able to (slowly) get the game on our phones and even play a little bit, using the iPhone as a WLAN router. But by the time the last guy had it, some of us had already started going to sleep.
Despite the hiccups, it was a blast. There's something surreal about playing SuperTuxKart on your phone with strangers from the Internet while laying in a tent in the middle of nowhere in a foreign country. I can't fully describe with langauge what it feels like, but it is amazing. This memory stayed with me and changed my perception of both camping and of SuperTuxKart. No more was it a "clunky but functional" game that I didn't really want to play. It had transformed into "a great party game" in my mind, and even "a core part of the camping experience".
Fast forward another couple of years and I was glamping in an RV at Michigan International Speedway to see NASCAR with some friends from the Internet. I knew the gameplan before I packed my bag, before I even bought my ticket or booked my flight. I wanted to play STK with the guys while camping in an RV. I pre-downloaded the current version of STK for every platform and did all the work beforehand to set up my laptop as a WiFi hotspot. I wrote instructions on installation, printed and laminated some steps to get people bootstrapped, and headed off to Michigan.
This time there were no hiccups. Everybody could participate. We didn't need Internet, I had brought everything that we could possibly need. Everyone had a great time. The game was still clunky and floaty, but if you're having fun with your friends, the clunkiness is a source of comedy, not a source of frustration. The game is still frustratingly unpolished if you're playing the Story Mode or against bots, but against other humans with the goal of having a good time it is some of the best fun you can have while camping after the fire has gone out for the night.
I wanted to keep playing after the camping was over. I wanted to play over the Internet when I got home. There are plenty of public STK servers available, but my Internet at home is ADSL and my ping outside of my geographical region is abysmal. I couldn't reasonably do this from my house because I'm double-NAT'd and on ADSL. There's no way that my network can take even 8 people connecting from the outside. Once I had my own server hardware colocated in a nearby datacenter, I had no more excuse, and it was time to run my own dedicated STK server.
There's not an "easy" way to run a dedicated STK server.
The STK team has put out some documentation that is helpful in running the server, but it is missing some crucial information. There are some other guides which are all also missing some pieces, and there is a Docker container that hasn't been updated in 3 years. The good news here is that I'm a professional and I'm used to figuring things out with bad or missing docs. This section of the blog is meant to be a complete guide for everything that you need to host your STK server. It is exactly what I have done to host mine.
I'm doing all of this work on Ubuntu 24.04. If you're doing it on something else, you may have to adjust these instructions slightly.
We're going to compile a custom version of STK so we need to do some initial setup. I recommend compiling instead of using a pre-packaged version for a couple of reasons:
First, install some apt prereqs that will be needed to do the compilation and get the rest of what we need.
apt install build-essential cmake libbluetooth-dev \
libcurl4-openssl-dev libenet-dev libfreetype-dev libfribidi-dev \
libgl1-mesa-dev libglew-dev libjpeg-dev libogg-dev libopenal-dev \
libpng-dev libssl-dev libvorbis-dev libxrandr-dev libx11-dev \
nettle-dev pkg-config zlib1g-dev
Then we need to download the latest stable release tarball from GitHub and the latest assets snapshot from Sourceforge. You will be able to compile STK and even launch it with just the tarball from GitHub, but it will immediately crash (and the compilation will complain) if you don't have the assets. Yes, even for server-only mode. I don't think that this should be necessary but that's just the way that it is.
On my system, this gave me a 1.4.tar.gz and a supertuxkart-code-r18614-stk-assets.zip. If you're doing this in the future, then you'll probably wind up with different version numbers in your filenames. That's okay.
We'll additionally want to make a user to run the service and a directory to house everything.
useradd -d /opt/supertuxkart/ -c "SuperTuxKart Server" -m -s /usr/bin/nologin supertuxkart
mv 1.4.tar.gz supertuxkart-code-r18614-stk-assets.zip /opt/supertuxkart/
As a last prerequisite, you'll need an STK online account. You can make one on this page. Keep track of your username and password.
Unzip the zip file and untar the tar file. This will yield two new directories, named supertuxkart-code-r18614-stk-assets and stk-code-1.4, respectively. Move the assets to the appropriate place underneath the stk-code where the compilation is going to look for them, and make a new directory to build the software from.
mkdir stk-code-1.4/stk-assets/ stk-code-1.4/build/
mv supertuxkart-code-r18614-stk-assets/* stk-code-1.4/stk-assets/
cd stk-code-1.4/buid/
Then you just run the compilation:
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/supertuxkart/ -DSERVER_ONLY=ON
make install -j $(nproc --all)
Then make sure that everything is owned by the supertuxkart user that we made earlier:
chown -R supertuxkart:supertuxkart /opt/supertuxkart/
Once you have the software successfully compiled, you need to set up the server to run automatically. The first step in this is to make sure that you are signed into your STK Online account that you made earlier. You can do that from the commandline by running:
sudo -u supertuxkart /opt/supertuxkart/bin/supertuxkart --init-user --login=YOUR_USERNAME --password=YOUR_PASSWORD
This will create the file /opt/supertuxkart/.config/supertuxkart/config-0.10/players.xml which contains your username and auth token. It doesn't include your password which is nice. Admitedly, I have no idea how to invalidate an auth token. I don't think that this functionality is exposed to server operators, probably instead it is exclusive to the STK devs who run the STK online service.
Next you need to modify the config file. A default one is provided here. This is what mine looks like:
<?xml version="1.0"?>
<server-config version="6" >
<server-name value="punkto.org STK" />
<!-- use the server port specified in stk_config.xml -->
<server-port value="2759" />
<!-- 0 = normal race (GP), 1 = time trial (GP), 3 = normal race, 4 time trial, 6 = soccer, 7 = free-for-all, 8 = capture the flag. -->
<server-mode value="3" />
<!-- 0 = beginner, 1 = intermediate, 2 = expert and 3 = supertux -->
<server-difficulty value="2" />
<gp-track-count value="4" />
<soccer-goal-target value="false" />
<!-- Enable wan server -->
<wan-server value="true" />
<!-- This uses a whole CPU if on -->
<enable-console value="false" />
<server-max-players value="8" />
<max-players-in-game value="8" />
<private-server-password value="" />
<!-- MOTD file path -->
<motd value="/opt/supertuxkart/motd.txt" />
<chat value="true" />
<!-- Don't rate limit chats -->
<chat-consecutive-interval value="-1" />
<track-voting value="true" />
<voting-timeout value="30" />
<validation-timeout value="20" />
<validating-player value="true" />
<!-- I run my firewall -->
<firewalled-server value="false" />
<ipv6-connection value="false" />
<!-- No server owner in lobby which can control the starting of game or kick any players. -->
<owner-less value="false" />
<start-game-counter value="60" />
<!-- Clients below this value will be rejected from joining this server. It's determined by number of official karts in client / number of official karts in server -->
<official-karts-threshold value="1" />
<!-- Same as above. Set lower because Android lmao -->
<official-tracks-threshold value="0.7" />
<min-start-game-players value="2" />
<!-- Prevent Dongus from driving in circles forever -->
<auto-end value="true" />
<team-choosing value="true" />
<!-- Disabled to allow splitscreen players -->
<strict-players value="false" />
<!-- A bunch of casuals here -->
<ranked value="false" />
<!-- Let owner configure server in GUI. Changes not saved to this file. -->
<server-configurable value="true" />
<!-- Allow people to join during races -->
<live-spectate value="true" />
<!-- Server addon carts sent to clients -->
<real-addon-karts value="true" />
<flag-return-timeout value="20" />
<flag-deactivated-time value="3" />
<hit-limit value="20" />
<time-limit-ffa value="360" />
<capture-limit value="5" />
<time-limit-ctf value="600" />
<auto-game-time-ratio value="-1" />
<max-ping value="300" />
<jitter-tolerance value="100" />
<kick-high-ping-players value="false" />
<high-ping-workaround value="true" />
<kick-idle-player-seconds value="60" />
<state-frequency value="10" />
<sql-management value="false" />
<database-file value="stkservers.db" />
<database-timeout value="1000" />
<ip-ban-table value="ip_ban" />
<ipv6-ban-table value="ipv6_ban" />
<online-id-ban-table value="online_id_ban" />
<player-reports-table value="player_reports" />
<player-reports-expired-days value="3" />
<ip-geolocation-table value="ip_mapping" />
<ipv6-geolocation-table value="ipv6_mapping" />
<ai-handling value="false" />
<ai-anywhere value="false" />
</server-config>
Make your own and put it in /opt/supertuxkart/something.xml. If you copy mine, you'll want to change some values:
You'll also want to put something in /opt/supertuxkart/motd.txt. This is the message of the day that will be shown to all players who connect.
Your firewall needs to allow incoming connections to the STK daemon, so go ahead and open that up. I'm using firewalld. Adjust this if you're using ufw or raw nftables.
firewall-cmd --add-port=2759/udp --permanent
firewall-cmd --add-port=2757/udp --permanent
firewall-cmd --add-port=2759/udp
firewall-cmd --add-port=2757/udp
Lastly, you'll want to make a SystemD service to run the game at all times. Put this content in /etc/systemd/system/stk.service:
[Unit]
Description=Supertuxkart Server
After=network.target
[Service]
ExecStart=/opt/supertuxkart/bin/supertuxkart --server-config=/opt/supertuxkart/YOUR_CONFIG_FILE.xml --wan-server
WorkingDirectory=/opt/supertuxkart/
Restart=always
User=supertuxkart
[Install]
WantedBy=multi-user.target
Then reload the daemon and start the service:
systemctl daemon-reload
systemctl start stk.service
At this point your server should be publicly available. You can open up the current STK version on any platform, connect, and race with friends and strangers from around the world.
The bad isn't really that bad if you're not a big baby.
Occasionally, there will be an issue with the main STK online server. It will go down and as a result your STK daemon will fail to connect and then just sit there not functioning and not being advertised to other users. To resolve this, just do a:
systemctl restart stk.service
The admin console is disabled in the XML above because a SystemD service has no stdin with which to use it. In some places online, the STK devs recommend launching the application in a screen or tmux session. However, if you do this, then the process uses a whole entire CPU to wait for admin input.
The alternative to the admin console, if for example you need to ban a specific IP address or username, is to interact directly with the Sqlite3 database. This is obviously a non-ideal solution.
You would only need the admin console to kick or ban players. However, I have not experienced even one person who I would not want to play STK with in the time that I've been hosting a public server. The most "abuse" that could happen is plaintext in the game chat. Oh no, free speech!
Maybe someone has or could make a client that cheats at SuperTuxKart, but I think that the motivation for doing that is probably pretty low, given the extremely small playerbase. You would get way more ROI with hacked clients making people mad on a popular game like Counter Strike, Fortnight, or Over Watch.
The above config promotes the first-connected person on the server to be able to change gamemodes and difficulties. This is super useful because when strangers use your server without you there, they can play however they want. However, there is no ability to tell the server "whenever the user myusername connects, promote him to the boss position". I suppose that this theoretically opens up the possibility of someone connecting, becoming the admin, and then going AFK forever. Remember to just have fun and not take things too seriously.
If you look at the public server list, you'll see the punkto.org STK server listed. You may notice that nobody is online. In fact, if you scroll through the server list, you may notice that nobody is racing on many of the public servers.
However, a peculiar thing happens when you start playing on any public server. Other people will intermitently (usually in the evening in the Western hemisphere) look at the public server list and filter by number of active players. They'll see someone playing and join on in. You eventually wind up with a snowball effect where everyone is joining in on the server(s) with the highest playercount because everyone wants to play with the most people.
This has happened to me a few times on my own server. Sometimes I get on and run a few races and nobody else gets on. Sometimes I get on and then the usercount snowballs all the way up to the limit. When there's other people, there is fun to be had.
A river stops being a river when you put it in a bucket. A river's only a river when it flows. I could show you screenshots or describe with extreme detail what it's like to be playing a videogame with strangers on the Internet for free, but all the descriptions in the world don't do it justice. Fun is only fun when it's experienced. If you played CS or TF2 back in the day, it's similar to that. There's dudes with crazy high skill levels. There's dudes who just want to have a laugh and drive backwards for the whole race. There's dudes who talk mad shit on the Internet.
Playing STK online reminds me of the "good old days" when the Internet was the wild west and people didn't take things so seriously. I love it and I'll never stop.
Recently, there has been some silly drama in the STK development team and a portion of it has split off from the rest, forming STK Evolution. If you like, you can read a whole long blogpost about it here.
The STK Evolution people seem dedicated to shipping v1.5 soon, providing a better STK Online server that doesn't drop dedicated servers all the time, and continuing to work on STK in the longterm. They're also in control of the github.
As soon as 1.5 is available, from whoever ships it first, the punkto.org STK server will have it available. I look forward to being among the first dedicated servers on the new STK Online.
Happy racing.