Posted April 04, 2024 by GreyofDeath
#architecture #tech
Hello everyone,
Today we want to present to you, the technical structure of our project.
MiroBoard: https://miro.com/app/board/uXjVKZGz5wo=/?share_link_id=273428512034
Legende
First, let's start with the legend that shows you what each of the following elements means.
Core Elements: GameManager & DataBus
As our core, we have two singletons, the GameManager and the DataBus. The DataBus is transported through all the game scenes and menus and transports the relevant data for the fight (difficulty, enemies of the selected dish, winning image). The GameManager takes this data at the start of the scene and saves it with a lot of other information, like the current player object or the current enemy. He is the main source of truth for the game where every other element takes their needed information.
Player
The players logic is encapsulated in three main scripts: the PlayerHealthScript (Health and Knockback Management), the PlayerMovementScript (Walking and Jumping Management), and the PlayerActionScript (Hitting, Blocking, and Item Management). Every one of them handles exactly one major aspect of the player. If one of their functionalities requires a matching animation, they all call the PlayerAnimationScript, which handles the animations (which can interrupt which one and how to do that.
Enemy
The enemy logic is like the player's logic, split into multiple small scripts. This helps to keep the code reusable, modular, and adaptive too. Here, the enemy has some essential scripts (these are part of almost every enemy) and other optional scripts. Most of these scripts are self-explanatory, but maybe some of them need a bit of explanation:
Minions and Projectiles use some of these scripts too, but on a different scale and some changes.
GUI
All the GUI logic is managed through the GUI script, which takes the data from the GameManager to update the GUI elements.
Ingame Menus
All the in-game menus handle themselves alone. Like in all the other menus outside the fight, there is a ButtonHandler script that manages which buttons can be pressed, which one is the first one, and which one navigates back (important for the back-hotkeys and switch between controller and keyboard navigation).