Next task is to check how Raspberry Pi will work as a game server. There are several games that can work on Raspberry Pi, most of them are retro games or are not resource hungry.
Minecraft
Minecraft is the most selling game in game history. Minecraft has more copies sold than another popular game - Tetris. You can download game for almost all platforms including PC, consoles, smartphones and even Raspberry Pi has Minecraft versions called Minecraft Pi edition, but it is rather outdated and no more new versions are released.
I have tried to install Java edition server for desktop computers. It is also possible to install version for smartphones.
At first attempt I decided to use Docker and Docker compose. There is instructions in my blog how to install Docker and Docker compose on Raspberry Pi. It would be the easiest way how to run game server. I have found Minecraft docker image and created container. Unfortunately it was very slow and crashed during start. I have used documentation to create container, but may be I was doing something wrong.
It will not be so cool as using Docker image, but Minecraft can be installed without it. I have found this instruction: https://www.linuxnorth.org/minecraft/ how to install Minecraft.
First of all need to install Java. Instructions I have found says that need to Install Java 8, but officially it is not supported by Raspbian Buster anymore. It is recommended to use OpenJDK 11 instead. We will need JRE and JDK libraries.
After running update
sudo apt-get update
sudo apt-get upgrade
Install JRE and JDK
sudo apt-get install openjdk-11-jdk
sudo apt-get install openjdk-11-jre
Also can install screen if it is not installed yet
sudo apt-get install screen
After that can download Spigot Minecraft install script
wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
And build
sudo java -Xmx1024M -jar BuildTools.jar --rev 1.14.3
By last parameter --rev 1.14.3 can specify Minecraft version. I have figured out that at this moment last version 1.14.4 cannot be built - script returns error. So I have used version 1.14.3
It can take 10-20 minutes to complete build on Raspberry Pi 3. Then can make script file to run server, for example minecraft.sh
nano minecraft.sh
Make it executable
sudo chmod +X minecraft.sh
And put there script
#!/bin/bash
sudo java -Xms512M -Xmx1008M -jar spigot-1.14.3.jar nogui
Now can run screen and run Minecraft inside virtual console. You can read manual how to use screen if you are not familiar with it.
screen
#press enter after program start
./minecraft.sh
After first run need to accept eula:
sudo nano eula.txt
Change the following line to true and save
eula=true
Also it is recommended to install NoSpawChunks plugin into minecraft/plugins folder. This can be done by command
wget https://dev.bukkit.org/projects/nospawnchunks/files/latest -O NoSpawnChunks.jar
Now run Minecraft one more time
Minecraft is running pretty good on Raspberry Pi for several people. If not, can change some settings in server.properties file, for example decrease view-distance value.
Minecraft game clients
You can play Minecraft on Linux, Windows or even there are instructions how to install it on Raspberry Pi. Client can be downloaded from official website or somewhere else.
To play game on your server you should choose the same Minecraft version as it is installed on server -in this case it is 1.14.3
Choose to play multiplayer game and input game server ip address or server name.
Terraria
Terraria is another popular game. It's gameplay is similar to Minecraft, but it has 2D game engine. Terraria is written using .NET framework. It is possible to run it on Linux using Mono framework. Mono is open source implementation of Microsoft’s .NET Framework which is what the TShock server software relies on.
Install Mono framework
First of all need to install Mono framework. To install Mono, we must first add the Ubuntu key server, without this key server we can’t grab Mono from the Mono Project repository.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
Then we can add package. This command will add the package to a particular list that will be automatically loaded in by the package manager.
echo "deb http://download.mono-project.com/repo/debian buster main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
I this command there is parameter "buster" that specifies Raspbian version.
Now we have to run updates on Raspberry Pi
sudo apt-get update
sudo apt-get upgrade
After that Mono repository will be available and it will be possible to install it
sudo apt-get install mono-complete
Install Terraria server
Now we have Mono framework and can start to install Terraria server. On Github there is TShock repository. At this moment latest version is 4.3.26, Terraria version is 1.3.53
At first we will create directory for files
mkdir ~/tshock
cd ~/tshock
To download software should run this command
wget https://github.com/Pryaxis/TShock/releases/download/v4.3.26/tshock_4.3.26.zip
After zip file download, should extract files from archive
unzip tshock_4.3.26.zip
Now server can be run using this command
mono TerrariaServer.exe
Or can create script file terraria.sh with text
#!/bin/bash
cd tshock
mono TerrariaServer.exe
Make it executable and run sever
chmod +x terraria.sh
./terraria.sh
Then you will be asked some questions about size of the world, number of players and some other. I have chosen medium world, but if you want you can select large world, it will not take too much time on Raspberry Pi to generate it.
Terraria runs on Raspberry Pi even better than Minecraft and takes less memory.
Terraria game clients
You can connect to server using Linux or Windows computer. Select Multiplayer game, then Connect and choose server.
Quake III
Quake III is another popular game in the past. So it can be called as retro game because it was released almost 20 years ago. At that time it had very nice graphics and now it does not looks very outdated or ugly. Quake III has mutiplayer mode so it can be installed as server on Raspberry Pi.
Installation is very simple. We will use docker image for this purpose. I have described how to install Docker and Docker Compose.
There is script on Github that will download required files including yml docker compose file, quake configuration file and quake data file. Just need to run this command
curl -sSL https://github.com/wouterds/rpi-quake3-server/raw/master/install.sh | sh
Downloaded docker-compose.yml file contains this settings
version: '2'
services:
server:
image: wouterds/rpi-quake3-server
restart: unless-stopped
volumes:
- ./pak0.pk3:/data/pak0.pk3
- ./server.cfg:/data/server.cfg
ports:
- '27960:27960/udp'
mem_limit: 64mb
It uses volumes for two files pak0.pk3 and server.cfg. In server.cfg you can configure maps, bots, game type, etc.
Quake III game clients
Quake III can be played in Linux or Windows or even in Raspbian on Raspberry Pi. As game engine is free, you can download it from here: https://ioquake3.org/ But to play Quake III you will have to find and copy file pak0.pk3 to game directory.
So now you can play with your friends by local network
Freeciv
The last game I have installed on my Raspberry Pi game server is Freeciv. It is free version of Civilization. It is similar to Civilization II, but can be highly customized.
Installation is very easy, just run this command
sudo apt-get install -y freeciv-server freeciv-client-gtk
And then start server
freeciv-server
Freeciv game clients
Game can be run using Linux, Windows or Raspberry Pi computer. For Windows download installer from Freeciv home website, for Raspberry Pi it can be installed from repository. For Linux Mint if you want to install latest version 2.6, it will not be available from repository, so installation is a bit tricky.
You can download script for installation from Github
curl -sSL https://github.com/edgars-eizvertins/game-server/blob/master/freeciv-mint19.sh
There should specify some parameters - client version, game version, etc and script will install game on your computer. Then you should able to connect to Freeciv server
Conclusion
We have tried to use Raspberry Pi as game server. There are several games for install them on Raspberry Pi as game server. Except these 4 games I have described you can find some more. For example can find them on this website: https://www.makeuseof.com/tag/raspberry-pi-game-servers/ Of course main limitation is ARM processor on this computer, not many games support it. Many of that games are open source - in this case it will be easier to port it to ARM by gamers or programmers.