How goliasvictor/jogo. works
Project Type and Purpose
• This is a standalone 2D puzzle‐style game written in C# (.NET).
• It follows a lightweight custom engine architecture: a game loop in Program.cs → core Jogo class → scene management → entity‐component‐system (ECS) style updates → rendering & audio → input & UI.
• Assets (audio, sprite atlases, level definitions) are loaded at runtime via a ResourceLoader/AssetManager.
File Structure
Top‐level and key directories:
• src/Jogo
– Assets: audio files (mfx-*.wav, sfx-*.wav, audio-credits.txt)
– Entities: domain objects (blocks, floors, items, characters) + interfaces IElemental, IEntity, etc.
– GridVec2, Map, LevelLoader: coordinate/grid & map building from YAML levels.
– Scenes: IScene interface + MainMenu, LevelBuilder, LevelManager, LevelScene, ErrorScene.
– Systems: Audio, Collision, ElementalConflictSolver, ItemCollection, TickUpdate (implements ISystem).
– UI: core UIScene, HUD, LevelBuilderUI + UIComponent library (Container, Button, Text, Image, Flexbox, etc.).
– Sprite, SpriteAtlas: rendering primitives.
– Jogo.cs: main game class, orchestration of loop, initialization, scene manager, asset manager.
– Program.cs: entry point.
• src/Test: unit tests.
• res/: presumably placeholder for static resources (images, fonts, etc.).
README
• README contains only project title – no architecture notes.
• Use file structure as primary source for architectural intent.
Main Components and Interactions
a. Game Core
– Program.cs → Jogo (initializes subsystems, enters main loop).
– MainLoop: processes input, updates current Scene, renders frame, plays audio.
b. Resource/Asset Management
– ResourceLoader/AssetManager loads YAML (custom-levels.yaml), audio files, sprite atlas.
– Provides in‐memory assets to Systems & Scenes.
c. Scene Management
– SceneManager holds the active IScene (MainMenu, LevelScene, LevelBuilder, etc.).
– Scenes orchestrate Entities and UI for each game state.
d. ECS‐Style Systems
– Entities (blocks, characters, items) each implement IEntity + optional sub‐interfaces.
– Systems (CollisionSystem, TickUpdate, ElementalConflictSolver, ItemCollectionSystem, Audio) operate per frame on sets of Entities.
– Each System reads/writes Entity state; Jogo dispatches these systems every tick.
e. Level Loading
– LevelLoader reads custom‐levels.yaml → constructs Map + populates Entities per layer.
f. Rendering & Audio
– Audio system implements IAudio to play sound effects & music.
g. UI Layer
– UIScene + UIComponent library: containers, buttons, text, images.
– HUD overlays LevelScene; LevelBuilderUI overlays builder.
h. External Resources
– custom‐levels.yaml, audio files, (possible) sprite image files in res/.
Architectural Patterns & Principles
• Main loop + scene‐based state machine.
• Lightweight ECS: separation of data (Entities) and behavior (Systems).
• Modular UI component library (flexbox, containers, frames).
• Single Responsibility: ResourceLoader, LevelLoader, each System does one job.
• Dependency inversion for audio (IAudio) and systems (ISystem) for testability.
Final Touches
• You capture all directories: Entities, Systems, UI, Scenes, Assets, Levels.
• Use annotations for patterns (e.g., “Implements ISystem interface”).