Skip to content
Maree edited this page Oct 17, 2024 · 117 revisions

Table of Contents:

  • Overview
  • Quest List
  • Quest Structure
  • Sequence Diagrams
  • Example Usage
  • Test Plans
  • UML Diagrams
  • Class Descriptions
  • References

Overview:

The quest system in the game is designed to provide the players with engaging quests and tasks in order to progress through the game. The quests are integrated into the gameplay, offering a dynamic and immersive experience. Here’s an overview of how the quest system is structured:

  • Tasks: the list of actions that must be undertaken to progress in a quest.
  • AbstractQuest: abstract class with variables and methods to supply information about quests, including a list of tasks that can be undertaken in no particular order that upon completion of all tasks will unlock an achievement and mark the quest as complete.
  • Quest: a basic quest class that implements AbstractQuest, using all provided methods.
  • QuestBuilder: a builder class for the quest, wrapping the private constructor.
  • QuestManager: the controller class that keeps track of quest progression, completion, dialogue and hints, in relation to NPCs, the quest menu and listening for global events (for task names). This will be updated in later sprints to apply rewards upon quest completion.
  • DialogueKeys: are map NPCs and quest progression (number of tasks completed) to dialogue arrays (designed to assist players in the progression of quest (through introductory/explanatory messages including quest task hints).
  • QuestDisplay: the UI for the quest menu accessed through the pause menu (pressing 'esc' mid-game) or through the quest screen (pressing 'q' mid-game).
  • QuestPopup: the UI that prints 'Quest Completed' to the game screen when a quest has been completed.
  • QuestOverlay: Represents an overlay that displays quest-related information. (Further detailed information can be found here -> Overlays
  • QuestHidden: a stripped back QuestBasic that keeps track only of quest name, quest description, and completion status
  • AchievementDisplay: Display that contains all of the UI elements of the achievements page Logbook Achievements
  • AchievementPopup: UI element on the screen that displays whenever an achievement is completed
  • AchievementManager: Manages the achievements in the game by loading them from a config file
  • LogButton: A custom button class for Log
  • TabButton: Constructs a new tabButton with the specified text, skin, and background image.

Quest list (at the end of sprint 4)

The quests at the end of sprint 3 are are finalised and work in the form of triggers and integration with other teams. Throughout the project, these quests will be developed in accordance with the design document found at: Quest Design Principles. There are an overall amount of 15 quests. The 15 quests that are playable in the game at the end of the sprint are:

  • Guide's Intro
  • Guide's Request
  • Defeat Chickens
  • Play Snake
  • Defeat Kangaroo
  • Talk to Tilly
  • Sea Pearl Collection
  • Defeat Frogs
  • Play Flappy Game
  • Defeat Leviathan
  • Talk to Eagle
  • Gathering Sky Crystals
  • Defeat Bees
  • Underwater Challenge

Quest Structure:

Each quest consists of:

Objectives: Specific tasks that need to be completed to progress.

Tasks: Individual tasks that must be accomplished as part of the quest.

Hints: Provided through the quest display (through the pause menu opened by pressing 'esc' key or pressing 'q').

Dialogue: String arrays to be given to players by NPCs through dialogue boxes to aid players in completing objectives.

Completion Criteria: Conditions that must be met for the quest to be considered complete i.e. tasks and triggers.

Sequence diagrams

Quest progression

image

Combat and item collection tasks

image

Talk to guide tasks progression

image

Example usage:

Tasks

Tasks are initialized like:

 Task talkToWaterSage = new Task(
                "talkToWaterSage",
                "Talk to the Water Sage",
                "Speak with the Water Sage to gain their trust and begin your quest.",
                1, 0, false, false
        );

DialogueKey

To set up dialogue string arrays, e.g.:

 String[][] defeatWaterBossDialogue = {
                {"When you’re prepared, confront the Sky Seraph in an epic battle!"}
        };

To map up NPC character dialogue for test tasks to the dialogue string arrays:

dialogues.add(new DialogueKey("Cow", cowInitialDialogue));

Quest (extents AbstractQuest)

To initialise a basic quest with the values of your choice:

quest = new QuestBasic("First Steps", "Take your first steps in this world!", List.of(stepsTask), false, null, null, true, false, 0, null);

QuestManager (extends Component)

Managing dialogue:

List<DialogueKey> dialogues = new ArrayList<>();
dialogues.add(new DialogueKey("Cow", cowInitialDialogue));
return dialogues;

Completing and updating quests:

if (questManager.isQuestComplete("Final Boss")) {

    questManager.triggerFinalBoss();

}
questManager.updateQuestDisplay();

QuestDisplay

How to create a new instance of QuestDisplay:

QuestDisplay questDisplay = new QuestDisplay();

How to initialise and create the display:

questDisplay.create();

QuestPopup

How to create an instance of QuestPopup:

QuestPopup questPopup = new QuestPopup();

Initialise the popup UI component:

questPopup.create();

How to update and draw:

questPopup.update();
questPopup.draw(new SpriteBatch());

Achievements

Making an achievement:

Achievement achievement = new Achievement("Test Achievement", "Achievement Description");

Adding an achievement to the achievements page: In AchievementsDisplay, makeAchievementsTable()

Label achievementName = new Label("Test Achievement", skin);
Label achievementDescription = new Label("Lorem ipsum", skin);
table.add(achievementName);

Using a new AchievementPopup:

AchievementPopup popup = new AchievementPopup();
...
// in PlayerFactory, or a derivative
Player.addComponent(popup);

Testing plan:

The testing plan is as follow:

Creation: Ensure quests are created with accurate objectives and tasks.

Progression: Verify that quests progress correctly through task completions.

Completion: Test that quests are marked as complete when all criteria are met, not report false completions.

Interactions: Check that NPC interactions and dialogue boxes function as expected.

Wiki links:

QuestBasicTests

TaskTest

QuestManagerTest

InventoryCollectionTest

AchievementTest

AchievementManagerTest

QuestTest

The display, overlays and achievements were visually tested in the form of YouTube videos (p.s. if you are a tutor, please see team 5's sprint achievement forms)

For sprint 4:

  1. Final quest progression testing https://youtu.be/DDDbIbeuz94 - event driven in game of:
  • Mini game quest progression triggers (upon ‘play game’ button press while talking to snake NPC)
  • Final boss summoning after mini game completion
  • Final boss defeat triggering quest progression to next biome (if applicable)
  1. new QuestPopup https://youtu.be/Me5CHrAsVWw
  2. new AchievementPopup https://youtu.be/TbgDi1lY1uE

UML Diagram:

This UML diagram represents an overview of the Quests system in the game, detailing their structure and interactions within the project.

quests

Note: the green unlock symbol means public, the orange key means protected and the red lock means private.

the little hats on the (f) means final variable and, the star on the (f) means static variable

Class Descriptions:

* com.csse3200.game.components.AbstractQuest

* com.csse3200.game.components.DialogueKey

* com.csse3200.game.components.Quest

* com.csse3200.game.components.QuestManager

* com.csse3200.game.components.QuestPopup

* com.csse3200.game.components.Task

* com.csse3200.game.components.QuestDisplay

* com.csse3200.game.components.QuestOverlay

* com.csse3200.game.components.QuestHidden

* com.csse3200.game.components.AchievementDisplay

* com.csse3200.game.components.AchievementPopup

* com.csse3200.game.components.AchievementManager

* com.csse3200.game.components.TabButton

* com.csse3200.game.components.LogButton

Package: com.csse3200.game.components.quests;

This package contains all the classes for quests in the game.

Quest : An abstract Quest class that contains the design for Quest classes that store quest and subtask progression (# of subtasks completed), descriptions and hints.

Attributes:

  • quest Name The name of the quest.
  • questDescription A description of the task.
  • tasks taskArray indexing corresponds to number of tests completed and each entry consists of the task to be completed during this step.
  • isAchievement True if quest achievement has been unlocked.
  • isSecretQuest True if the quest is hidden (possible xp and levels).
  • isActive True if quest is active (not completed or failed).
  • questDialoguequestDialogue is a list that relatesDialogueKey(String npcName, Integer ProgressionLevel) to a dialogue map relevant to the npc
  • taskCompletionTriggers Triggers for task completion.
  • currentTaskIndex Number of tasks completed for current quest.

Methods:

  • getQuestName() Returns quest name.
  • getTasks() Returns task array for quest subtasks.
  • isQuestCompleted() Returns true if quest is completed.
  • getProgression() Returns number of quest subtasks completed.
  • getCurrentTaskDescription() Returns the description of the current subtask being completed for a test or "QUEST COMPLETED" if the quest is completed.
  • getCurrentTaskHint() Returns the hint for the current subtask being completed for a test or "QUEST COMPLETED" if the quest is completed.
  • progressQuest() Progress (increments) number of quest subtasks completed.
  • isFailed() Returns true if quest is failed.
  • failQuest() Earmarks quest as having failed.
  • getQuestDescription() Returns a description of the quest.
  • getNumTasksToComplete() Returns the number of tasks to be completed for an individual test.
  • getNumQuestTasks() Returns the number of tasks for a quest.
  • isAchievement() Returns true if quest achievement has been unlocked.
  • isSecret() Returns true if the quest is secret (e.g. progression, XP, etc).
  • isActive() Returns true if the quest is active.
  • setActive() Sets the quest to an active status.
  • getQuestDialogue() Returns the dialogue associated with the quest.
  • getFollowQuests Return the next following quest.

Task: Handles the tasks for each quest.

Attributes:

  • taskName The name of the task.
  • description A description of what the task involves.
  • hint A hint related to completing the task.
  • requiredTriggers The number of triggers required to complete task.
  • triggerCount Number of times a task has been triggered.
  • completed True if the task is completed.
  • failed True if the task has failed.

Methods:

  • getTaskName() Returns the task name.
  • getDescription() Returns the description for tasks.
  • getHint() Returns the hint for tasks.
  • isCompleted() Checks if quest is completed.
  • getTriggerCount() Returns how many times task is triggered.
  • getRequiredTriggers() Returns the number of triggers required to complete this task.
  • isFailed() Checks if task is failed.
  • failTask() Marks the task as failed.
  • handleEvent() Handles an event related to the task.

QuestManager (extends component): Manages, tracks and updates the quests within the game. Handles the storage and retrieval of quests and integrates with the event system.

Attributes:

  • quests Map to store quests.
  • logger Logger for logging quest related attributes.
  • questComplete Sound effect for quest completion.
  • relevantQuests Map of relevant quests. As of Sprint 1 the String[] should contain only one quest as only one is accessed.
  • achievements Array to store achievements.
  • questComplete Sound effect for quest completion.
  • achievementComplete Sound effect for achievement completion.
  • player The player Entity.

Methods:

  • createQuestDialogues() Sets up the dialogue for quests and NPC integration.

  • setupItemCollectionsTask() Setup item collection task listener.

  • setupAchievements() Setup achievements task listener.

  • handleMiniGameAdvancement() Subscribes to mini game triggers and sends it as a specific achievement completion trigger.

  • handleEnemyAdvancement() Subscribes to enemy beaten triggers and sends it as a specific achievement completion trigger.

  • handleItemAdvancement() Subscribes to item triggers and sends it as a specific achievement completion trigger.

  • handleEnemyQuest() Setup enemy task listener.

  • addQuests(Task[] tasks, Map<DialogueKey, String[]> guideQuestDialogues) Adds quests to the games quest list.

  • subscribeToQuestEvents(QuestBasic quest) Subscribes to event notifications for tasks quest.

  • subscribeToAchievementEvents(QuestBasic quest) Adds a listener for the achievement, which completes the achievement when triggered.

  • addQuest(QuestBasic quest) Adds a new quest to the manager.

  • loadQuest() Automatically loads and registers all of the quests stored in GameState.

  • getAllQuests() Gets a list of all quests in QuestManager.

  • getQuest(String questName) Returns a quest by name.

  • failQuest(String questName) Checks if quest is failed.

  • progressQuest(String questName, String taskName) Progresses the quest based on completion and updates the quest status.

  • canProgressQuest(QuestBasic quest, String taskName) Determines if a quest can be progressed based on its current state and the provided task name.

  • getActiveQuests() Gets the list of active quests.

  • completeAchievement() Completes the achievement by changing the state of the achievement and triggering an achievement popup

  • completeTask(QuestBasic quest) Completes the task of the updates the quest progression.

  • handleQuestCompletion(QuestBasic quest) Handle quest completion.

QuestPopup (extended Component) : popup UI that displays a popup message when a quest is completed.

Attributes:

  • showing Flag to see if popup is displaying
  • questCompleted Label for quest completion.
  • fontScale Scale of font size.
  • questDetails Label for quest details.

Methods:

  • addActors() Adds the listener for the label to trigger the popup.
  • create() Initializes the component and adds event listener.
  • showQuestCompletedPopup() Displays the label popup and draws it.
  • draw(SpriteBatch batch) Draws the popup message and creates label.

QuestBuilder: A builder class for the quest, wrapping the private constructor.

Attributes:

  • name: The name of the quest.
  • description: A description of the quest (default is an empty string).
  • tasks: A list of tasks associated with the quest.
  • dialogueKeys: A list of dialogue keys linked to the quest.
  • triggers: A list of triggers that activate the quest.
  • active: A boolean indicating whether the quest is currently active (default is false).
  • failed: A boolean indicating whether the quest has failed (default is false).
  • index: An integer representing the current task index (default is 0).
  • follow: A list of prerequisite quests that must be completed before this quest.

Methods:

  • QuestBuilder setDescription(): Sets the description of the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder addTask(): Adds a task to the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder addDialogueKey(): Adds a dialogue key to the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder addTrigger(): Adds a trigger to the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder setActive(): Sets the active state of the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder setIndex(): Sets the task index of the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder addFollowQuest(): Adds a prerequisite quest to the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder setFailed(): Sets the failed state of the quest and returns this QuestBuilder instance for me

AchievementDisplay: Display that contains all of the UI elements of the achievements page

Attributes:

  • logger Logs processes for debugging purposes
  • game The game
  • rootTable The libgdx table that contains every UI element on the achievements page

Methods:

  • create Create the page and populate it with UI elements
  • addActors add UI elements to the page
  • makeAchievementsTable Create and populate the UI element containing every achievement
  • makeMenuBtns Create the menu buttons, mainly the exit button
  • exitMenu Go back to the main menu
  • dispose dispose of the page These diagrams help to visualise the design and interactions between the quest management, tasks and UI elements in the game.

AchievementPopup: UI element that pops up on the game screen whenever an achievement is completed

Attributes:

  • showing Flag indicating whether the popup is showing or not.
  • popup The image of the popup.

Methods:

  • create() Initializes the class, adds a listener for achievement completion.
  • showPopup() Show the popup on the screen and save the completed achievement's status.
  • draw() Draws the popup, handled by the stage.
  • generate() Creates the popup and positions it on the screen.
  • dispose() Disposes of the popup.

AchievementManager: Manages the achievements in the game by loading them from a config file.

Attributes:

  • achievements The list of achievements.

Methods:

  • getAchievements() Returns the current save (list of all achievements).
  • saveAchievements() Saves the provided list of achievements to the save 'saves/achievements.json'.

Achievement: Represents an achievement.

Attributes:

  • questName Gets the quest names.
  • questDescription Gets the quest descriptions.
  • completed Flag to check if completed.
  • seen Flag to check if seen.
  • type Checks the achievement type.
  • iconPath Gets icon path.

Methods:

  • getQuestName() Returns the quest's name as a String.
  • getQuestDescription() Returns the quest's description as a String.
  • isCompleted() Checks if the achievement has been completed; returns true if completed, false otherwise.
  • complete() Marks the achievement as completed.
  • isSeen() Checks if the achievement has been seen; returns true if seen, false otherwise.
  • setSeen() Marks the achievement as seen.
  • getType() Returns the achievement type.
  • getPath() Returns the file path to the achievement's icon.
  • toString() Returns a string representation of the achievement.

Package: com.csse3200.game.Overlays;

This UML diagram represents an overview of the Overlays classes in the game, detailing their structure and interactions within the project.

Overlay

Note: the green unlock symbol means public, the orange key means protected and the red lock means private.

the little hats on the (f) means final variable and, the star on the (f) means static variable

For further information regarding the UML diagram please checkout Overlays Wiki Page -> Overlays

The UML diagrams showcase the connections throughout the packages and overlay quests.

References:

  • Sonar cloud was used for testing purposes for the com.csse3200.game.components.quests package while the com.csse3200.game.Overlays package was visually tested, along with all the methods that were not visually tested in the com.csse3200.game.components.quests package.
Screenshot 2024-10-16 at 10 29 52 pm

Quest Structure:

Each quest consists of:

Objectives: Specific tasks that need to be completed to progress.

Tasks: Individual tasks that must be accomplished as part of the quest.

Hints: Provided through the quest display (through the pause menu opened by pressing 'esc' key or pressing 'q').

Dialogue: String arrays to be given to players by NPCs through dialogue boxes to aid players in completing objectives.

Completion Criteria: Conditions that must be met for the quest to be considered complete i.e. tasks and triggers.

Sequence diagrams

Quest progression

Sequence diagram

Player input

Sequence diagram

Talk to guide tasks progression

image

Example usage:

Tasks

Tasks are initialized like:

 Task talkToWaterSage = new Task(
                "talkToWaterSage",
                "Talk to the Water Sage",
                "Speak with the Water Sage to gain their trust and begin your quest.",
                1, 0, false, false
        );

DialogueKey

To set up dialogue string arrays, e.g.:

 String[][] defeatWaterBossDialogue = {
                {"When you’re prepared, confront the Sky Seraph in an epic battle!"}
        };

To map up NPC character dialogue for test tasks to the dialogue string arrays:

dialogues.add(new DialogueKey("Cow", cowInitialDialogue));

Quest (extents AbstractQuest)

To initialise a basic quest with the values of your choice:

quest = new QuestBasic("First Steps", "Take your first steps in this world!", List.of(stepsTask), false, null, null, true, false, 0, null);

QuestManager (extends Component)

Managing dialogue:

List<DialogueKey> dialogues = new ArrayList<>();
dialogues.add(new DialogueKey("Cow", cowInitialDialogue));
return dialogues;

Completing and updating quests:

if (questManager.isQuestComplete("Final Boss")) {

    questManager.triggerFinalBoss();

}
questManager.updateQuestDisplay();

QuestDisplay

How to create a new instance of QuestDisplay:

QuestDisplay questDisplay = new QuestDisplay();

How to initialise and create the display:

questDisplay.create();

QuestPopup

How to create an instance of QuestPopup:

QuestPopup questPopup = new QuestPopup();

Initialise the popup UI component:

questPopup.create();

How to update and draw:

questPopup.update();
questPopup.draw(new SpriteBatch());

Achievements

Making an achievement:

Achievement achievement = new Achievement("Test Achievement", "Achievement Description");

Adding an achievement to the achievements page: In AchievementsDisplay, makeAchievementsTable()

Label achievementName = new Label("Test Achievement", skin);
Label achievementDescription = new Label("Lorem ipsum", skin);
table.add(achievementName);

Using a new AchievementPopup:

AchievementPopup popup = new AchievementPopup();
...
// in PlayerFactory, or a derivative
Player.addComponent(popup);

Testing plan:

The testing plan is as follow:

Creation: Ensure quests are created with accurate objectives and tasks.

Progression: Verify that quests progress correctly through task completions.

Completion: Test that quests are marked as complete when all criteria are met, not report false completions.

Interactions: Check that NPC interactions and dialogue boxes function as expected.

Wiki links:

QuestBasicTests

TaskTest

QuestManagerTest

InventoryCollectionTest

AchievementTest

AchievementManagerTest

QuestTest

The display, overlays and achievements were visually tested in the form of YouTube videos (p.s. if you are a tutor, please see team 5's sprint achievement forms)

UML Diagram:

This UML diagram represents an overview of the Quests system in the game, detailing their structure and interactions within the project.

quests

Note: the green unlock symbol means public, the orange key means protected and the red lock means private.

the little hats on the (f) means final variable and, the star on the (f) means static variable

Class Descriptions:

* com.csse3200.game.components.AbstractQuest

* com.csse3200.game.components.DialogueKey

* com.csse3200.game.components.Quest

* com.csse3200.game.components.QuestManager

* com.csse3200.game.components.QuestPopup

* com.csse3200.game.components.Task

* com.csse3200.game.components.QuestDisplay

* com.csse3200.game.components.QuestOverlay

* com.csse3200.game.components.QuestHidden

* com.csse3200.game.components.AchievementDisplay

* com.csse3200.game.components.AchievementPopup

* com.csse3200.game.components.AchievementManager

* com.csse3200.game.components.TabButton

* com.csse3200.game.components.LogButton

Package: com.csse3200.game.components.quests;

This package contains all the classes for quests in the game.

Quest : An abstract Quest class that contains the design for Quest classes that store quest and subtask progression (# of subtasks completed), descriptions and hints.

Attributes:

  • quest Name The name of the quest.
  • questDescription A description of the task.
  • tasks taskArray indexing corresponds to number of tests completed and each entry consists of the task to be completed during this step.
  • isAchievement True if quest achievement has been unlocked.
  • isSecretQuest True if the quest is hidden (possible xp and levels).
  • isActive True if quest is active (not completed or failed).
  • questDialoguequestDialogue is a list that relatesDialogueKey(String npcName, Integer ProgressionLevel) to a dialogue map relevant to the npc
  • taskCompletionTriggers Triggers for task completion.
  • currentTaskIndex Number of tasks completed for current quest.

Methods:

  • getQuestName() Returns quest name.
  • getTasks() Returns task array for quest subtasks.
  • isQuestCompleted() Returns true if quest is completed.
  • getProgression() Returns number of quest subtasks completed.
  • getCurrentTaskDescription() Returns the description of the current subtask being completed for a test or "QUEST COMPLETED" if the quest is completed.
  • getCurrentTaskHint() Returns the hint for the current subtask being completed for a test or "QUEST COMPLETED" if the quest is completed.
  • progressQuest() Progress (increments) number of quest subtasks completed.
  • isFailed() Returns true if quest is failed.
  • failQuest() Earmarks quest as having failed.
  • getQuestDescription() Returns a description of the quest.
  • getNumTasksToComplete() Returns the number of tasks to be completed for an individual test.
  • getNumQuestTasks() Returns the number of tasks for a quest.
  • isAchievement() Returns true if quest achievement has been unlocked.
  • isSecret() Returns true if the quest is secret (e.g. progression, XP, etc).
  • isActive() Returns true if the quest is active.
  • setActive() Sets the quest to an active status.
  • getQuestDialogue() Returns the dialogue associated with the quest.
  • getFollowQuests Return the next following quest.

Task: Handles the tasks for each quest.

Attributes:

  • taskName The name of the task.
  • description A description of what the task involves.
  • hint A hint related to completing the task.
  • requiredTriggers The number of triggers required to complete task.
  • triggerCount Number of times a task has been triggered.
  • completed True if the task is completed.
  • failed True if the task has failed.

Methods:

  • getTaskName() Returns the task name.
  • getDescription() Returns the description for tasks.
  • getHint() Returns the hint for tasks.
  • isCompleted() Checks if quest is completed.
  • getTriggerCount() Returns how many times task is triggered.
  • getRequiredTriggers() Returns the number of triggers required to complete this task.
  • isFailed() Checks if task is failed.
  • failTask() Marks the task as failed.
  • handleEvent() Handles an event related to the task.

QuestManager (extends component): Manages, tracks and updates the quests within the game. Handles the storage and retrieval of quests and integrates with the event system.

Attributes:

  • quests Map to store quests.
  • logger Logger for logging quest related attributes.
  • questComplete Sound effect for quest completion.
  • relevantQuests Map of relevant quests. As of Sprint 1 the String[] should contain only one quest as only one is accessed.
  • achievements Array to store achievements.
  • questComplete Sound effect for quest completion.
  • achievementComplete Sound effect for achievement completion.
  • player The player Entity.

Methods:

  • createQuestDialogues() Sets up the dialogue for quests and NPC integration.

  • setupItemCollectionsTask() Setup item collection task listener.

  • setupAchievements() Setup achievements task listener.

  • handleMiniGameAdvancement() Subscribes to mini game triggers and sends it as a specific achievement completion trigger.

  • handleEnemyAdvancement() Subscribes to enemy beaten triggers and sends it as a specific achievement completion trigger.

  • handleItemAdvancement() Subscribes to item triggers and sends it as a specific achievement completion trigger.

  • handleEnemyQuest() Setup enemy task listener.

  • addQuests(Task[] tasks, Map<DialogueKey, String[]> guideQuestDialogues) Adds quests to the games quest list.

  • subscribeToQuestEvents(QuestBasic quest) Subscribes to event notifications for tasks quest.

  • subscribeToAchievementEvents(QuestBasic quest) Adds a listener for the achievement, which completes the achievement when triggered.

  • addQuest(QuestBasic quest) Adds a new quest to the manager.

  • loadQuest() Automatically loads and registers all of the quests stored in GameState.

  • getAllQuests() Gets a list of all quests in QuestManager.

  • getQuest(String questName) Returns a quest by name.

  • failQuest(String questName) Checks if quest is failed.

  • progressQuest(String questName, String taskName) Progresses the quest based on completion and updates the quest status.

  • canProgressQuest(QuestBasic quest, String taskName) Determines if a quest can be progressed based on its current state and the provided task name.

  • getActiveQuests() Gets the list of active quests.

  • completeAchievement() Completes the achievement by changing the state of the achievement and triggering an achievement popup

  • completeTask(QuestBasic quest) Completes the task of the updates the quest progression.

  • handleQuestCompletion(QuestBasic quest) Handle quest completion.

QuestPopup (extended Component) : popup UI that displays a popup message when a quest is completed.

Attributes:

  • showing Flag to see if popup is displaying
  • questCompleted Label for quest completion.
  • fontScale Scale of font size.
  • questDetails Label for quest details.

Methods:

  • addActors() Adds the listener for the label to trigger the popup.
  • create() Initializes the component and adds event listener.
  • showQuestCompletedPopup() Displays the label popup and draws it.
  • draw(SpriteBatch batch) Draws the popup message and creates label.

QuestBuilder: A builder class for the quest, wrapping the private constructor.

Attributes:

  • name: The name of the quest.
  • description: A description of the quest (default is an empty string).
  • tasks: A list of tasks associated with the quest.
  • dialogueKeys: A list of dialogue keys linked to the quest.
  • triggers: A list of triggers that activate the quest.
  • active: A boolean indicating whether the quest is currently active (default is false).
  • failed: A boolean indicating whether the quest has failed (default is false).
  • index: An integer representing the current task index (default is 0).
  • follow: A list of prerequisite quests that must be completed before this quest.

Methods:

  • QuestBuilder setDescription(): Sets the description of the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder addTask(): Adds a task to the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder addDialogueKey(): Adds a dialogue key to the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder addTrigger(): Adds a trigger to the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder setActive(): Sets the active state of the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder setIndex(): Sets the task index of the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder addFollowQuest(): Adds a prerequisite quest to the quest and returns this QuestBuilder instance for method chaining.
  • QuestBuilder setFailed(): Sets the failed state of the quest and returns this QuestBuilder instance for me

AchievementDisplay: Display that contains all of the UI elements of the achievements page

Attributes:

  • logger Logs processes for debugging purposes
  • game The game
  • rootTable The libgdx table that contains every UI element on the achievements page

Methods:

  • create Create the page and populate it with UI elements
  • addActors add UI elements to the page
  • makeAchievementsTable Create and populate the UI element containing every achievement
  • makeMenuBtns Create the menu buttons, mainly the exit button
  • exitMenu Go back to the main menu
  • dispose dispose of the page These diagrams help to visualise the design and interactions between the quest management, tasks and UI elements in the game.

AchievementPopup: UI element that pops up on the game screen whenever an achievement is completed

Attributes:

  • showing Flag indicating whether the popup is showing or not.
  • popup The image of the popup.

Methods:

  • create() Initializes the class, adds a listener for achievement completion.
  • showPopup() Show the popup on the screen and save the completed achievement's status.
  • draw() Draws the popup, handled by the stage.
  • generate() Creates the popup and positions it on the screen.
  • dispose() Disposes of the popup.

AchievementManager: Manages the achievements in the game by loading them from a config file.

Attributes:

  • achievements The list of achievements.

Methods:

  • getAchievements() Returns the current save (list of all achievements).
  • saveAchievements() Saves the provided list of achievements to the save 'saves/achievements.json'.

Achievement: Represents an achievement.

Attributes:

  • questName Gets the quest names.
  • questDescription Gets the quest descriptions.
  • completed Flag to check if completed.
  • seen Flag to check if seen.
  • type Checks the achievement type.
  • iconPath Gets icon path.

Methods:

  • getQuestName() Returns the quest's name as a String.
  • getQuestDescription() Returns the quest's description as a String.
  • isCompleted() Checks if the achievement has been completed; returns true if completed, false otherwise.
  • complete() Marks the achievement as completed.
  • isSeen() Checks if the achievement has been seen; returns true if seen, false otherwise.
  • setSeen() Marks the achievement as seen.
  • getType() Returns the achievement type.
  • getPath() Returns the file path to the achievement's icon.
  • toString() Returns a string representation of the achievement.

Package: com.csse3200.game.Overlays;

This UML diagram represents an overview of the Overlays classes in the game, detailing their structure and interactions within the project.

Overlay

Note: the green unlock symbol means public, the orange key means protected and the red lock means private.

the little hats on the (f) means final variable and, the star on the (f) means static variable

For further information regarding the UML diagram please checkout Overlays Wiki Page -> Overlays

The UML diagrams showcase the connections throughout the packages and overlay quests.

References:

  • Sonar cloud was used for testing purposes for the com.csse3200.game.components.quests package while the com.csse3200.game.Overlays package was visually tested, along with all the methods that were not visually tested in the com.csse3200.game.components.quests package.
Screenshot 2024-10-16 at 10 29 52 pm
Clone this wiki locally