Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new documentation page about Freeciv21 on servers #1304

Merged
merged 8 commits into from
Aug 23, 2022
1 change: 1 addition & 0 deletions docs/General/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ the FAQ and installation instructions go here.
install.rst
windows-install.rst
modpack-installer.rst
on-the-server.rst
:maxdepth: 1

Manuals
Expand Down
109 changes: 109 additions & 0 deletions docs/General/on-the-server.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
..
SPDX-License-Identifier: GPL-3.0-or-later
SPDX-FileCopyrightText: 2022 louis94 <[email protected]>

Freeciv21 on the Server
***********************

In order to play Freeciv21 on the network, one machine needs to act as the *server*: the state of
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved
the game lives on the server and players can connect to play. There are many ways to operate such a
server; this page gives an introduction to the topic.
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved

In order to run a server, you need a computer that other players can reach over the network. If
you're planning to play at home, this can usually be any machine connected to your WiFi or local
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved
cabled network. Otherwise, the easiest is to rent a small server from a hosting provider. We
jwrober marked this conversation as resolved.
Show resolved Hide resolved
strongly recommend that you choose a Linux-based server, as that is what we have experience with.
You will need the ability to run your own programs on the server, so SSH access is a must. Apart
jwrober marked this conversation as resolved.
Show resolved Hide resolved
from that, Freeciv21 is quite light on resources so you will hardly hit the limits of even the
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved
cheapest options.

Whether you choose to use your own machine or to rent one, the basic principle of operating a
server is the same: you need to run a program called ``freeciv21-server`` for as long as the game
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either change the colon to a semi-colon or break up into two sentences.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? This that you need to run freeciv21-server is the continuation of "the basic principle is the same". I think using a full stop or a semicolon would lose this nuance.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or maybe just a comma instead? IDK, the colon feels wrong, but I can't put my finger on it directly. I am also ok to leave as is.

will last. This program will wait for players to connect and handle their moves in the exact same
way as in a single player game. In fact, Freeciv21 always uses a server, even when there is only
one player!
jwrober marked this conversation as resolved.
Show resolved Hide resolved

Installation
============

Installing Freeciv21 on a server is done the normal way, as documented in :doc:`/General/install`.
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved
Because the official packages come with the complete game, they will pull a number of dependencies
that are normally not used on servers (for instance, a display server). This software is installed
for packaging reasons, but will not be used.

Starting the Server
===================

Once Freeciv21 is installed, it's immediately ready to run a simple server, which one can do by
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved
running the following command:

.. code-block:: sh

freeciv21-server
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved

This starts a server listening on the port traditionally used for Freeciv21, 5556. You can provide
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved
a custom port number by passing it to the ``-p`` argument:

.. code-block:: sh

freeciv21-server -p 5000

A server started with this command can be reached by pointing the game to port 5000 of your domain
name. We suggest to start the server from within a terminal multiplexer such as ``tmux`` or
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved
``screen``, which will let it run independently.

User Permissions
================

Freeciv21 supports several access levels for players connected to a server, restricting which
commands they are allowed to run:

``none``
The user may not issue any command.

``info``
The user may use informational commands only.

``basic``
The user may use informational commands as well as commands affecting the game. Commands
affecting the game start a vote if more than one user is connected.

``ctrl``
Same as ``basic``, but the vote is bypassed for commands affecting the game.

``admin``
May use any command, except for ``quit``, ``rfcstyle``, and ``write``. This includes
potentially destructive commands such as ``save`` and ``fcdb`` --- use with care.

``hack``
May use all commands without restriction.

By default, users connected to your server have access level ``basic``. This can be changed using
the ``cmdlevel`` command::

cmdlevel info new

This command would grant access level ``info`` to any newly connecting player. A few more options
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved
are available; please refer to the documentation of ``cmdlevel`` for more information.
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved

.. note::
The ``take`` and ``observe`` commands require access level ``info`` only. Their use can be
restricted using the ``allowtake`` server option or, in more advanced setups, using the
``user_take`` :doc:`fcdb </Coding/fcdb>` hook.

Authentication
==============

By default, Freeciv21 servers are open to anyone without any sort of authentication. It is
possible to make Freeciv21 ask for a password. There is also a built-in registration procedure
with which one can create an account and set a password.
jwrober marked this conversation as resolved.
Show resolved Hide resolved

Authentication needs vary greatly depending on what you do with your server. If you use passwords
merely to prevent players from peeking on each other, you may be fine with a very basic setup. If
you are planning to run a full-scale server allowing registration through a website, you will
need much more advanced settings. Freeciv21 ought to support all use cases within a unified
interface. To allow for the necessary flexibility, authentication support is implemented using a
Lua script.

See the :doc:`fcdb documentation </Coding/fcdb>` for more information about setting up
authentication.