Design Document Game Boxes
BOARD18 can be used to play any 18xx style game for which a game box exists. A game box consists of the graphics files and control tables that describe the game board, the stock market and the various playing pieces. A game box is built using a graphics editor [such as GIMP] and a text editor. The files created with these tools can then be uploaded to the BOARD18 server. This upload should eventually be accomplished via a built-in and automatic process.
In order to coordinate the size of the various graphics files, so that things fit together, BOARD18 will use the following sizing standards. Note that some of the Control Table settings can be used to resize the uploaded graphics to meet these standards.
Hex Tile Standard
All tiles should be sized as shown in the diagram to the right when displayed by BOARD18. If the Tile Sheet control values are correct, then this resizing should be done automatically.
All circular tokens should be sized to have a diameter of 30 pix. All Square tokens should be sized to have a width and height of 30 pix. Once again, resizing via the control values should be supported.
The game board graphic is the background of the BOARD18 board page. As with tiles and tokens, scaling can be controlled by the Game Board control values .
frameThe stock market graphic is the background of the BOARD18 stock market page. Scaling can be controlled by the Stock Market control values.
Hex tile graphic images are grouped onto “tile sheets” containing rows and columns of evenly spaced tiles. The illustration to the right shows a part of such a tile sheet. Each column is a different tile and each row in the column is a 60° rotation of the tile. There can be from one to six rows for each tile. [[Image:]]
Token graphic images are grouped onto “token sheets” containing rows and columns of evenly spaced tokens. The illustration to the right shows a part of such a token sheet. Each sheet will contain one or two columns of circular or square tokens. Each row in the column is a different token. If there are two columns then the image in the first shows the front side of the token and the second shows the back side.
In addition to the graphics files described in the above section, a BOARD18 game box also consists of a number of control structures. The actual game status also consists of control structures. These are formatted as two complex JSON data structures: one for the game box and one for the game session. Each of these structures is created and maintained as a single JSON file. And each is stored as a text field in the MYSQL database.
Appendix A contains a listing of the test game box file that is being used in the development of the BOARD18 application. [It is actually a game box for 1826.] The game box file is common to all game sessions and it is never modified by BOARD18.
Appendix B contains a listing of the initial game session file that is created by the the new game function of the BOARD18 application. This JSON structure will be constantly modified by BOARD18.
Do to the complexity of these structures, we will discuss them in detail in the following sub sections..
The JSON Box Data Structure
Th first part of the game box JSON file contains data structures that define the file itself, the game board and the stock market board. The bname, version and author keys are used to identify the JSON file itself. The board and market keys head complex structures that define the game map and the stock market. They each contain fields that define the location and size of the graphic and positioning of its grid.
The JSON Tray Data Structure
The data structure in the game box JSON file with the key of tray defines the tile and token sheets in the game box. It is an array of complex data structures each of which describes a tile or token sheet. There are actually three different types of sheets on a tray. The type key defines the type for each sheet in the array.
The Tile Sheet Type
The sheets with a type value of tile are tile sheets. The tName key defines the menu name for the sheet. The imgLoc key defines the location of the tile sheet image file. The next group of keys define the values that locate the actual tokens on the tile sheet image file.
Finally the tile key defines an array of values [one for each tile] that specify the the number of duplicates of that tile in the game box and the number of rotations that exist for each tile.
The Board Token Sheet Type
The sheets with a type value of btok are board token sheets. The first part of a board token sheet is the same as a tile sheet. But there is no tile key. Instead a token key defines an array of values [one for each token] that specify the the number of duplicates of that token in the game box and whether the token can be flipped. [i.e.: does it have a back side.]
The Market Token Sheet Type
The sheets with a type value of mtok are market token sheets. A market token sheet is the same as a board token sheet with one exception. The token key defines an array of values [one for each token] that specify only whether the token can be flipped.
The JSON Game Session Data Structure
Each game session has its own JSON data structure. The gname, and boxID keys are used to identify the JSON Game Session and specify the game box that the game session uses. These are followed by four array structures.
The array with the key of brdTls tracks the tiles that have been placed on the board. The array with the key of brdTks tracks the tokens that have been placed on the board. The array with the key of mktTks tracks the tokens that have been placed on the stock market. And the array with the key of trayCounts tracks the number of remaining tiles and tokens available to be played on the game board.