How santiagoruiz1314/arkanoid works
Main Components
• Game Core: This central module encompasses overall game state management, game state changes (start, pause, game over, win states), benchmarking routines, and high-level game logic (found in Assets/Scripts/Game).
• Input Management: Capture and process different devices’ inputs (keyboard, mouse, touch). This includes components such as PaddleInputData and dedicated input processing systems.
• Entity Systems (DOTS/ECS-based):
• Ball Systems – managing ball behaviors including spawning, collision resolution, ball loss, speed increases, etc.
• Block Systems – handling block spawning, hit detection, destruction, and the associated events.
• Paddle Systems – managing paddle movement, input processing, collision interactions, and death states.
• Laser and Power-ups Systems – cover power-up logic (Catch, Enlarge, Laser, etc.) and laser firing mechanisms.
• Audio Systems – manage sound playback for events such as ball loss, hits, power-up notifications, etc.
• Rendering Systems – utilizing specific shaders (e.g. UnlitST shader) and texture animations to achieve a retro look.
• Level Management – handling level loading, despawning, settings, and spatial configurations.
• UI Systems: Leveraging Unity’s UI scripts to show game panels, title screens, and HUD elements.
• Utilities and Helpers: Systems in Assets/Scripts/Utils that deal with cross-cutting concerns like math, refresh-rate adjustments, and general game logic utilities.
Relationships and Interactions
• Data flows in a DOTS/ECS architecture tend to be unidirectional, with clearly defined systems processing data from entities (components) in parallel.
• Inputs (from keyboard, mouse, or touch) are fed into the Paddle Input and other user input systems. This input alters component states which trigger corresponding behaviors (like moving the paddle or starting ball motion).
• The collisions and interactions (ball hitting blocks, paddle ball link, laser interactions) use DOTS Physics to detect and propagate events between relevant systems (e.g., BallCollisionResolvingSystem outputs events that the Blocks’ systems then consume).
• Rendering is decoupled from game logic: Although the ECS data is adjusted by various systems, the Rendering Systems retrieve the latest data (from components like MaterialColorData) to refresh the on-screen visuals.
• Audio systems subscribe to game events (ball lost, power-up received, level start, etc.) and trigger sound playback accordingly.
• The Level Management system coordinates the orchestration of game entities per level, ensuring the right prefabs (from Assets/Prefabs) are instantiated and managed.
Architectural Patterns and Design Principles
• Data-Oriented Programming: The project is structured to minimize random memory access by structuring components solely on “data” (components) with many systems iterating over them.
• Event-Driven Architecture: Many of the interactions (e.g., hit events, system triggers) are managed by posting events (found in Assets/Scripts/Events) that drive behavior in other systems.
• Separation of Concerns: While all systems work as part of a unified ECS setup, groups (e.g., Ball, Blocks, UI, Audio) are clearly defined in separate folders, indicating their focused responsibilities.
• Multithreading and Performance Optimization: With Jobs and Burst Compilation, the design emphasizes parallel processing and low-level performance tuning.
Including Relevant Technologies
• DOTS/ECS, Jobs System, Burst Compiler for simulation.
• URP and ShaderLab/HLSL for rendering.
• DOTS Physics for collision detection.
• C# as the primary programming language.
• External libraries or services if applicable (although the primary focus is on internal DOTS components).
• Ball, Blocks, Paddle, Laser, Power-Ups, and Level Systems.
• “Input Systems” feeding into “Game Core.”
• “DOTS Physics” interconnected with Ball/Block/Paddle systems.
• “Rendering Layer (URP & Shaders)” linked from the Game Core.
• “Audio Systems” receiving event-driven triggers from Game Systems.
• “UI Systems” from the game state changes and input feedback.
• “Utility Systems” supporting various subsystems.
• Optionally, demarcate the Benchmark Mode as interfacing with multiple systems to stress test performance.