Jump to content
  • Advertisement
kensarto

C# Dialog System Branching Paths

Recommended Posts

A while ago before i got sick I made a thread, it might even still be on the front page but its quite old and i wasn't 100% sure on the necro cut off point. It requested assistance creating a dialog system and listed the requirements. This post gave me some resources to use for myself. After experimentation with those resources and hitting the brickwall of the sample projects not running, failing to setup even with written instructions and not being 100% certain they even fit my needs in the first place I decided I would branch out and do it myself.

I am using a simple linear dialog system now which starts a dialog, allows the user to continue through it, then end the dialog as well as create different dialog chains for different NPCs.

What my goal is now, is to add the branching to that.
To accomplish this my goal is to store different dialog "Chains" as individual components on each NPC, and then when wishing to prompt a choice actually end a chain and begin another. 

My question is, since i am running a blank on it in my head lately, what is the most efficient way to prompt those choices? Detect when a dialog is being called to end and sort via DialogID to determine the parameters that need to be added to the present choices method? If i do perform it in this way, will the number of dialog classes on each NPC create any form of performance problem? Please point out any blatant flaws in my logic or offer improvements that can be made before i begin production.

Attaching an image to aid my explanation since I might be spouting nonsense in my post-illness semi-stupor

 

Thank you.

dialog flowchart.png

Share this post


Link to post
Share on other sites
Advertisement

Ok, for a start, I dont quite underestand what you explain. I implemented a branching dialog system, and the branches depends, as usual, on active/unasigned/failed quests, character attributes, items present or not in player´s inventory, etc. I use a complex system, of course. I consider each player answer or NPC line as a node, and each node is displayed or not if its conditions are all true (or has no conditions at all). As I said, quite complex. I also would like to know if there is some optimal and more performant way to do this. But consider that dialog parsing is something that gets executed only once (when dialog is displayed), and not several times per second, so I dont care too much about performance.

 

 

 

Share this post


Link to post
Share on other sites

The fact that my explanation isn't being easily understood could be an indication that I am missing some fundamental knowledge in how to implement it efficiently, but I can confirm that since making this post i used this implementation and it worked.

Essentially I have a scriptable object for the dialog chain which is a series of messages from an NPC and I have a scriptable object for responses. each response either ends the conversation or leads to a chain and each chain leads to a collection of responses. The NPC has the collection of conversation chains and responses as well as a default chain that starts the conversation when you interact with the NPC. 

You mentioned a quest system, attribute and item system having an effect on the conversation and that isn't implemented but is planned, and essentially in the step where the game checks for responses after a chain, it also checks if there are any requirements for any of the responses AND checks if those requirements are met, and will only show those responses if both are true.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!