# Topic: Multi-Player-game (Team-Go, Zen-Go, Rengo) # Description: Playing game with more than two players # # URL: http://www.dragongoserver.net/forum/read.php?forum=5&thread=9423#9423 # http://www.dragongoserver.net/forum/read.php?forum=6&thread=25718#25735 # Author: Jens-Uwe Gaspar, DGS 'juga' ## /* ## Dragon Go Server ## Copyright (C) 2001- Erik Ouchterlony, Jens-Uwe Gaspar ## ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU Affero General Public License as ## published by the Free Software Foundation, either version 3 of the ## License, or (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU Affero General Public License for more details. ## ## You should have received a copy of the GNU Affero General Public License ## along with this program. If not, see . ## */ Topics: 1. Introduction 2. Users Guide (how to play MP-game) a. Setup MP-game b. Info MP-game c. Play MP-game 3. Design, Classes and Files (implementation details) #-------- (1) Introduction ---------------------------------------------------- A "multi-player-game" (= MPG / MP-game) on DGS is an unrated game played by more than two unique players, alternatingly playing Black and White moves in two teams or in one team. The most common form of a MP-game is Rengo (or Pair-Go with one male and one female), both being special forms of Team-Go (2:2). There are three game-types to differ: Go (1:1) = standard 2-player game: Black vs White Team-Go (N:M) = two teams (Black vs White) with in sum more than 2 players, each team consists of 1-n players, with N + M > 2 Zen-Go (N) = one team with more than 2 players alternating Black & White play, N must be odd, with N > 2 The players must be unique per game, so no player can join a MP-game more than once. Also all players must have a valid rating to calculate average ratings of the teams. So, even though a MP-game is unrated, a users rating is required. Restrictions: * At maximum, 16 players can participate in a MP-game. * Tournaments are NOT supported with multi-player-games. * Double games are NOT supported for multi-player-games. * No team-accounts are supported (also see below "out of scope"). * Multi-player-games are not (always) shown in the normal game-lists like all/user/my finished/running/observed/observing games, because the games normally selected by the black- or white-player are only some of ALL the players within a multi-player-game. To compensate there is a special search to list multi-player-games. * Opponents-page is only supported for standard Go-games, but NOT for multi-player-games. * Multi-player-game can NOT be deleted, except on SETUP-status by game-master. * Conditional moves are NOT supported for multi-player-games. Out of Scope: This approach does not support team-accounts, though the team-data is preserved. This means, there is no explicit history of the accomplishments of teams. This would make no sense for Zen-Go, only for Team-Go. It is still possible to share an account, but there is no direct support by the server for it. This approach has been chosen, because of easier implementation avoiding all "team"-stuff (incl. ratings, team-handling). References: - http://senseis.xmp.net/?Rengo - http://senseis.xmp.net/?ZenGo #-------- (2) Users Guide ----------------------------------------------------- The "official rules" can be found on: http://senseis.xmp.net/?Rengo Normally during a MP-game it's not allowed to speak with each other about the games to play. The only practical allowed consultation on DGS is to ask if you can resign the game. And though it may be officially forbidden, such talkings can not be prevented anyway. However, it's considered to be much more fun in a MP-game NOT to speak about the moves in advance. #-------- (2a) Setup MP-game -------------------------------------------------- Described Use-cases: - Create new MP-game - Find users to play with with "game-players"-page - [I] Invite a specific (single) known player - [W] Add a game-offer in the waiting-room - Remove a joined player - Choose group-color and handicap for players - Choose group-order for players - Delete game - Start game * Create new MP-game: 1. Select "New multi-player-game" on the "new_game"-page 2. Specify game-settings: All these settings can NOT be changed later !! - ruleset, board-size - handicap-stone placement: regardless of handicapped game or not - game-type & game-players: Choose number of players and type of MP-game, e.g: 3 => Zen-Go with 3 players 5 => Zen-Go with 5 players 2:2 => Team-Go with 4 players, 2 vs 2, aka "Rengo" 1:3 => Team-Go with 4 players, 1 vs 3 - time-settings 3. Add game: This will create a new MP-game in SETUP-mode and forward you to the "game-players"-page to manage the MP-game. The player that created a MP-game is referred to as "game-master" and marked as such ("Master") on the "game-players"-page. * Additional Infos: - All MP-games you "manage" are listed on the status-page as long as they are in SETUP-mode, i.e. not started and running yet - The "userinfo"-page shows the current number of MP-games in setup/running-mode, but only for oneself or viewed by admins - For MP-games in SETUP-mode the game-page and game-info-page are not available - Game in SETUP-mode can only be deleted by game-master * Find users to play with with "game-players"-page: The game-master already joined the game taking a slot, and is marked as "master". There are two ways to find willing players for your MP-game in SETUP-mode: [I] - Invite a specific (single) known player [W] - Add a game-offer in the waiting-room Important Note: [I] and [W] can also be used at the same time, though if you want to start a MP-game with your usual buddy, first use [I], set up groups, then start with adding a game-offer in the waiting-room [W], so the users can see against whom they have to play and in which groups. Naturally you can also use only [I], if you know all the players that want to join your MP-game. * [I] Invite a specific (single) known player: 1. Show "game-players"-page and select "Invite" 2. Specify the user-id of the user you want to invite - the user is checked, errors are listed, e.g. user must have a rating - if the user is valid, a reservation is added and you will be forwarded to the "send-message"-page to inform the user about the invitation - A template-text is shown together with a preview. You may edit the text (or translate it) as you like, but be sure the main information about the invitation is included in some form. - Sending the message will forward the message to the invited user as normal message. 3. The invited user hopefully sees the message. When the invited user follow the link in the message and with that entering the "game-players"-page, he sees a reserved slot for his invitation. He will automatically be asked to join the MP-game. Then the invited user can: a) accept the invitation, or b) reject the invitation Additionally he might want to reply to your invitation-message with additional information or questions before or after acceptance/rejection. 4. When the user does not respond or as long as the invited user has not accepted/rejected the invitation, the game-master can: c) send a reminder: To send a reminder, from the "game-players"-page click on the "Invite"-image in the Actions-column for the specific reserved-slot of the invited user. Re-enter/edit some text and send the message. d) delete the reserved invitation: To delete the reservation, click on the "Trashcan"-image in the Actions-column for the invited user. You will be asked for confirmation of the deletion. * [W] Add a game-offer in the waiting-room: 1. Show "game-players"-page and select "Add to waiting-room" - Specify how many user-slots you may wish to offer in the waiting-room - If you want, specify some more game-settings for: rating-range, number of rated finished games, waiting-room comment - After "adding" a game-offer, a waiting-room entry is added. In the waiting-rooms 'Info'-page and in the Settings-column, a link to the corresponding "game-players"-page is shown - Only one waiting-room offer can be created at one time (easier implementation) restricted to one set of game-offer-settings. - To use a different game-offers, a former waiting-room game-offer has to be fulfilled or deleted first. - The waiting-room entry can be deleted at any time. The entry can be easily found via the "game-players"-page (maybe reload first). 2. When a user matches the game-offer criteria, he/she can join the MP-game-offer and will automatically be added in a free (reserved) waiting-room-slot. * Remove a joined player: A user may notify the game-master about to be removed from the MP-game, or the game-master no longer wants the participation of an already joined player (for whatever reason). In the latter case politeness dictates, that the game-master informs the to-be-removed player about this decision. To remove a joined player, click on the "Trashcan"-image in the Actions-column for the joined player you want to remove. You will be asked for confirmation of the removal. * Choose group-color and handicap for players: Notes: - Only the game-master can change the color and order of players. So the players have to discuss with the game-master about the player-settings. There are 5 different group-colors: BW = black or white B = black W = white G1 = group 1 G2 = group 2 The group-colors 'G1' and 'G2' can be useful to setup a certain team of starting players for Team-Go without setting a particular color yet. For Zen-Go only 'BW' makes sense, because there's only one team for all players. For Team-Go before the game can start, the colors for all players must be set to either 'B' or 'W'. In "Change Color & Handicap" (for Team-Go) the game-master has to choose the groups (setting color) and choosing the handicap-stones and komi for the MP-game. If 'B/W' or 'G1/G2' are chosen, the average-ratings of the players and handicap suggestions are shown, which may help in building teams. For Zen-Go only the handicap-stones and komi can be chosen. * Choose group-order for players: Notes: - Only the game-master can change the color and order of players. So the players have to discuss with the game-master about the player-settings. Before the game can be started, the playing order for each team must be specified. This can be done following the "Change order" on the "game-players"-page. * Delete game: While the game is on SETUP-status the game can be deleted, but only by the game-master. The deletion must be confirmed. The other players are notified about the deletion. * Start game: To start the game, the game-master should follow the link "Start game" on the "game-players"-page. Some errors might be shown, preventing that the game can be started. In that case, fix them first. 1. Before starting the game, the game-master may want to send a bulk-message to all game-players by selecting the link "Send message to all game-players". You may edit the message before sending it. After sending, a multi-receiver bulk-message is sent to all given game-players. This would be the last chance to back off from the game by telling the game-master, which is able to remove an already joined player. After this point, no player can be removed and the MP-game can NOT be deleted. 2. "Start game" finally starts the game and leaves the SETUP-mode for the MP-game. Every game-player will be notified with a server-message about the game-start. #-------- (2b) Info MP-game --------------------------------------------------- Described Use-cases: - Show MP-games in SETUP-mode -> see (1) Status-page, (2) Quick-Status-page - Show GameType -> see (1) Status-page, (2) Quick-Status-page, (3) Game-info-page - Show list of MP-games -> see (4) Games-List-page - Show info about MP-game in SETUP-mode or running/finished MP-game -> see next section [2c] * (1) Status-page "status.php": - GameType has been added for games to move in - section with MP-games in SETUP-mode has been added, visible for all participating game-players of MP-game * (2) Quick-Status-page "quick_status.php": - GameType has been added for games to move in - section with MP-games in SETUP-mode has been added, visible for all participating game-players of MP-game -> see "specs/quick-suite.txt" (chapter 4.QST) * (3) Game-Info-page "gameinfo.php": - GameType has been added showing game-type and game-player-count * (4) Games-List-page "show_games.php": - MP-games are shown on normal games-list, but only if current player appears as Black- or White-player; otherwise MP-game is not showing up. - MP-games on SETUP-status are NOT shown in games-lists, only running MP-games - The full list of running (=started) or finished MP-games, a checkbox with a graphical symbol (of a group of 2 people) has been added in the added GameType-column-header. If checked and searched, only the full list of ones MP-games (where you participate) is listed. The title shows this "mode" with an appended text "(multi-player-games only)". This choice may lead to confusion when searching for MP-games. However, the choice for this separate search was done, because otherwise an additional join to the GamePlayers-table would have been needed to be done for every query on the usual games-list, which already is quite big and may be time consuming. - (4a) To search for a user-specific MP-game (MY/USER running/finished games), the checkbox in the GameType-column-header needs to be checked. - (4b) To search for a user-unspecific MP-game (ALL running/finished games), use the selection-box of the GameType-column to find "Non-std" games. #-------- (2c) Play MP-game --------------------------------------------------- Described Use-cases: - Show info about MP-game -> see (1) Game-Players-page - Show game-comments of MP-game -> see (2) Game-comments-page - Download SGF of MP-game -> see (3) SGF-download - Play move, Resign, Delete, End MP-game -> see (4) Game-page, (5) Quick-suite * (1) Game-Players-page "game_players.php": - This page shows ... - most important game-information at top: - game-settings with GameType/GamePlayers, Size, Ruleset, Rated - handicap-settings with Komi, Handicap, Standard Handicap Placement - time-settings - group-ratings with average rating of participating players of groups/teams - all participating players in a MP-game, or free slots for players in SETUP-mode; shown in game-player-list with fields: - '#': playing order within group/team as numbers starting with 1. For a running game, ... - a Black/White-stone with a circle indicates the player to move - a right-directed double-arrow indicates the 2nd-next player to move - Color: playing color of player forming group/team - Player, Country, Rating, Last access: player-info - Flags: - Master: flag marking player as "game-master" in control of MP-game-management - Joined: master joined MP-game as player - Reserved[WR]: reserved player-slot for waiting-room-joining to MP-game - Reserved[INV]: reserved player-slot for invitation to join MP-game for specific player - Joined[WR|INV]: player joined per waiting-room or invitation - Actions: additional actions during setup and playing - Send message : send message to player - Send invitation message : send (reminder) for invited player - Delete reservation : delete slot-reservation for invitation * (2) Game-comments-page "game_comments.php": - For MP-games the game-comments-page additional shows the player, that made the move/comment. * (3) SGF-Download "sgf.php": - see also chapter (4.SGF) in "specs/quick_suite.txt" - For a MP-game the downloaded SGF contains additional information: - the player who moved is added in each game-node in format "name (user-id)" even if there is no move-message. This behaviour can be deactivated with a new option "mpg=1". - the user-IDs (space-separated) of the teams is added in SGF-properties WT/BT - Start/End-rating represents the average group-rating of the MP-game - Game Players (Order. Color: Name (Handle), Current Rating) is added in SGF-game-information. * (4) Game-page "game.php": - MP-game is shown on status-page of player which is next to play. - Current player of MP-game is shown with a black/white-stone on the Game-Players-page. - Playing in a MP-game by submitting a move, changes also the 2nd-next player to move replacing the current player. - Resigning a MP-game: By official rules in Rengo, the current player wanting to resign, is inclined to ask his team-partner if it is ok with the phrase "May I resign?", on which the partner may answer with only "Yes" or "No". DGS is not enforcing this rule, but adds a note with a link to send a bulk-message to the other players of the same group/team to ask for resignation. But this lies in the discretion of the player to move. The link leads to showing a preview of a bulk-message to the correct partner-players with a link to the game. For Rengo it's pretty clear (only one answer), but for other MP-games with more than two partners in the same team, there might appear both answers (Yes & No). The interpretation of that is not enforced by DGS, which would be too complicated and unflexible bound to a specific ruling, and therefore left to decide for the one who asked about resignation. - Deleting a MP-game is NOT allowed at the moment. Reasoning: One player shouldn't "destroy" a game, that all agreed upon. If the player does not want to play, he should say so before the game is started or refuse from joining in the first place. Maybe this policy will be changed later. If a player wants to be removed from the MP-game it's only possible while the game has not been started in SETUP-mode. The player should send a private message to the game-master for removal, which the game-master can do on the Game-Players-page (see also section (2a)). - Ending a game is done by the player to move in a normal way. Normally one could expect that also before ending a MP-game, the player to move asks his team-partners if that is ok or if the game should continue. However, this was not done out of simplicity reasons. It may be still added with another bulk-message to ask for that. * (5) Quick-suite "quick_do.php" and "quick_play.php": - see "specs/quick_suite.txt" for info about "MP-game" or "multi-player-game" #-------- (3) Design, Classes and Files --------------------------------------- * Table-Design: - needed to store - game-type (Go/Zen-Go/Team-Go) and number of players - count of: MP-games on SETUP-status, running MP-games * Games-table: added fields 'GameType' & 'GamePlayers', for description see "specs/db/table-Games.txt" * GamePlayers-table: for description see "specs/db/table-Games.txt" * Players-table: added field 'GamesMPG' for description see "specs/db/table-Players.txt" * Waitingroom-table: added fields 'GameType' & 'GamePlayers', for description see "specs/db/table-Waitingroom.txt" and "specs/db/table-Games.txt" * Design behind playing MP-games: - The most important data is the field 'Games.Moves', which is increased with every move and therefore is used in combination with the 'Handicap/GamePlayers'-fields and 'GamePlayers'-table to know which player is next to move in a MP-game. The player to move is calculated by "MultiPlayerGame::calc_game_player_for_move(..)" and the returned values have a direct correspondence with the players saved in the "GamePlayers"-table. So while moving the Black/White_ID in the "Games"-table is overwritten with the next and 2nd-next-player to move while the game goes along. - Official Rengo-rules requires, that the players of one team don't talk with one another, except when asking for resignation (or if ok to end a game). This can NOT be enforced on DGS anyway, so it is not prevented. But in order to some form of easier talking between the players with the game-master, a way to send bulk-messages has been added. Normally this should be restricted to ask if anybody is ready to start the MP-game or to allow asking the other team-members if resignation is ok. However, this lies in the discretion of the player to move, if he/she asks or not (a note with a link serves as a reminder to do so), but this is not enforced. Additionally the bulk-message feature can also be used for other purposes, though it is restricted for the initial sending of a message; it can not be used in a way similar to a "Reply-to-all" known from sending an email. - Playing MP-games is also supported via the quick-do- and quick-play-suite. * Timing and vacation-handling for multi-player-game: - the choice not supporting real team-accounts allowed to use the existing time-handling for the black- and white-player of a game. That means, that while playing a MP-game, the Black and White-player are altered to reflect the current player to move. With this, the time-handling of the black/white-player is naturally used. - some back-draws are, that time-zone-changes could be used to cheat on time for teams with more than one player. This is not prevented as MP-games are meant for fun anyway and are always unrated. Also a player on vacation can play normally. So one problem is, that a team may consist of 1..N players against a different number of opponents, so the bigger team has the advantage of having more "free" time by the possibility of having more vacation. However, a MP-game is just for fun and unrated, so no special measures are taken to prevent vacation-abuse. * Classes / Files: * "game_players.php" - page dedicated to setup/manage MP-games * class MultiPlayerGame - utility class to handle/support MP-games * class GamePlayer - Class to model 'GamePlayers'-entity * class GameHelper - general utility class to handle games #-------- Related features ------------------------------------- * Q: is Admin functionality needed to exchange players (e.g. if player "escaped") ? * Q: stats about played TeamGo-games ? development of "teams" (regarding team-accounts) ? * NTH: kind of "chat" between players could be useful (message system, related to game); Nice would be additional "public" game-chat (similar to wanted review-comments): any number at any time by everyone, but restricted to players to be "public" * NTH: Game-properties for MP-games: allow player-skipping: by game-master, by admin; if on vacation, if requested