Space Shooter - Modular Architecture
Project Overview
This prototype is a 2D top-down shooter built in Unity, designed to demonstrate scalable game architecture and solid software engineering principles. Unlike traditional prototypes that rely on tightly coupled scripts, this project utilizes modern design patterns to ensure maintainability and performance.
MVC Architecture
The Player logic is cleanly separated into three layers to avoid the "God object" anti-pattern:
- Model: Manages state (health, position) and core logic, broadcasting changes via C# delegates.
- View: Handles graphics and animations by listening to Model events.
- Controller: Processes PC/Mobile input and issues commands to the Model.
Strategy Pattern
Enemy and entity movement is governed by a dynamic strategy system. Instead of hardcoding behavior, agents use interchangeable strategies:
- Linear/Path/Target: Different movement logic derived from a base class.
- Steering: Includes Reynolds-style steering for organic motion.
- Runtime swapping of AI behaviors.
Observer Pattern
A central Event Bus (EventsManager) decouples global game systems. Systems broadcast events like GAME_OVER or WIN_GAME, allowing listeners (like UI or Audio) to react without direct dependencies.
Optimization & UI
High-performance systems to ensure a smooth experience:
- Object Pooling: Recycles bullets and enemies to prevent Garbage Collection spikes.
- UI State Machine: A stack-based system (Push/Pop) for layered menus, managed securely by the GameManager.
Explore the Source Code
Interested in the implementation details? Check out the full repository on GitHub.
View GitHub Repository