Skip to content
Renato Pereira edited this page Oct 26, 2014 · 4 revisions

JSON Format For BTs in Behavior3JS

Tree Specification

Tree items:

  • title: the tree title, useful for identification on editor and debug.
  • description: the tree description, useful for identification on editor and debug.
  • root: the root ID (preferably a string), must be a unique identifier.
  • display:
    • camera_x: position X of the camera in canvas.
    • camera_y: position Y of the camera in canvas.
    • camera_z: zoom factor of the camera in canvas.
    • x: position X of the root block in the canvas.
    • y: position Y of the root block in the canvas.
  • properties: object with <key, value> pairs.
  • nodes: object with <key, value> pairs, where key must be the node ID, and value must be the node specification.

Example:

{
    "title"       : <String>,
    "description" : <String>,
    "root"        : <String(ID)>,
    "display"     : {
        "camera_x" : <Float>,
        "camera_y" : <Float>,
        "camera_z" : <Float>,
        "x"        : <Float>,
        "y"        : <Float>
    }
    "properties"  : {
        <String> : <String or Number>,
        ...
    },
    "nodes"       : {
        <String(ID)>: <Node Specification>,
        ...
    }
}

Node Specification

Node items:

  • id: the node ID (preferably a string), must be a unique identifier.
  • title: the node title, useful for identification on editor and debug.
  • description: the node description, useful for identification on editor and debug.
  • display:
    • x: position X of the block in the canvas.
    • y: position Y of the block in the canvas.
  • children: an array of node IDs, only for composite nodes.
  • child: a node ID, only for decorator nodes.
  • parameters: object with <key, value> pairs. This is needed to specify obligatory parameters when loading trees from JSON.
  • properties: object with <key, value> pairs.

Example:

{
    "id"          : <String(ID)>,
    "name"        : <String>,
    "title"       : <String>,
    "description" : <String>,
    "children"    : [<String(ID)>, ...], // Only for composites
    "child"       : <String(ID)>, // Only for decorators
    "display"     : {
        "x" : <Float>,
        "y" : <Float>,
    },
    "parameters"  : {
        <String> : <String or Number>,
        ...
    },
    "properties"  : {
        <String> : <String or Number>,
        ...
    }
}

Pages:

Core Guide:

  • [01. Introduction](Core 01 Introduction)
  • [02. Downloading and Setting Up](Core 02 Downloading and Setting Up)
  • [03. General Guidelines](Core 03 General Guidelines)
  • [04. Creating Custom Nodes](Core 04 Creating Custom Nodes)
  • [05. Creating and Using Trees](Core 05 Creating and Using Trees)

Editor Guide:

  • [01. Interface](Editor 01 Interface)
  • [02. Adding and Connecting](Editor 02 Adding and Connecting)
  • [03. Selecting and Moving](Editor 03 Selecting and Moving)
  • [04. Node Properties](Editor 04 Node Properties)
  • [05. Custom Nodes](Editor 05 Custom Nodes)
  • [06. Importing and Exporting using JSON](Editor 06 Importing and Exporting using JSON)
Clone this wiki locally