It is quite common to play games over IM networks.
Since Tic-tac-toe is a well-known and simple game,
it's a good example for a server-based game protocol.
This document addresses the requirements for a game protocol as defined by Multi-User GamingXEP-xxxx: Multi-User Gaming <http://pidgin-games.sourceforge.net/xep/multi-user_gaming.html>..
In particular this consists of:
game roles
match state
turns
match configuration
conditions for interrupting and terminating a match
The extensions needed to implement these requirements are qualified by the 'http://jabber.org/protocol/mug/tictactoe' namespace.
An entity implementing this protocol MUST also support Multi-User GamingXEP-xxxx: Multi-User Gaming <http://pidgin-games.sourceforge.net/xep/multi-user_gaming.html>. and answer to disco requests accordingly
including both the Multi-User Gaming and the game <feature/> elements in the response.
...
...
]]>
A Tic-tac-toe game uses two game roles, "x" and "o".
Both roles have to be assigned to exactly one player to start a match.
If one role gets unassigned or a player gets unavailable the match has to be paused.
A service SHOULD offer a configuration form with the following options:
starting role ("mug/tictactoe#config_first")
size of the board ("mug/tictactoe#config_rows" and "mug/tictactoe#config_cols")
the number of marks in a row needed to win ("mug/tictactoe#config_first")
An implementation MUST be able to handle the a board with three cols and rows
and three respective marks to win.
Everything beyond that is OPTIONAL.
Tic-tac-toe Room
...
Configuration for Tic-tac-toe
Below you can see the default configuration.
To accept the default configuration, click OK.
To select a different configuration, please complete this form.
http://jabber.org/protocol/mug/tictactoe#tictactoeconfig333x
]]>
Submitting a strike option value bigger than the number of rows or columns SHOULD
result in <not-acceptable/> error.
The state in a Tic-tac-toe match represents the match configuration,
the player who makes the next turn
and the current state of the board. Every state is distributed to all occupants.
inactive333x
]]>
After a valid turn, the state gets updated with the corresponding mark.
active333oxoxox
]]>
The match is considered terminated when the board is full or
when one player reaches the number of respective marks as defined by the strike option.
After termination the service broadcasts the final state including either a <draw>
or <won> (including a game role) element to indicate the resulting score
and the initial state of the next round.
inactive333ox
]]>
During the game, players change in turn, each of them MUST send only one move at a time.
It MUST possess these attributes:
Name
Type
Description
'id'
REQUIRED
The number of the move. First move is 1.
'row'
REQUIRED
The horizontal position of the mark.
'col'
REQUIRED
The vertical position of the mark.
]]>
The author is not aware of any security issues introduced by this protocol extension.
This document requires no interaction with the Internet Assigned Numbers Authority (IANA)The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>..
The XMPP RegistrarThe XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <https://xmpp.org/registrar/>. shall include 'http://jabber.org/protocol/mug/tictactoe' in its registry of protocols.