How asdt123/projeto-poo-2024-1 works
Project type and purpose
• This is a standalone 2D arcade-style game written in Python, inspired by Asteroids.
• Its primary goal is to let players choose a ship, load skins, fight aliens, collect drops, and enjoy a nostalgic experience.
File structure
• Top-level files:
• README.md – project description
• game.py – main entry point and game loop
• configurações/Config.py – global settings loader
• database/jogadores.db + root jogadores.db – SQLite files storing player progress or scores
• UML/ – design artifacts
• fontes, imagens/ – static assets (fonts, sprites, backgrounds)
• modulos/ package:
• modulos/personagens – domain entities (Player, Nave, Alien, Drops, Arsenal, Conta)
• modulos/janelas – UI layers (Janelas, Botões, Animações)
Key insights from README
• Built with Python, using OOP principles
• No external servers or microservices – everything runs locally
• Game mechanics, skin selection, and 2D rendering
Main components
a. Game Engine (game.py)
– Initializes subsystems, runs the main loop (initialize → input → update → render → loop).
b. Configuration Manager (configurações/Config.py)
– Reads config values (screen size, asset paths, difficulty).
c. Asset Manager
– Loads images (imagens/) and fonts (fontes/) at startup.
d. Entities Module (modulos/personagens)
– Defines game objects: Player/Nave, Alien, Drops, Conta, Arsenal – each with state and behavior.
e. UI Module (modulos/janelas)
– Handles menus, buttons, animations, HUD overlays.
f. Database Manager
– Encapsulates read/write operations on jogadores.db for saving high scores or player data.
Relationships and interactions
• The Game Engine calls Configuration Manager at startup, then hands off asset paths to Asset Manager.
• In each frame:
1. Input → Game Engine → evaluates via Entities Module (e.g., move Player).
2. Update → Entities Module updates positions, collisions, score (possibly invokes Database Manager on game over).
3. Render → UI Module draws menus, HUD; Asset Manager provides textures.
• Database Manager is invoked on “save profile” or “load profile” events in modulos/personagens/Conta.
Architectural patterns and principles
• Layered architecture:
• Presentation layer (UI Module)
• Domain layer (Entities Module)
• Infrastructure layer (Config, Asset, Database Managers)
• Single responsibility: each module deals with one concern (e.g., Config.py only reads settings).
• Dependency direction: higher-level modules (Game Engine) depend on lower-level services (config, assets, DB), not vice versa.
Technologies and frameworks
• Python standard library + pygame (presumed for rendering/input).
• SQLite for persistence.