source: trunk/game/dialogue_schema.yaml @ 684

Revision 668, 1.6 KB checked in by technomage, 9 years ago (diff)

Ticket #269: Patch by Technomage.

  • Working prototype of the redesigned DialogueEngine? for the upcoming Techdemo2 release; major redesign of the existing DialogueEngine? and YAML dialogue file syntax.
  • Moved the redesigned DialogueEngine? class to the more descriptive dialogueengine.py module; the DialogueEngine? is now a singleton object and provides all functionality through class methods and attributes, and thus should not be instantiated
  • Abstracted the data structures used to store dialogue data away from the YAML data structures; the relevant classes are stored in the dialogue.py module
  • Abstracted the dialogue commands/actions from the DialogueEngine? code to make modifications and maintenance of dialogue logic easier; the relevant classes are stored in the dialogueactions.py module
  • The PyYAML loader has been replaced with a more robust YamlDialogueParser? class (see the dialogueparsers.py module) that interfaces with the new dialogue data structure classes and supports the new YAML dialogue file syntax; an OldYamlDialogueParser? class is provided to support reading the old Techdemo1 syntax
  • Removed the existing dialogue validator; runtime dialogue validation is not yet implemented
  • Added the convert_dialogue script, which converts dialogue files in the old Techdemo1 format to the new format; all existing dialogue files have been converted to work with the new parser
  • Added two support modules for the new classes and script: ordereddict.py, which provides a Python 2.7-like OrderedDict? class for Python versions 2.4-2.6; optionparser.py, which is a simplified command-line option parser for writing scripts as an alternative to argparse and optparse
  • Updated the dialogue_demo.py script to work with the new DialogueEngine?
  • fixes[s:trac, t:269]
  • Property svn:eol-style set to native
Line 
1---
2# A schema to validate dialogue scripts
3# to validate a script run:
4#
5# kwalify -lf dialogue-schema.yaml dialogue.yaml
6
7name: Dialogue
8type: map
9mapping:
10    "NPC_NAME":
11        type: str
12        required: yes
13    "AVATAR_PATH":
14        type: str
15        required: yes
16        pattern: "/^((\\.\\./|[a-zA-Z0-9_/\\-\\\\])*\\.[a-zA-Z0-9]+)$/"
17    "START_SECTION":
18        type: str
19        required: yes
20        pattern: &section_id_regex "/[a-z][a-z_]*/"
21    "SECTIONS":
22        type: seq
23        required: yes
24        sequence:
25            - type: map
26              mapping:
27                "ID":
28                    type: str
29                    required: yes
30                    pattern: *section_id_regex
31                "SAY":
32                    type: str
33                    required: yes
34                   
35                "ACTIONS":
36                    &actions
37                    type: seq
38                    required: no
39                    sequence:
40                        - type: any
41                          required: no
42                "RESPONSES":
43                    type: seq
44                    required: yes
45                    sequence:
46                        - type: map
47                          required: no
48                          mapping:
49                            "REPLY":
50                                type: str
51                                required: yes
52                            "ACTIONS":
53                                *actions
54                            "CONDITION":
55                                type: str
56                                required: no
Note: See TracBrowser for help on using the repository browser.