[Nell] First attempt at a narrative model file

Chris Ball cjb at laptop.org
Thu Jan 26 00:45:27 EST 2012


Hi,

Here's a simple JSON file representing a narrative.  I don't have a
viewer/interpreter for it yet, and I can think of many things I want
to change about it, but I should post it so we can talk about it.

One of the things I'm trying to work out is whether it's necessary to
embed arbitrary code in one particular language inside the model file
(like Curveship's fiction files, written in Python) or whether the
system's going to be expressive enough if it just has a simple boolean
logic system like Wide Ruled's, or if there's a middle ground.

---

story = {
    "narrative_model_version": "1",
    
    "metadata": {
        "author": "C. Scott Ananian", 
        "title": "Nell's Opening Act",
    },

    "actors": [
        {
            # The user -- model details come from Avatar Services.
            "id": "user",
            "type": "character.user",
        },
        {
            # Nell -- model details come from Avatar Services.
            "id": "nell",
            "type": "character.nell", 
        }, 
        {
            # One of the user's friends -- Avatar Services chooses one
            # to substitute in, perhaps by finding the friend most
            # skilled at music.
            "id": "musician",
            "type": "character.friend", 
            "skills": [
                "skill.music",
            ],
        }, 
        {
            # Avatar Services doesn't know anything about this actor,
            # so we specify details like gender and 3D model.
            "id": "raven",
            "name": "Raven",
            "gender": "male",
            "type": "character.animal",
            "model": "raven.mdl",
        },
    ],

    "scenes": [
        {
            "id": "top-of-tower", 
            "exits": [
                {
                    "downstairs": "scenes.gate",
                }
            ],
            "description": "A castle tower, on an island.  Seagulls can be heard faintly, and surf crashing on the rocks below.",
            "objects": "actors.nell",
        }, 
        {
            "id": "gate", 
            "exits": [
                {
                    "upstairs": "top-of-tower",
                }
            ], 
            "description": "The downstairs of the tower is a small room with a locked gate and stones arranged on the floor.",
            "objects": "actors.nell",            
        },
    ],

    "actions": [
        {
            "id": "1",
            "room": "scenes.top-of-tower",
            "prerequisites": "None",
            "subject": "actors.nell",
            "verb": "look",
            "object": "user",
            "text": "(s/1) looks around sharply at (o/2) as (o/2) approach",
        },
        {
            "id": "2",
            "prerequisites": "1",
            "subject": "actor.nell",
            "verb": "speak",
            "object": "actor.you",
            "text": "Hello...",
        },
        {
            "id": "3",
            "prerequisites": "2",
            "subject": "actors.nell",
            "verb": "speak",
            "object": "actor.you",
            "text": "Can you help me?  Something--- I'm not sure what's going on.  But I want to go home.",
        },
        {
            "id": "4",
            "prerequisites": "3",
            "subject": "actors.user",
            "verb": "look",
            "text": "(s/2) (v/are) in a castle tower, on an island.  Seagulls can be heard faintly, and surf crashing on the rocks below."
        },
        {
            "id": "5",
            "prerequisites": "4",
            "subject": "actors.nell",
            "verb": "speak",
            "object": "actor.you",
            "text": "This is my country.  But it's not my home.  My mother and father and brother and sister -- they are not here.  I don't know what happened, exactly.  But I'm stuck here.  There's no one in this castle, and the gate downstairs is locked.  Maybe you can help me unlock it?"
        },
        {
            "id": "6",
            "prerequisites": "scenes.gate",
            "subject": "actors.nell",
            "verb": "speak",
            "object": "actor.you",
            "text": "The lock seems to be magic: it plays a tune when you touch it.  And the floor in front of the gate is enchanted as well -- it makes music when you step on certain stones.  I think that if we could play the same song as the lock makes, the gate would open for us.  Can you help me?  Oh -- my name is Nell.",
        },
        {
            "id": "7",
            "action_type": "checkpoint",
            "text": "Nell asks you to help unlock the gate by playing a song",
        },
        {
            "id": "8",
            "prerequisites": "7",
            "evoke": "org.laptop.MusicMaker",
            "journal_entry": "MusicMaker/Nell/1/unlock_tower.mus",
            "text": "Help Nell open the lock by playing the lock's song",
            "success": "9",
            "failure": "10",
        },
        {
            "id": "9",
            "subject": "actor.nell",
            "verb": "speak",
            "object": "actor.you",
            "text": "You did it!  Now I can leave!  You are an excellent musician.  Thank you!",
        },
        {
            "id": "10",
            "subject": "actor.nell",
            "verb": "speak",
            "object": "actor.you",
            "text": "When you want to try again to help me unlock the gate, I'll be here!",
        },
        {
            "id": "11",
            "prerequisites": "9",
            "action_type": "checkpoint",
            "text": "You rescued Nell from the tower!",
            "achievement": "Music tone matching",
            "skill_increase": "Music",
        },
    ],
}

-- 
Chris Ball   <cjb at laptop.org>   <http://printf.net/>
One Laptop Per Child


More information about the Nell mailing list