What’s the best way to handle branching dialogue in a 2D RPG: node or JSON?
#1
I’ve been trying to implement a basic dialogue system for my 2D RPG, but I’m stuck on how to cleanly handle branching choices without my script becoming a tangled mess of if-statements. I keep wondering if I should be using a visual node editor or just structuring my JSON data differently.
Reply
#2
I started with a flat JSON where each node has id, text, and an array of choices that point to the next node. It looked clean on day one, but as soon as branching landed in different quests, the if-logic started blooming. I split the dialogue into small chunks and kept a tiny state map for what the player chose, so the code didn’t explode with nested ifs.
Reply
#3
I tried a visual node editor once for the prototype. It felt slick at first, but in a team project it became a pain to version control and merge. Also the editor locked you into a particular toolchain, which made platform builds slower.
Reply
#4
I built a tiny interpreter that walks through nodes and a separate UI for the choices. I watched the lines of code for the branching shrink from hundreds to a few dozen checks in the data. It helped, but the occasional edge case still bites when a branch loops back.
Reply
#5
One day I drifted into localization notes and text variants, thinking about tone and who says what. It didn’t fix the branching, but it forced me to keep text in sync and left me wondering if the problem was really the data format or how the UI presents it.
Reply


[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Forum Jump: