Devtober 2022 Postmortem


Introduction

“The Mystery of the Missing Necklace” is a very generic title as well as the game I developed for Devtober 2022. My main purpose of this Devtober is to develop a dialog system from scratch in Phaser in which your choices affect a character’s happiness meter. So in this game, you are a detective trying to figure out who stole the diamond necklace. You interrogate different characters and are presented with choices of what to say to them. If you choose the dialog that makes the characters you are interrogating too happy or too angry, you may miss out on some clues to solving the mystery. So, it’s important to be as neutral as possible.


Implementation

The dialog system consumed a json file that contained the data about the character that was speaking, the topic, and the dialog. The dialog had a question and an array of choices. Each choice had the dialog text, the happiness points that would be added to the character (which may also be a negative number), and the next character and next topic. The topic could have a “_low” or a “_high” in their name, and this relates to their happiness threshold in the code. For example, if the character’s happiness meter is 70 or over, then go to “[topic]_high” next.

Example snippet of json file:

"Ellinor": {

        "greeting": {

            "question": "Hello, Detective.",

            "choices": [

                {

                    "answer": "Can you tell me where you were last night?",

                    "happiness": 0,

                    "nextTopic": "interrogate1",

                    "nextCharacter": "Ellinor"

                },

                {

                    "answer": "Nice outfit, friend. Where did you get it?",

                    "happiness": 100,

                    "nextTopic": "interrogate1",

                    "nextCharacter": "Ellinor"

                },

                {

                    "answer": "You did it, didn't you? You. stole. the necklace. Admit it!",

                    "happiness": -100,

                    "nextTopic": "interrogate1",

                    "nextCharacter": "Ellinor"

                }

            ]

        },

        "interrogate1": {

            "question": "Just... carrying on with my shift as usual. I worked from 6 till closing at midnight.",

            "choices": [

                {

                    "answer": "Okay. And you were here all this time?",

                    "happiness": 0,

                    "nextTopic": "interrogate2",

                    "nextCharacter": "Ellinor"

                },

                {

                    "answer": "Are you for real? Dude. You look waaay too tired. No break?",

                    "happiness": 100,

                    "nextTopic": "interrogate2",

                    "nextCharacter": "Ellinor"

                },

                {

                    "answer": "Uh huh. I bet that's not accurate.",

                    "happiness": -100,

                    "nextTopic": "interrogate2",

                    "nextCharacter": "Ellinor"

                }

            ]

        },

        "interrogate1_high": {

            "question": "Ha, this old thing? It's our uniform for work.",

            "choices": [

                {

                    "answer": "Ha, get out! It doesn't look too bad!",

                    "happiness": 100,

                    "nextTopic": "farewell",

                    "nextCharacter": "Ellinor"

                }

            ]

        },

        "interrogate1_low": {

            "question": "Excuse me? Did what?",

            "choices": [

                {

                    "answer": "Oh, don't act like you don't know.",

                    "happiness": -100,

                    "nextTopic": "farewell",

                    "nextCharacter": "Ellinor"

                }

            ]

        },

. . .


Thoughts

As I wanted to focus on the logic of the dialog system and the happiness meter, it was hard to not also spend time on the art and UI. Especially since the happiness meter affected the character’s facial expression, and the UI needed to make the conversation and choices clear. The parallax background was unnecessary, but I just did it anyway to set up the atmosphere of being on a train.

I also found it hard to keep track of the dialog branching, so I cut out a lot of text, and if you say one happy thing, then you are pretty much along the happy path and cannot get out of it. The same with the angry path. I will need to find a better way to keep track of this, like flow charts or something, rather than just looking at the json file. The character started at 50 for the happiness meter, but it became very easy to get lost. I ended up just adding/subtracting 100 points which definitely placed the character in either the “happy” or “angry” path and then to the “farewell” topic, which would cut the conversation short and therefore made the player miss out on more clues.


Future Improvements

A few things that I wish to improve on (not including art):

  • Additional meters, not just happiness
  • Better conversation flow (not every dialog text needs choices. See Exit conversation button.)
  • A better layout between the character speaking and the choices of how you, the player, would respond (was whoever was speaking clear enough?)
  • Animation of text
  • Animation of dialog boxes
  • Fast forward button
  • Exit conversation button
  • Saving conversation history
  • Conversation speed settings
  • Back button in dialog (maybe?)

Leave a comment

Log in with itch.io to leave a comment.