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.luaandSaveManager.lua. - UI Scripts: Control user interface components, such as
UIMain.luaandUIDressUp.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.luainitializes other managers. - It communicates with
SaveManager.luato load saved data. - It triggers
QuestManager.luaandContestManager.luato 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.luatracks its status. - Upon completion, it calls
LootManager.luato 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.luacollects 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.lualoads 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.luato 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.luadisplays 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.luaduring initialization and shutdown.UIDressUp.lua,QuestManager.lua,ContestManager.lua: Retrieve and update save data.
-
Workflow Example:
- At startup,
GameManager.luacallsSaveManager.luato 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.luaupdates its state.
- A player interacts with an NPC, triggering
Updated 10 months ago