Hello! Here I am again with another update on my game!
I've been juggling a QA gig and other commitments, but even a short break from my project has led to some valuable insights. One significant area that caught my attention was the structure of my dialogue system.
Initially, my DialogueSystem was doing a bit too much. It wasn't just managing the presentation of dialogue; it also included flags that determined things like whether a scene should change or if a reward should be given to the player. This approach made the DialogueSystem feel bloated and less focused on its core purpose.
To improve this, I decided to refactor the system by leveraging DialogueObjects more effectively. These ScriptableObjects were already holding the dialogue content itself, so it made sense to move the responsibility of these flags directly into them.
Here's why this move was beneficial:
Clearer Separation of Concerns: Each DialogueObject now encapsulates all the information relevant to a specific conversation. This includes not only the dialogue lines but also the associated flags for scene changes, rewards, and any other special effects. This makes it easier to manage and understand each piece of dialogue as a self-contained unit.
More Flexible Dialogue Design: With the flags living in the DialogueObjects, I have much greater flexibility when crafting dialogue interactions. Each conversation can have its own unique set of consequences, making the game more dynamic and engaging.
Streamlined DialogueSystem: The DialogueSystem itself is now slimmer and more focused on its core functionality – displaying the dialogue text, handling player choices, and interacting with the DialogueObjects.