Skip to content

Story Script

唐谈 edited this page Jul 23, 2020 · 4 revisions

Story Scripts

We provide two types of story scripts which can be accessed under data/ directory.

XML

The story script is defined as an XML document that records story characters and their scenic interactions. We define two kinds of leaf nodes, namely <Location /> and <Character />, which are under the root node <Story />. The <Location /> node contains two necessary attributes: Name and Sessions. A Session refers to a scenic group that contains one or more Characters. A Character contains one necessary attributes: Name. The <Span /> nodes represent the Sessions, which are characterized by a three-tuple: Start (Time), End (Time), and Session (Id). The sample script (Redhat) is as follows:

NOTICE: session ID must be positive values.

<?xml version="1.0" encoding="utf-8" ?>
<Story>
  <Locations>
    <Location Name="Red cap's Home" Sessions="1, 2" />
    <Location Name="Forest" Sessions="2"></Location>
    <Location Name="Grandmother's Home" Sessions="3"></Location>
  </Locations>
  <Characters>
    <Character Name="Red cap">
      <Span Start="1" End="5" Session="1"></Span>
      <Span Start="5" End="18" Session="2"></Span>
      <Span Start="18" End="22" Session="3"></Span>
    </Character>
    <Character Name="Mother">
      <Span Start="1" End="25" Session="1"></Span>
    </Character>
    <Character Name="Grandmother">
      <Span Start="10" End="15" Session="3"></Span>
    </Character> 
    <Character Name="Wolf">
      <Span Start="6" End="11" Session="2"></Span>
      <Span Start="11" End="25" Session="3"></Span>
    </Character>
  </Characters>
</Story>

JSON

We also provide a simplified JSON format to be compatible with the XML document.

var storyJson = {
  "Story": {
    "Locations": {
      "Red cap's Home": [1],
      "Forest": [2],
      "Grandmother's Home": [3]
    },
    "Characters": {
      "Red cap": [
        { "Start": 1, "End": 5, "Session": 1 },
        { "Start": 5, "End": 6, "Session": 2 },
        { "Start": 6, "End": 10, "Session": 2 },
        { "Start": 10, "End": 11, "Session": 2 },
        { "Start": 11, "End": 15, "Session": 2 },
        { "Start": 15, "End": 18, "Session": 2 },
        { "Start": 18, "End": 22, "Session": 3 }
      ],
      "Mother": [
        { "Start": 1, "End": 5, "Session": 1 },
        { "Start": 5, "End": 6, "Session": 1 },
        { "Start": 6, "End": 10, "Session": 1 },
        { "Start": 10, "End": 11, "Session": 1 },
        { "Start": 11, "End": 15, "Session": 1 },
        { "Start": 15, "End": 18, "Session": 1 },
        { "Start": 18, "End": 22, "Session": 1 },
        { "Start": 22, "End": 25, "Session": 1 }
      ],
      "Grandmother": [
        { "Start": 10, "End": 11, "Session": 3 },
        { "Start": 11, "End": 15, "Session": 3 }
      ],
      "Wolf": [
        { "Start": 6, "End": 10, "Session": 2 },
        { "Start": 10, "End": 11, "Session": 2 },
        { "Start": 11, "End": 15, "Session": 3 },
        { "Start": 15, "End": 18, "Session": 3 },
        { "Start": 18, "End": 22, "Session": 3 },
        { "Start": 22, "End": 25, "Session": 3 }
      ]
    }
  }
}
Clone this wiki locally