Dialogue

From Post-Apocalyptic RPG wiki

Jump to: navigation, search

Contents

What is Dialogue?

Dialogue is the meaningful conversations that take place between the player character (PC) and non-player characters (NPCs). It is entirely possible and perhaps desireable for conversations to go down permanent one way paths, so consequences matter.

You don't have to know how to program to create new dialogue. The primary objective should be to make it easy for non-technical users to be able to create and extend game dialogue without having to be programmers.

Note: The current Dialogue Engine (Februar 2010) might be changed after techdemo I.

How does it work?

Simply, the dialogue engine parses a dialogue file and coverts the instructions there into something we can display in game. It can then offer NPC text and responses as well as receive responses to NPC statements. This can contain conditional logic to make complex dialogue trees.

Working example

For a simple working example have a look at sample/dialogue.yaml within the parpg root directory.

Creating dialogue

It's very easy to create dialogue for an NPC. All we have to do is create a dialogue file and and then reference it from the map file for that NPC.

Some hints on how to do this

First, you have to decide what "game effects" (if any) the NPC is going to have. Does he have something to give you? A real thing? Information? A quest? If there are no "puzzles" to solve then you can just have this as a dialog option. After the "specifics" for the NPC you probably need to write some "generalities" - what can you ask this person about other quests (you obviously don't have to have the same questions for every NPC, but you can.. they can have "canned" answers (default info) or maybe this one knows a little more.

There is a mall_template.yaml file that has some generic question-and-answer for the the techdemo quests (fedex and beer).

If you want to have a "puzzle" dialog, like zenbitz did for skwisgaar, the Crazy Swede, you should first make a flow chart.

Flowchart

Then just add the dialogue with conditionals to switch on and off parts.

Step 1: Create a dialogue file

Edit dialogue/my_dialogue.yaml and add something like:

---
NPC: Bart The Drunkard
AVATAR: gui/icons/npc.png
START: main_dialog
 
SECTIONS:
    main_dialog:
        - say: "Hey there, back up... no need to gang up on a poor guy!"
        - responses:
            -
              - "Gang up? There's only one of me!"
              - first_impression
              - not pc.met('bart')
            -
              - "Glad to see you're feeling better."
              - gratitude
              - pc.met('bart') and not quest.hasFinishedQuest('beer')
            -
              - "Same old Bart, I see."
              - old_pals
              - pc.met('bart')
            -
              - "Ha, you better sleep it off, buddy."
              - end

There are some things to notice here.

  • The "NPC" field specifies the name of the NPC
  • The "AVATAR" field specifies the profile image of the NPC
  • The "START" field specifies the first dialogue frame in the conversation. This is the first section to be run.
  • The "SECTIONS" section contains all of the different dialogue frames for this NPC. It is possible for responses to have the game jump to other sections, end the conversation, or simply go back one dialogue stack frame.

Within the section there are a few important things:

Commands
  • say specifies what the NPC text window will display for this dialogue frame
  • reponses specifies the list of possible responses for this stack frame. Each response contains a text string which is the user's reply, a section to jump to if this was the chosen response, and also a condition (specified as a python boolean expression), which if true, will cause this message to be displayed. By default if no conditional is specified the response will be displayed.
  • meet record that the NPC has been met by the user
  • start_quest
  • complete_quest
  • delete_quest
  • increase_value
  • decrease_value
  • set_value
  • dialogue
  • back as in back help_beer

Step 2: Edit the Map file

To link an NPC to this dialogue file, edit the map file (eg maps/map.xml) and where you see the definition for the NPC you wish to endow with speech add a dialogue="dialogue/my_dialogue.yaml"

Look for something like this:

<i x="-5.0" o="male_farmer_1" z="0.0" y="-5.0" r="0" id="male_farmer0" object_type="NonPlayerCharacter" text="A grimy looking farmer"/>

and change it to:

<i x="-5.0" o="male_farmer_1" z="0.0" y="-5.0" r="0" dialogue="dialogue/my_dialogue.yaml" id="male_farmer0" object_type="NonPlayerCharacter" text="A grimy looking farmer"/>

Step 3: Try it out

Run the game and try to interact with the NPC. When you offer to talk to them you should see your (very simple) dialogue.

Personal tools