A repository for "Forest Feller" game source code
Genre: hyper-casual, hybrid-casual
Mechanics: collecting, stacking, producing
Unity version: 2021.3.18f1 (LTS)
Accessibility: due to the use of some copyrighted assets in this project (Adobe Mixamo), the project cannot be freely explored in Unity
This project implements the Composition Over Inheritance principle to create the system that relies on horizontal relations between different game parts. Rather than relying on inheritance from a base or parent class, the project is using composition to achieve polymorphic behavior and code reuse. In this project, composition is achieved by extensive use of interfaces and carefully structured entity systems. Entities are created by composing various little reusable components, enabling flexible and modular design. For instance, the Factory entity comprises the ResourceReceiver, Factory, Storage, and ResourceProvider components. Similarly, the Player entity is composed of the InteractableDetector, ResourceReceiver, ResourceStack, Storage, and ResourceProvider components. By adding or replacing these reusable components, we can achieve diverse and customizable behavior.
This project implements Dependency Inversion Principle. Thanks to thanks to the extensive use of interfaces, high level modules do not depend upon low level modules. Both depend upon abstractions.
This project implements Interface Segregation Principle. All interfaces are small and specific, keeping the code decoupled and thus easier to change and refactor.
This game uses object pooling to efficiently manage and reuse gameobjects within the game. Object pooling minimizes the overhead of creating and destroying bullet objects dynamically, resulting in improved performance and reduced memory allocation. Code
Class responsibilities in this project are well defined and separated. Each class is responsible for only one thing. Code
This game uses an event system to handle in-game events such as GameEndEvent or GameResetEvent. The event system is implemented uisng ScriptableObjects, making it simple, convenient and extendible. The event system consists of 2 classes: GameEvent and GameEventListener. GameEvent class provides a way to create custom game events that can be triggered by different components. It allows for flexible event handling and communication between different parts of the game. GameEventListener class is responsible for listening to a specific GameEvent and triggering a UnityEvent response when that event is raised. GameEventListener can be attached to any gameobject. Event system is implemented using observer pattern.
This project has custom editor window, that is used to construct and save levels. Upon dragging gameobjects to the scene, gameobjects with component derived from the Spawnable class will automatically have a corresponding data class generated and saved to level definition when the "Save Level Definition" button is pressed. This approach provides convinient and flexible way for level creation. Levels are stored as LevelDefinition ScriptableObjects. LevelDefinition class consists of 3 parts: the length of the level, the width of the level and an array of data classes for spawnables, that contain all the necessary information to instantiate spawnables at runtime.
This project uses prefab-based design approach, utilizing the power of prefabs to create and organize all game parts. Prefab-based approach allows for reusability, efficiency, easier testing, better collaboration and significant time and effort savings when implementing new features to some game parts. Additionally it allows for more convenient game initialization and dependency resolving.