top of page

Project Prisma

Position

Project Director, Game Designer, Programmer, Producer

Description

A narrative based platformer game

Duration

Engine

2023 Winter - on going

Unity

Genre

Platformer

Platform

PC

Dialogue System Technical Breakdown

About
 

image.png

Prisma is a platformer game centered around Prisma, a colorful cat who works as a delivery boy in a post-war world devoid of color and life. As he makes deliveries, Prisma also restores color and hope to the bleak city.

Dialogue System of Prisma
 

The dialogue system of Prisma needed to be modular and compatible with the game, while the characters and the dialogue had to feel appropriate, as the player progresses through the quests. 

1.PNG

On the game screen, the dialogue system displays the dialogue depending on the current state of a specific quest, It also shows the assigned sprite for the character, for that specific line of dialogue.  Below is the progression of a sample dialogue.

1.

1.PNG

2.

2.PNG

3. 

3.PNG

If a quest condition is met the dialogue changes to the set of lines that meets the requirements. Below is the changed dialogue based on the different quest state

1.

4.PNG

2.

5.PNG

My goal was to ensure that no coding was necessary for the dialogue creation and editing, as the project involved multiple freshmen students who were not comfortable with coding could contribute to the project easily. 

1. Quest Object

quest.PNG

On the editor, the user can create a quest object to make a quest and assign different states. According to the quest progression code, the corresponding quest's progression would change

2. Dialogue Object

Also on the editor the players can add dialogues and appropriate sprites to the sequence of dialogues, and assign conditions to display certain dialogues when the quest object meets a certain condition. 

dialgue.PNG

System Diagram
 

image.png

Script: DialogueManager

  1. StartDialogue(Dialogue dialogue):

    • Initiates a new dialogue using the Dialogue object passed to it. Sets up the initial indices for entries and lines.

    • Calls CheckDialogueEntries() to start processing the dialogue entries.

  2. ShowDialogue(DialogueEntry entry):

    • Displays a single dialogue line from the current dialogue entry based on currentLineIndex.

    • Updates UI elements with the character's name, text, and sprite.

  3. ContinueDialogue():

    • Advances to the next line in a dialogue entry or to the next entry if all lines in the current entry are completed.

    • If the dialogue is completed, it calls EndDialogue().

  4. EndDialogue():

    • Cleans up after a dialogue is finished. Resets dialogue-related variables and updates UI to reflect that the dialogue has ended.

  5. HandleQuestStateChange():

    • Checks the state of a quest associated with a dialogue entry and updates the dialogue flow based on the quest's state.

  6. CheckDialogueEntries():

    • Iterates through all dialogue entries in the current dialogue to check if any conditions related to quests are met.

Script: NPC

  1. OnTriggerEnter2D(Collider2D collision) and OnTriggerExit2D(Collider2D collision):

    • Detects when the player enters or exits the interaction range, updating the UI and preparing the dialogue system for interaction.

  2. OnInteract():

    • Manages the interaction with the player. If dialogue has not started, it starts the dialogue. If dialogue is already ongoing, it continues to the next dialogue line.

Script: Dialogue, DialogueEntry, and DialogueLine

  • These are data structures rather than scripts with functional behavior. Dialogue contains a list of DialogueEntry objects, and each DialogueEntry in turn holds a list of DialogueLine objects. They hold the data necessary for the dialogue manager to process and display dialogue.

Script: Quest

  1. ChangeState(QuestState newState):

    • Changes the state of a quest and triggers an event if the state changes. This is used by DialogueManager to react to changes in quest status that might affect dialogue options.

Information Flow

  • From NPC to DialogueManager: When the player interacts with an NPC, NPC script triggers DialogueManager to start or continue a dialogue based on the NPC's assigned Dialogue object.

  • From DialogueManager to UI Elements: Dialogue text, character names, and sprites are passed to UI elements like TMP_Text and Image for display.

  • Quest State Changes to DialogueManager: Changes in quest state can affect the flow of dialogue, handled by listening to quest state change events in DialogueManager.

This structure allows for a modular approach where NPCs manage their dialogues, and the dialogue system can adjust dynamically based on game logic, such as quest states.

GDD
 

bottom of page