Skip to content

Conversation Tree #111

@racingcow

Description

@racingcow

Hi @collinhover,

I have need of a conversation/dialogue tree in my top-down RPG game. An example might be if my PC was playing the part of the bridgekeeper from Monty Python and the Holy Grail...

conversation state transition 2

While I could probably achieve this by careful manipulation of the EntityConversation.steps array on the fly, it would be nice if there was a way for the conversation entity to handle a dialogue tree structure 'out of the box'.

If you don't already have plans for it, and don't mind me giving it a shot, I could take a look at extending EntityConversation to handle something like this. My thoughts on it so far are below. If you have some time, maybe you could take a look and give me some feedback/thoughts? Just let me know if there is a way that better fits with what you have done so far.

  • Create a new element, perhaps called something like UITextBubbleChoice, that supports the user choosing one of several text items (the choices/responses that the PC would say) displayed beneath a main text heading (the last response from the NPC).
    uitextchoice proposed design
  • When wanting to use a conversation tree, set EntityConversation.messageContainerEntity to ig.UITextBubbleChoice.
  • Have each step in EntityConversation support another property called something like next. If set to an int, the conversation would move to the step represented by that index value in the steps array. If, on the other hand, it was set to an array of ints, the conversation would display each possible step associated with those indexes in UITextBubbleChoice as a possible response for the user.
  • When the user chooses a step displayed in UITextBubbleChoice, the conversation would follow the value of next to display the response from the NPC.
  • Support a property called something like step.usedSteps that would provide a list of steps that must all be visited before the step is available as a valid response (in my example step 5 should not become a valid response until all questions have been asked and answered).

If the above makes sense, this might be an example of how to set it up in Weltmeister...

step.1.name = 'talker'
step.1.text = 'I seek to cross the bridge.'
step.1.next = 11
step.11.name = 'player'
step.11.text = 'Stop! Who would cross the Bridge of Death must answer me these questions three, ere the other side he see.'
step.11.next = 7
step.12.name = 'talker'
step.12.text = 'Ask me the questions, bridgekeeper. I am not afraid.'
step.12.next = [2,3,4,5]
step.2.name = 'player'
step.2.text = 'What... is your name?'
step.2.next = 7
step.3.name = 'player'
step.3.text = 'What... is your quest?'
step.3.next = 8
step.4.name = 'player'
step.4.text = 'What... is your favourite colour?'
step.4.next = 9
step.5.name = 'player'
step.5.text = 'Go on. Off you go.'
step.5.usedSteps = [2,3,4]
step.5.next = 6
step.6.name = 'talker'
step.6.text = 'Oh, thank you. Thank you very much.' 
step.7.name = 'talker'
step.7.text = 'My name is Sir Lancelot of Camelot.'
step.7.next = [3,4,10,5]
step.8.name = 'talker'
step.8.text = 'To seek the Holy Grail.'
step.8.next = [2,4,10,5]
step.9.name = 'talker'
step.9.text = 'Blue.'
step.9.next = [2,3,10,5]
step.10.name = 'player'
step.10.text = 'I want to ask you something else.'
step.10.next = 12

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions