Difference between revisions of "MultiplayerServerWML"

From The Battle for Wesnoth Wiki
m (add new game_id tag if a player joins a game)
(Game creation)
Line 99: Line 99:
 
** ''observe'' Join the game as an observer.
 
** ''observe'' Join the game as an observer.
  
* '''[leave_game]'''
+
* '''[leave_game]''' sent by the client when it leaves a game; sent by the server to make a client leave a game
 +
 
 +
* '''[next_scenario]''' sent by the host followed by the scenario data to advance to the next scenario
  
 
== Error messages ==
 
== Error messages ==

Revision as of 03:45, 14 October 2007

Multiplayer Server WML

This page describes the WML used to communicate with the multiplayer server (wesnothd).

The login procedure

  • server request (optional)
    • [version]
  • client response
    • [version]
      • version The client's version string.
  • server request
    • [mustlogin]
  • client response
    • [login]
      • username The username the client would like to have.
  • server response
    • [join_lobby]
  • server response
    • [gamelist]
      • [game] (repeated)
        • id A unique id of the game.
        • name The title of the game.
        • mp_scenario The id of the scenario.
        • mp_era The id of the used era.
        • mp_use_map_settings Does the game use the map settings specified in the scenario.
        • mp_fog Does the game use fog.
        • mp_shroud Does the game use shroud.
        • mp_village_gold The number of gold per village.
        • experience_modifier The experience setting.
        • mp_countdown Does the game use a timer.
        • mp_countdown_reservoir_time Upper limit of the possibly available time.
        • mp_countdown_init_time Initial time.
        • mp_countdown_action_bonus Time bonus per action.
        • mp_countdown_turn_bonus Time bonus per turn.
        • map_data The map data.
        • hash The hash value of the map_data.
        • observer Are observers allowed or not.
        • human_sides The number of sides played by humans.
        • slots The number of vacant/max slots.
        • turn The current turn/max turn.
    • [user] (repeated)
      • name The username of the player.
      • game_id The ID of the game the player is in (version 1.3.7+svn).
      • location The name of the game the player is in.
      • available "yes" if the player is in the lobby; "no" if in a game.

Many of the keys under [game] are described more indepth on the ScenarioWML page.

Updating the lobby state

  • server message - basically a diff from two [gamelist]s; the keys listed are the ones that actually occure in practice
    • [gamelist_diff]
      • index The index of a user.
      • [insert_child] A new user logged on.
        • [user]
          • name The name of the user.
          • available "yes"
        • [delete_child] A user logged off.
      • [change_child]
        • [user]
          • [insert] A user joined/left a game.
            • available "yes" when the user left a game. "no" when the user joined a game
            • location The name of the game the user joined.
          • [delete]
            • location "x" when a game was left.
        • [gamelist]
          • index Index of the game in question.
          • [insert_child] A game started.
            • [game] All the usual keys of [game] possible, see above.
          • [delete_child] A game ended.
            • [game]
          • [change_child] Something changed in a game.
            • [game]
              • [insert]
                • slots The number of free slots in the form: free/max slots
                • turn The turn number in the form: current turn/max turns
              • [delete]
                • map "x" comes with every turn or slots change for games with shroud
                • mp_scenario "x" comes with turn and slots changes for games with no scenario id
  • server message - players joining([observer_quit])/quitting([observer] a game
    • [observer] or [observer_quit]
      • name Username of the player/observer.

Game creation

To create a game the client sends:

  • [create_game]
    • name The title of the game.
    • human_sides The number of sides played by humans.

followed by a message with the scenario options as under [game] (see above) plus the scenario data ([time], [era], [side], etc. see ScenarioWML)

  • [join]
    • id The id of the game.
    • observe Join the game as an observer.
  • [leave_game] sent by the client when it leaves a game; sent by the server to make a client leave a game
  • [next_scenario] sent by the host followed by the scenario data to advance to the next scenario

Error messages

  • [error]
    • message The error message.

Lobby chat

  • server message
    • [message]
      • sender The sender of the message.
      • message The message itself.
    • [whisper]
      • receiver The receiver of the whisper
      • sender The sender of the whisper.
      • message The message itself.
  • client message
    • [message]
      • sender (optional) The sender of the message.
      • message The message itself.
    • [whisper]
      • receiver The receiver of the whisper
      • sender (optional) The sender of the whisper.
      • message The message itself.

Administrative commands