Hi, I’m trying to create a text based interactive story game. I managed to get the dialogue system running.
I’m using dictionary to store the dialogues along with speaker names, options and a bunch of flags and variables that control the flow of the dialogue system. For each entry in the dictionary I’m creating a new object to store the data. There are also few other functions that handle triggers based on the current dialogue (Dictionary key). This dictionary is initialized inside a class and not in it’s Start() or Awake() functions. Here’s the template:
public Dictionary<int,Quest> quest1dict = new Dictionary<int,Quest>()
{
{1, new Quest{speakerName="Suzan:", dialogueText="Hi", opText1=null, opText2=null, opText3=null, opText4=null, op1=0, op2=0, op3=0, op4=0, jmp=0, setcp=0, time=0, reserved=0}},
{2, new Quest{speakerName="Me:", dialogueText="Hello", opText1=null, opText2=null, opText3=null, opText4=null, op1=0, op2=0, op3=0, op4=0, jmp=0, setcp=0, time=0, reserved=0}},
{3, new Quest{speakerName="Suzan:", dialogueText="How are you?", opText1=null, opText2=null, opText3=null, opText4=null, op1=0, op2=0, op3=0, op4=0, jmp=0, setcp=0, time=0, reserved=0}},
{4, new Quest{speakerName="Me:", dialogueText="I'm good.", opText1=null, opText2=null, opText3=null, opText4=null, op1=0, op2=0, op3=0, op4=0, jmp=0, setcp=0, time=0, reserved=0}},
{5, new Quest{speakerName="Suzan:", dialogueText="Wanna come in?", opText1="No", opText2="Yes", opText3=null, opText4=null, op1=6, op2=8, op3=0, op4=0, jmp=0, setcp=5, time=0, reserved=0}}
};
I wanted to know, to what extent is this method optimal for an Android game? This will contain A LOT of dialogues in the future (couple of thousands) and multiple such quest lines. Does this have any impact on memory? Is there a better method? Let me know. Thanks!