Raspberry Pi as FreeCiv server
In one of my last articles I presented you the new raspberry pi store. There are many different programs to download. One of them is the civilization clone FreeCiv.
What is FreeCiv?
FreeCiv is a open source game, which is a clone of the well known civilization 2. FreeCiv can be played on nearly every operating system you can think of. You can play it on Linux, Windows, or Mac OSX. Currently FreeCiv is not supported by the current OSX version.
FreeCiv also supports a multiplayer mode. So you can play a solo game against the AI or with some other human players. A game can last over months, so it is a good idea to set up a dedicated FreeCiv server. For this you can use your raspberry pi!
We want to set up our raspberry pi to host a FreeCiv game as FreeCiv server. This game should be available over the internet and should be available every time. So players can do their round for example once a day. And with this a game can lasts months.
You can install FreeCiv from the raspberry pi store with ease. You can do it from the graphical Linux interface and after that you can change back to console mode.
You can start the FreeCiv server with the following command:
you can also use many different params to configure your game. Some examples are:
- port number (-p 5556)
- resume a saved game (-f savegame.sav)
- inform meta servers (-m)
The whole list can be found on the FreeCiv Wiki. The default setting for the port is 5556. With the first param you can change it. If you start the server, you also start a new game, otherwise you can set a save game file to resume a saved game. Normally each round is saved automatically. The meta server parameter is to inform a FreeCiv host server, that you started a server and allow to other players to join. So your FreeCiv server goes public.
My raspberry pi has a static ip address for my private home network. If I want to make my game public, I have to configure my router. This is really simple, because I had only to activate port forwarding for the FreeCiv port. This can be done from your router console, which can be accessed with your web browser (normally with a standard ip address like 192.168.1.1). There you have to create a new entry for your local raspberry pi address and the FreeCiv port. With this done, you should be able to connect from the internet with a FreeCiv client. You can test this for example with an Open Port Test. Here you can see your ip address from outside and you can check if you FreeCiv port is open. If you run a FreeCiv server you can also view outputs during the test on your FreeCiv server console.
You can now start your game and you can play with other players worldwide. If players close their clients and do not play, the server still runs. So if the user comes back he can do the next round and so on.