Another rpg dialog system: format inquiry

0 favourites
  • 2 posts
From the Asset Store
Template for a generic save / load system, fully documented in comments and video
  • Hi,

    I'm working towards implementing a dialog system utilizing xml files generated by the Flamewind Conversation Editor (@nwvault- free, standalone) and was curious as to the best way forward, in a general sense. Below is a sample conversation output xml.

    I've taken a look at the dialog info linked in the "How do I?" FAQ, but since this editor is free and easy to use, I figured to work from it to employ a system that others might be able to implement, without an encumbered workflow.

    FWIW, I see the npc text as a text or (uneditable) textbox object, and the player replies as listbox object items (only way i see to add/subtract reply options).

    My questions are:

    1. Should I parse the xml as is within events (pulling text and resolving conditions/actions directly from its content), or should I load its content into another form(s) (array and/or otherwise) and use that/those to resolve events? I'm not clear on the advantages of one over another or whether the xml would readily conform to a better format. Also, My personal implementation would be on a desktop browser, so I suppose I'm less concerned about cross-functionality at the moment, but...

    2. Would a transformation (XSLT) of the output xml (into another xml) be wise before attempting #1? It's not exactly the most followable xml. Idk if transforming would help coding/XPath expressing.

    Here is the code

    <?xml version="1.0" encoding="utf-8"?>
    <Conversation xmlns:xsi="can't post urls" xmlns:xsd="can't post urls">
      <subNodes>
        <ContentNode idNum="2" orderNum="1" linkTo="0" nodeType="npc">
          <conversationText>Nice to see you again!</conversationText>
          <conversationComments>This greeting should appear if Player has already spoken to Npc</conversationComments>
          <subNodes>
            <ContentNode idNum="3" orderNum="1" linkTo="0" nodeType="pc">
              <conversationText>I have that thing you wanted.</conversationText>
              <conversationComments>Appears when Player has accepted quest and has item</conversationComments>
              <subNodes>
                <ContentNode idNum="11" orderNum="1" linkTo="0" nodeType="npc">
                  <conversationText>Awesome! Here's some gold.</conversationText>
                  <conversationComments>Give gold to Player</conversationComments>
                  <subNodes />
                  <additionalData />
                  <infoObjects />
                </ContentNode>
              </subNodes>
              <additionalData />
              <infoObjects />
            </ContentNode>
            <ContentNode idNum="12" orderNum="2" linkTo="0" nodeType="pc">
              <conversationText>I'm still looking for that thing you wanted.</conversationText>
              <conversationComments>Appear only when Player has quest but not item.</conversationComments>
              <subNodes>
                <ContentNode idNum="13" orderNum="1" linkTo="0" nodeType="npc">
                  <conversationText>Good luck!</conversationText>
                  <conversationComments />
                  <subNodes />
                  <additionalData />
                  <infoObjects />
                </ContentNode>
              </subNodes>
              <additionalData />
              <infoObjects />
            </ContentNode>
            <ContentNode idNum="0" orderNum="3" linkTo="5" nodeType="pc">
              <conversationText />
              <conversationComments />
              <subNodes />
              <additionalData />
              <infoObjects />
            </ContentNode>
            <ContentNode idNum="0" orderNum="4" linkTo="6" nodeType="pc">
              <conversationText />
              <conversationComments />
              <subNodes />
              <additionalData />
              <infoObjects />
            </ContentNode>
          </subNodes>
          <additionalData />
          <infoObjects />
        </ContentNode>
        <ContentNode idNum="1" orderNum="2" linkTo="0" nodeType="npc">
          <conversationText>Hello Player!</conversationText>
          <conversationComments>Appears if Player is speaking to Npc for first time</conversationComments>
          <subNodes>
            <ContentNode idNum="4" orderNum="1" linkTo="0" nodeType="pc">
              <conversationText>What is your name?</conversationText>
              <conversationComments />
              <subNodes>
                <ContentNode idNum="10" orderNum="1" linkTo="0" nodeType="npc">
                  <conversationText>Bob</conversationText>
                  <conversationComments />
                  <subNodes>
                    <ContentNode idNum="0" orderNum="1" linkTo="5" nodeType="pc">
                      <conversationText />
                      <conversationComments />
                      <subNodes />
                      <additionalData />
                      <infoObjects />
                    </ContentNode>
                  </subNodes>
                  <additionalData />
                  <infoObjects />
                </ContentNode>
              </subNodes>
              <additionalData />
              <infoObjects />
            </ContentNode>
            <ContentNode idNum="5" orderNum="2" linkTo="0" nodeType="pc">
              <conversationText>Got any quests?</conversationText>
              <conversationComments>Appears if player has not accepted quest</conversationComments>
              <subNodes>
                <ContentNode idNum="7" orderNum="1" linkTo="0" nodeType="npc">
                  <conversationText>Yes, fetch me something.</conversationText>
                  <conversationComments />
                  <subNodes>
                    <ContentNode idNum="8" orderNum="1" linkTo="0" nodeType="pc">
                      <conversationText>Ok</conversationText>
                      <conversationComments>Player accepts quest</conversationComments>
                      <subNodes />
                      <additionalData />
                      <infoObjects />
                    </ContentNode>
                    <ContentNode idNum="9" orderNum="2" linkTo="0" nodeType="pc">
                      <conversationText>No thanks</conversationText>
                      <conversationComments />
                      <subNodes />
                      <additionalData />
                      <infoObjects />
                    </ContentNode>
                  </subNodes>
                  <additionalData />
                  <infoObjects />
                </ContentNode>
              </subNodes>
              <additionalData />
              <infoObjects />
            </ContentNode>
            <ContentNode idNum="6" orderNum="3" linkTo="0" nodeType="pc">
              <conversationText>Goodbye</conversationText>
              <conversationComments />
              <subNodes />
              <additionalData />
              <infoObjects />
            </ContentNode>
          </subNodes>
          <additionalData />
          <infoObjects />
        </ContentNode>
      </subNodes>
      <additionalData />
      <infoObjects />
      <VersionNumber>2</VersionNumber>
    </Conversation>

    About the xml:

    A couple elements are superfluous (as a standalone application), such as "<additionalData />" and "<infoObjects />". They're always empty.

    An "idNum" value of 0 means that an element is copied (as a link) from another element (whose idNum is expressed in the "linkTo" value)

    The comment element provides an opportunity to insert condition|action parameters

    Any general thoughts/suggestions would be appreciated. I've begun working on it, and I'll post my capx progress once I've locked onto a directin. Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here's a simplified template:

    Conversation xmlns:xsi="can't post urls" xmlns:xsd="can't post urls">
      <subNodes>
        <ContentNode idNum="1" orderNum="1" linkTo="0" nodeType="npc">
          <conversationText>NpcEntry</conversationText>
          <conversationComments>NpcEntryComment</conversationComments>
          <subNodes>
            <ContentNode idNum="2" orderNum="1" linkTo="0" nodeType="pc">
              <conversationText>PlayerReply</conversationText>
              <conversationComments>PlayerReplyComment</conversationComments>
              <subNodes />
              <additionalData />
              <infoObjects />
            </ContentNode>
          </subNodes>
          <additionalData />
          <infoObjects />
        </ContentNode>
      </subNodes>
      <additionalData />
      <infoObjects />
      <VersionNumber>2</VersionNumber>
    </Conversation>
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)