Script Relations
This document outlines how the various scripts in the game interact with each other to create a cohesive gameplay experience. Understanding these relationships will help developers grasp the architecture and workflow of the game.
High-Level Overview
The game's scripts are modular and grouped by functionality. Here are the primary categories and their connections:
- Core Scripts: Centralized management of game-wide logic, such as
GameManager.lua
andSaveManager.lua
. - UI Scripts: Control user interface components, such as
UIMain.lua
andUIDressUp.lua
. - Gameplay Mechanics: Handle specific features like contests (
ContestManager.lua
), quests (QuestManager.lua
), and rewards (LootManager.lua
). - Utility Scripts: Provide reusable functions (e.g.,
OutfitUtils.lua
).
Key Relationships
1. GameManager.lua
The GameManager.lua
script acts as the central hub, coordinating between other systems.
-
Connected Scripts:
QuestManager.lua
: Manages quest progression and integrates with the main game flow.SaveManager.lua
: Saves and loads player progress.ContestManager.lua
: Tracks active contests and their results.
-
Workflow Example:
- When the game starts,
GameManager.lua
initializes other managers. - It communicates with
SaveManager.lua
to load saved data. - It triggers
QuestManager.lua
andContestManager.lua
to update their states based on player progress.
- When the game starts,
2. QuestManager.lua
The QuestManager.lua
script handles quests, ensuring seamless integration with NPCs and rewards.
-
Connected Scripts:
DialogManager.lua
: Provides quest-related dialogue.LootManager.lua
: Distributes rewards upon quest completion.UIDialog.lua
: Displays quest prompts to the player.
-
Workflow Example:
- A player interacts with an NPC, triggering
DialogManager.lua
. - If a quest is accepted,
QuestManager.lua
tracks its status. - Upon completion, it calls
LootManager.lua
to reward the player.
- A player interacts with an NPC, triggering
3. ContestManager.lua
The ContestManager.lua
script orchestrates the dress-up contests, including submissions, voting, and results.
-
Connected Scripts:
UIContest.lua
: Displays the contest interface.UIContestVoting.lua
: Handles the voting interface.LootManager.lua
: Distributes rewards based on contest rankings.
-
Workflow Example:
- Players submit their looks through
UIContest.lua
. ContestManager.lua
collects and organizes entries.- Voting is conducted via
UIContestVoting.lua
, and results are processed byLootManager.lua
.
- Players submit their looks through
4. UIDressUp.lua
The UIDressUp.lua
script powers the customization interface, allowing players to modify their characters.
-
Connected Scripts:
OutfitUtils.lua
: Provides utility functions for managing outfits.UIDressUpCloset.lua
: Manages inventory and available items.
-
Workflow Example:
- Players open the customization menu via
UIDressUp.lua
. UIDressUpCloset.lua
loads available outfits.- Changes are applied and saved using
OutfitUtils.lua
.
- Players open the customization menu via
5. LootManager.lua
The LootManager.lua
script distributes rewards for contests, quests, and other achievements.
-
Connected Scripts:
QuestManager.lua
: CallsLootManager.lua
to reward players after quest completion.ContestManager.lua
: Distributes rewards based on contest results.UIReward.lua
: Displays the reward notifications to players.
-
Workflow Example:
- A quest or contest triggers
LootManager.lua
. - Rewards are calculated and assigned to the player.
UIReward.lua
displays the rewards.
- A quest or contest triggers
6. SaveManager.lua
The SaveManager.lua
script handles saving and loading player progress.
-
Connected Scripts:
GameManager.lua
: Communicates withSaveManager.lua
during initialization and shutdown.UIDressUp.lua
,QuestManager.lua
,ContestManager.lua
: Retrieve and update save data.
-
Workflow Example:
- At startup,
GameManager.lua
callsSaveManager.lua
to load player data. - Gameplay systems (e.g., quests, customization) retrieve necessary data.
- Progress is saved periodically or when the game exits.
- At startup,
7. DialogManager.lua
The DialogManager.lua
script manages NPC dialogues and interactions.
-
Connected Scripts:
QuestManager.lua
: Provides quest-related dialogue.UIDialog.lua
: Displays dialogue options to the player.
-
Workflow Example:
- A player interacts with an NPC, triggering
DialogManager.lua
. - Dialogue options are displayed via
UIDialog.lua
. - If a quest is involved,
QuestManager.lua
updates its state.
- A player interacts with an NPC, triggering