Building a Solid Foundation: Exploring the 5-Layer Architecture of Forbidden Archives in Unity 3D
In Unity 3D game development, code architecture is a critical element for maintaining a coherent structure, enabling easy maintenance, and adding new features. In this initial devlog, I will introduce the five-layer architecture chosen for Forbidden Archives. It clarifies the roles of each component and facilitates communication among them.
Although the Entity Component System (ECS) architecture has performance benefits, I chose not to adopt it because of its complexity, given my lack of experience.
The Framework layer is a horizontal layer that includes generic functionality and reusable utility classes that can be used in any game or application. It is independent of the game context and does not have any specific gameplay logic. It provides tools for file manipulation, mathematical functions, data transformation, etc., and the classes are designed to be reusable in future applications.
The Model layer serves as a facade for the game, providing an abstract representation of the game’s data and functionality, irrespective of Unity3D’s specific low-level aspects. It does not contain any concrete implementation or logic, but instead offers a well-defined abstraction that other layers can use to communicate consistently.
The System layer contains the game’s gameplay logic and employs the “Framework” and “Model” layers to implement game mechanics. Systems that need to maintain state inherit from “ScriptableObject,” enabling system reference by UI elements or gameobject instances.
The Data layer includes concrete implementations of the interfaces defined in the “Model” layer. The classes are ScriptableObject and employ Unity3D-specific types for storing data like game objects, characters, levels, etc. It provides a concrete representation of game data, which can be displayed in the user interface. This layer also contains some assets that are as close as possible to the data that requires them.
The UI layer comprises everything that needs to be displayed on the screen, including user interfaces and prefabs instantiated and populated by the Data layer elements. It does not contain any significant business logic but acts as a link between the MonoBehaviour and the Systems.
While the separation between the Model and Data layers may add complexity, I hope it will improve System layer implementation. I will revise or adapt this architecture if new functionalities or technical constraints arise, and I will publish another devlog post to explain the changes and the reasons behind them.
The layered architecture enables the separation of game component responsibilities and facilitates communication among them. Each layer has a clear and well-defined role, making code understanding and maintenance easier.
The architecture outlined in this devlog was designed based on the game’s requirements and current development stage. However, as with any project, it is expected to evolve over time. If new functionalities or technical constraints arise, this architecture may need to be revised or adjusted. In such cases, I will publish another devlog post to discuss these changes and the rationale behind the decisions made.
Forbidden Archives
Uncover the hidden truths of Rosebury in this mystery-filled adventure of ancient books and forgotten knowledge.
Status | In development |
Author | ekioo |
Genre | Interactive Fiction, Adventure, Puzzle |
Tags | deduction, Mystery |
Languages | English, French |
Accessibility | Subtitles |
More posts
- Interface Improvements and the Introduction of 2D Sprite VisitorsMay 23, 2023
- Améliorations de l'Interface et Introduction des Visiteurs en 2DMay 23, 2023
- The Delicate Art of Crafting DoorsMay 20, 2023
- L'Art délicat de la Création de PortesMay 20, 2023
- Adding Doors for Environment ConstructionMay 06, 2023
- Ajout de portes pour la construction d'environnementsMay 06, 2023
- Recap de live #4 - Sauvegarde/Chargement et amélioration du Système de Constru...Apr 26, 2023
- Recap de live #3 - Input systemApr 14, 2023
- Recap de live #2 - House Building ToolApr 05, 2023
- Recap de live #1 - House Building ToolApr 04, 2023
Leave a comment
Log in with itch.io to leave a comment.