4 A game spec defines the starting layout for a game: **which pieces start
5 on the table, and where**.
7 It also defines some ancillary information about the game and its
8 layout. It does not contain information about the players.
9 Players join a game as permitted by the game access control list,
10 which is specified in a *table specification* (sadly not currently
11 properly documented, but look at the Rustdoc for ``TableSpec``).
16 A game spec is a TOML file. It has the following entries at the top
19 * ``table_size`` [array of 2 numbers]. Size of the table playing
20 area, in Otter internal units. The default is ``[300,200]``.
22 * ``table_colour`` [string: colour]. Table backdrop colour.
23 Only certain colour syntaxes are supported. Default: ``green``.
25 * ``pcaliases``: [table, values are Piece spec table]. Piece alias
26 table. When a piece is being loaded, an alias xxxx grep for where
29 * ``pieces``: Array of `Piece Specs`_. Defines the initial pieces
30 and their layout. Each entry is a piece spec sub-table.
35 A piece spec is a table defining one or more pieces. When part of a
36 game spec, it appears as an entry in the top-level ``pieces`` array,
37 and defines the location(s) on the table to place the pieces, too.
39 There is a mandatory key ``type``, a string. This determines how the
40 rest of the table is intesrpreted.
45 * ``type``: Piece type or piece spec type. One of the types listed
46 in the sections below. [string, enum, mandatory]
48 * ``pos``:Position, in game coordinates, of
49 the centre of the piece. The origin is at the top left.
50 [2-element array, default ``[20,20]``]
52 * `count` [number, default=1]. Place multiple copies of this piece.
54 * `posd` [2-element array]. Position delta. When a spec
55 specifies multiple pieces, each successive piece will be shifted by
56 this amount. Default: `[5,5]`.
58 * `face` [number, default=0]. Initial face to show (ie, "which way
59 up" the piece starts). The default face for most pieces is the
60 front, and this is usually a good choice.
62 * `pinned` [boolean]. Whether the piece is pinned to the table.
63 (Players can pin and unpin pieces during the game; this is the
66 * `angle` [number 0..7]. Initial rotation of the piece. The
67 specified value is multiplied by 45 degrees, increasing values
68 rotating anticlockwise.
74 A single shape from a piece library.
76 * `lib` [string, mandatory]: The library name.
78 * `item` [string, mandatory]: The item name within that library.
84 Multiple shapes from a piece library. Cannot be used with the `count`
87 * `lib` [string, mandatory]: The library name.
89 * `items` [array of strings, mandatory]: The item names.
91 * `prefix`, `suffix` [strings]: Prepended and appended to each
92 entry in `items`. Useful for abbreviating.
98 A chess clock. Additional parameters:
100 * `time` [number, in seconds; mandatory]. Initial time for each
103 * `per_move` [number, in seconds]. Time to add per moove.
105 (The clock settings cannot be reconfigured via the game UI.)
111 A pickup or play deck. This can occult the pieces (eg, cards) you put
112 on it, shuffling them and hiding their identity.
114 Requires `face` and `shape`. Only `shape.type="Rect"` is supported.
116 Honours `edges`, `edge_width`.
118 Honours `label`, displaying the number of of pieces in (on) this deck.
124 A player hand. When active, arranges for only that player to be able
125 tos see the contents. The other players see the occulted view (eg,
128 Requires `colour` and `shape`. Only `shape.type="Rect"` is supported.
130 Honours `edge`, `edge_width`.
132 Honours `label`, displaying the player whose hand this is, when
139 A simple label which can display a player name.
141 Requires `colour` and `shape`. Only `shape.type="Rect"` is supported.
143 Honours `edge`, `edge_width`.
151 A plain rectangular piece.
153 * `size` [array of 1 or 2 numbers]: Size and shape.
157 Honours `itemname`, `edges` and `edge_width`.
163 A plain circular piece.
165 * `diam` [number, mandatory].
169 Honours `itemname`, `edges` and `edge_width`.
175 * `colour` [string, colour]. The fill colour For a piece which
176 supports only one face.
178 * `faces` [array of string(s), colours, mandatory]. The main fill
181 * `edge` [string, colour]. The edge colour to draw for a piece with
182 supports only one face. Default is not to draw edges.
184 * `edges` [array of string(s), colours]. The colours of edges to
185 draw. Default is not to draw edges. Must either be a 1-element
186 array, or as long as `faces` (specifying a different edge colour
189 * `edge_width` [number]. Default is 0.2 if `edge` or `edges` is
192 * `label` [table]. Displays a label with informationa about the
193 in-game state. There are two sub-keys:
194 * `colour` [string, defaults to the edge colour].
195 * `place` [string]: One of `BottomLeft` (default), `TopLeft`,
196 `BottomLeftOutside`, `TopLeftOutside`.
198 * `shape` [table]. The shape of a piece. There are two sub-keys:
199 * `type`, [string, `Circle` or `Rect` ].
200 * Either `size` [array of 1 or 2 numbers] (for a square
201 or rectangle) or `diam` [number] (for a circle).
203 * `itemname` [string]. Used when other parts of the game want to