Difference between revisions of "Game Box Creation - Control File Syntax"

From BOARD18 Project WIKI
Jump to navigation Jump to search
(added Game Box Creation Index)
(added links section)
 
(14 intermediate revisions by the same user not shown)
Line 31: Line 31:
   "tray": [
   "tray": [
    
    
  ],
  "links": [
   ]
   ]
}
}
Line 39: Line 42:
# Items within a object consist of two fields (name and value) separated by a colon
# Items within a object consist of two fields (name and value) separated by a colon
# The name field is always a string.
# The name field is always a string.
# The value field can be an array, another object, an integer or a string.
# The value field can be an array, another object, an integer, a boolean value or a string.
# All strings (both name and value) MUST be within double quotes.
# All strings (both name and value) MUST be within double quotes.
# All boolean values must be either true or false. '''Do not put boolean values in quotes.'''
# If an object or array contains more than one item, the items must be separated by commas.
# If an object or array contains more than one item, the items must be separated by commas.
# There must '''not''' be a comma after the last item in an object or array.
# There must '''not''' be a comma after the last item in an object or array.


=== Board===
=== Board===
The "board" item in the Game Box JSON file is an object which contains 7 simple items as shown in the example below:
The "board" item in the Game Box JSON file is an object which contains 6 simple items as shown in the example below:
<pre>
<pre>
   "board": {
   "board": {
     "imgLoc":"images/1826/Map.png",  
     "imgLoc":"images/1826-REP01/Map.png",  
     "imgHght":1249,
     "orientation":"P",
    "imgWdth":1418,  
     "xStart":0,  
     "xStart":0,  
     "xStep":50,  
     "xStep":50,  
Line 59: Line 62:


=== Market===
=== Market===
The "market" item in the Game Box JSON file is an object which contains 7 simple items as shown in the example below:
The "market" item in the Game Box JSON file is an object which contains 5 simple items as shown in the example below:
<pre>
<pre>
   "market": {
   "market": {
     "imgLoc":"images/1826/Stock.png",
     "imgLoc":"images/1826-REP01/Stock.png",  
    "imgHght":527,
    "imgWdth":1174,  
     "xStart":80,  
     "xStart":80,  
     "xStep":60,  
     "xStep":60,  
Line 100: Line 101:
     "tName":"Yellow Tiles",  
     "tName":"Yellow Tiles",  
     "imgLoc":"images/1826-REP01/Yellow1.png",  
     "imgLoc":"images/1826-REP01/Yellow1.png",  
     "xStart":89,  
     "xStart":20,  
     "xSize":70,  
     "xSize":100,  
     "xStep":89,  
     "xStep":120,  
     "yStart":79,  
     "yStart":20,  
     "ySize":71,  
     "ySize":116,  
     "yStep":79,  
     "yStep":130,  
     "tile":[ {
     "tile":[ {
     }, {
     }, {
Line 131: Line 132:


==== Board Token Tray ====
==== Board Token Tray ====
Board token trays have a "type" of "btok". These objects
Board token trays have a "type" of "btok".  
contain 9 simple items and one complex item named "token".  
There should be a "btok" object for every token sheet that will be available on the game board.
These objects contain 9 simple items and one complex item named "token".  
This structure is shown in the example below:  
This structure is shown in the example below:  
<pre>
<pre>
Line 139: Line 141:
     "tName":"Tokens",  
     "tName":"Tokens",  
     "imgLoc":"images/1826-REP01/Tokens.png",  
     "imgLoc":"images/1826-REP01/Tokens.png",  
     "xStart":5,  
     "xStart":10,  
     "xSize":50,  
     "xSize":30,  
     "xStep":60,  
     "xStep":40,  
     "yStart":5,  
     "yStart":10,  
     "ySize":50,  
     "ySize":30,  
     "yStep":56,  
     "yStep":40,  
     "token":[{
     "token":[{
     }, {
     }, {
Line 170: Line 172:


==== Market Token Tray ====
==== Market Token Tray ====
Market token trays have a "type" of "mtok". These objects
Market token trays have a "type" of "mtok".  
There should be a "mtok" object for every token sheet that will be available for the stock market.<br>
It is quite possible that the same tile sheet image could be referenced by both a "btok" and a "mtok" object.<br>
"mtok" objects
contain 9 simple items and one complex item named "token".  
contain 9 simple items and one complex item named "token".  
This structure is shown in the example below:  
This structure is shown in the example below:  
Line 178: Line 183:
     "tName":"Tokens",  
     "tName":"Tokens",  
     "imgLoc":"images/1826-REP01/Tokens.png",  
     "imgLoc":"images/1826-REP01/Tokens.png",  
     "xStart":5,  
     "xStart":10,  
     "xSize":50,  
     "xSize":30,  
     "xStep":60,  
     "xStep":40,  
     "yStart":5,  
     "yStart":10,  
     "ySize":50,  
     "ySize":30,  
     "yStep":56,  
     "yStep":40,  
     "token":[{
     "token":[{
     }, {
     }, {
Line 205: Line 210:
       "flip":false
       "flip":false
     }
     }
</pre>
<span style="color: Fuchsia">ALL market token trays must be at the end of the '''Trays''' object!</span>
=== Links===
The "links" item in the Game Box JSON file is an array each element of which contains 2 simple items as shown in the example below:
<pre>
  "links": [
    {
      "link_name":"Rules",
      "link_url":"https://drive.google.com/file/d/0B-wwptMMyHTAZHRRejFkYzd5OTQ"
    },
    {
      "link_name":"Rules Summary",
      "link_url":"https://docs.google.com/document/d/1yyvSMACgakSY0G4vW8vHf-kgMYIQ2miCwpNNoQr_ZFM"
    }
  ]
</pre>
</pre>

Latest revision as of 12:20, 26 August 2016

Game Box Creation edit

Control Tables

The control tables for a game box are implemented as one large JSON data structure. More information on JSON can be found here.

"Syntax – the form – is contrasted with semantics – the meaning." This is a quote from the WIKIPEDIA article on syntax.
This page discusses the syntax of a JSON control structure. In other words it discusses how to properly form the structure.
The Control Semantics page discusses the semantics of the game box. In other words it discusses what the fields mean.

JSON Game Box Control File Syntax

The JSON control file must be formatted exactly as described below. A JSON file resembles a Javascript object but has a far more restrictive format than Javascript.
It will be very helpfull to pass the finished JSON file through a JSON validator like JSON lint.

Overall Structure

The Game Box JSON file is a nested series of JSON objects and JSON arrays.
A JSON object is always contained in a pair of curly brackets { }
A JSON array is always contained in a pair of square brackets [ ]
An example of the overall structure of a Game Box JSON file is shown here:

{
  "bname":"1826", 
  "version":"REP01", 
  "author":"Rich Price",
  "board": {
    
  },
  "market": {

  },
  "tray": [
  
  ],
  "links": [
 
  ]
}

I would like to point out a number of things about the example above:

  1. Each blank line marks a point where details have been omitted.
  2. Items within a object consist of two fields (name and value) separated by a colon
  3. The name field is always a string.
  4. The value field can be an array, another object, an integer, a boolean value or a string.
  5. All strings (both name and value) MUST be within double quotes.
  6. All boolean values must be either true or false. Do not put boolean values in quotes.
  7. If an object or array contains more than one item, the items must be separated by commas.
  8. There must not be a comma after the last item in an object or array.

Board

The "board" item in the Game Box JSON file is an object which contains 6 simple items as shown in the example below:

  "board": {
    "imgLoc":"images/1826-REP01/Map.png", 
    "orientation":"P",
    "xStart":0, 
    "xStep":50, 
    "yStart":0, 
    "yStep":87
  },

Market

The "market" item in the Game Box JSON file is an object which contains 5 simple items as shown in the example below:

  "market": {
    "imgLoc":"images/1826-REP01/Stock.png", 
    "xStart":80, 
    "xStep":60, 
    "yStart":80, 
    "yStep":50
  },

Trays

The "tray" item in the Game Box JSON file is an array with a very complex structure. The "tray" array is an array that contains a variable number of objects:

  "tray": [ {

  }, {

  }, {
  
  }, {

  }, {

  }]

Each of these objects will be one of three possible types with each type having a different structure. The first item in each of these objects has a name of "type" and can be used to determine the structure of the object. The sections below will discuss the syntax of each of these object types.

Tile Tray

Tile tray objects have a "type" of "tile". These objects contain 9 simple items and one complex item named "tile". This structure is shown in the example below:

  {
    "type":"tile", 
    "tName":"Yellow Tiles", 
    "imgLoc":"images/1826-REP01/Yellow1.png", 
    "xStart":20, 
    "xSize":100, 
    "xStep":120, 
    "yStart":20, 
    "ySize":116, 
    "yStep":130, 
    "tile":[ {
    }, {

    }, {

    }, {

    }, {
    
    }]
  }

The "tile" item is an array that contains one element for each tile type [ie: column in the tile sheet]. Each such array element is an object with 2 simple items. These objects have the following format:

    {
      "dups":6, 
      "rots":6
    }

Board Token Tray

Board token trays have a "type" of "btok". There should be a "btok" object for every token sheet that will be available on the game board. These objects contain 9 simple items and one complex item named "token". This structure is shown in the example below:

  {
    "type":"btok", 
    "tName":"Tokens", 
    "imgLoc":"images/1826-REP01/Tokens.png", 
    "xStart":10, 
    "xSize":30, 
    "xStep":40, 
    "yStart":10, 
    "ySize":30, 
    "yStep":40, 
    "token":[{
    }, {

    }, {

    }, {

    }, {
    
    }]
  }

The "token" item is an array that contains one element for each token type [ie: row in the token sheet]. Each such array element is an object with 2 simple items. These objects have the following format:

 
    {
      "dups":5, 
      "flip":false
    }

Market Token Tray

Market token trays have a "type" of "mtok". There should be a "mtok" object for every token sheet that will be available for the stock market.
It is quite possible that the same tile sheet image could be referenced by both a "btok" and a "mtok" object.
"mtok" objects contain 9 simple items and one complex item named "token". This structure is shown in the example below:

  {
    "type":"mtok", 
    "tName":"Tokens", 
    "imgLoc":"images/1826-REP01/Tokens.png", 
    "xStart":10, 
    "xSize":30, 
    "xStep":40, 
    "yStart":10, 
    "ySize":30, 
    "yStep":40, 
    "token":[{
    }, {

    }, {

    }, {

    }, {
    
    }]
  }

The "token" item is an array that contains one element for each token type [ie: row in the token sheet]. Each such array element is an object with 1 simple item. These objects have the following format:

 
    {
      "flip":false
    }

ALL market token trays must be at the end of the Trays object!

Links

The "links" item in the Game Box JSON file is an array each element of which contains 2 simple items as shown in the example below:

  "links": [
    {
      "link_name":"Rules",
      "link_url":"https://drive.google.com/file/d/0B-wwptMMyHTAZHRRejFkYzd5OTQ"
    },
    {
      "link_name":"Rules Summary",
      "link_url":"https://docs.google.com/document/d/1yyvSMACgakSY0G4vW8vHf-kgMYIQ2miCwpNNoQr_ZFM"
    }
  ]