Currently Online

Latest Posts

Changes in DedicatedServer

Revision Differences of Revision 8

# Dedicated Server ¶

#### Contents ¶
[TOC] ¶

## How does it work ¶
From Build 16 on, the main Widelands executable supports a terminal based "dedicated server modus". Following is a short description how this modus works: ¶

* To start Widelands in dedicated Modus, run Widelands in a terminal like this: _widelands --dedicated=<path to default map>_ ¶
* Server starts up, connects to the metaserver and opens a game with the default map. ¶
* The clients can now connect set up the server via chat commands and can start the game.
(NOTE in versions newer than build16, almost no chat commands are needed, players can just set up the server via their user interface - just as if they were the host)
* Once started the game runs until the last player left. Afterwards, the dedicated server closes the game, reconnects to the metaserver and reopens a new game with the default map. ¶

## How to compile ¶
_If you have any notes on how one can ease the compilation of Widelands as dedicated server without X server or similiar stuff, please add here_ ¶

## Start up commands ¶
There are some dedicated server specific start up commands, following list may not be complete, but should at least show the most important ones: ¶

* _--dedicated=<path to default map>_ : Mandatory to run the dedicated server. The map given in argument will be loaded at startup and at each restart (after end of a game). ¶

And general startup commands: ¶

* _--nickname=<hostname>_ : The name that will be used for login into the metaserver. ¶
* _--servername=<servername>_ : The name that will show up in the server list ¶
* _--autosave=<number>_ : number of seconds between each autosave ¶

### New commands introduced after build16 ¶
* _--dedicated_saving=<true/false>_ : if true(default), players can send the server a message to save the game under a specific name, to continue the game later on. ¶
* _--dedicated_password=<password>_ : The password, if the server is supposed to be password protected ¶
* _--dedicated_motd=<Message of the day>_: If you want to replace the default "this is a dedicated server write "@server help" to get help" message, write your message to this command. ¶
* _--dedicated_chat_file_path=path_ were Widelands should save the chat log: See chapter *Html output* below for a longer explanation. ¶
* _--dedicated_info_file_path=path_ were Widelands should save the chat log: See chapter *Html output* below for a longer explanation. ¶
* _--dedicated_log_file_path=path_ were Widelands should save the chat log: See chapter *Html output* below for a longer explanation. ¶

## Commands at runtime ¶
There are several commands you can give a dedicated server by sending a private message (e.g. "@dedicated start") ¶

### General ¶
These commands can be executed during set up time and in a running game. ¶

* _help_ : Shows all available commands (same as this paragraph). ¶
* _host_ : Runs a host command like "/announce <msg>", "/warn <user> <msg>" or "/kick <user> <reason>" ¶

#### New commands introduced after build16 ¶
The following commands were introduced after build16: ¶

* _pwd_ : can be used to send the password to the server, if the dedicated server is password protected. ¶

### During game setup ¶
The following commands are only valid for the build16 version of the dedicated server - after build16 they were removed, as the dedicated server so users can set up the server via their own launch game lobby interface, like if they were the hosting player. ¶

* _start_ : Starts the game ¶
* _ls_maps_ : Shows a list of available/selectable maps on the host. ¶
* _ls_saved_games_ : Shows a list of available/selectable saved games on the host. ¶
* _switch_map $_ : Switch to map $ (full name with .wmf) ¶
* _switch_save $_ : Switch to saved game $ (full name with .wgf) ¶
* _toggle_type #_ : Toggle type of player # ¶
* _toggle_tribe #_ : Toggle tribe of player # ¶
* _toggle_init #_ : Toggle initialization of player # ¶
* _toggle_win_con_ : Toggles the win condition ¶

### During playing ¶

* _save $:_ : Tries to save the game to save/$.wgf, if possible and if enabled on dedicated server (default) ¶

### Html output ¶
The dedicated server can be set up to write log files in HTML table formation style. This file can easily be integrated in dynamical generated webpages (like php, python or perl pages). ¶
To use this feature, you can set three commandline arguments, where each must have a value with a writeable path to a file where (depending on the variable) the general infos, the chat log or the general log is saved. If you do not set one, two or all of the variables the unset variable will just lead to not writing the matching log output - so e.g. if you want the general info, but not the chat and general log, just add the commandline argument for the info file... ¶

The output itself is: ¶

* in case of the info file a complete html table with tr, th und td ¶
* in case of the log and the chat file only the rows - so the table tags must be added for correct formation ¶

a css style file template for nicer formation of the tables can be found at ¶