How epitech-it-2028/r-type works
Project type and purpose
• Full‐stack, real‐time networked game: authoritative C++ server, C++ client, shared “core” libraries, custom ECS game‐engine, plus a Python admin UI.
• Purpose: demo modern C++ (ECS, networking, patterns), support up to 4 players in an R‐Type‐style shoot ’em up with UDP, Raylib graphics, and persistent data in SQL.
File‐structure analysis
• Top‐level modules
• admin/ – Python textual UI to manage bans, players, scores via db.sql
• client/ – C++ game client (Raylib rendering, ECS usage, packet send/receive)
• server/ – C++ authoritative server (ASIO UDP, game logic, DB ops, event queue)
• core/ – Shared C++ modules: parser, errors, network (Base/Client/ServerNetworkManager), serializers, utils
• game_engine/ – Custom ECS engine (ComponentManager, SystemManager, components, systems, tags)
• docs/, README*, build.sh, CMakeLists, conanfiles
• Patterns & build
• ECS for game objects
• Mediator (NetworkManager), Command (input/packets), Observer (event queue)
• CMake + Conan, build.sh wrapper
Insights from README
• Client‐Server Architecture: UDP, custom binary protocol
• Shared code: core/ (network) and game_engine/ (ECS) used by both client and server
• Python admin connects directly to the same SQL schema (db.sql)
Components
a. Main components
1. Players (Human input)
2. Client executable
• InputSystem → Command packets
• Core::ClientNetworkManager → PacketBuilder → UDP socket
• GameEngine ECSManager → update Systems → RenderManager (Raylib)
3. Server executable
• ASIO UDP Listener
• Core::ServerNetworkManager → PacketHandler Factory
• Game logic (GameManager, Challenge, GameRoom)
• Event Queue (Observer) → ECS “ServerInputSystem”, EnemySystem, etc.
• DatabaseManager → SQL storage
4. Database (e.g., SQLite/PostgreSQL via db.sql)
5. Admin Panel (Python/Textual)
• Connects to Database
• CRUD on players, scores, bans
6. Shared Libraries
• core/ (network, parser, utils)
• game_engine/ (ECS)
b. Relationships & data flows
• Player → Client: input events
• Client → Server: UDP packets (move, shoot, heartbeat)
• Server → Client: UDP packets (state updates, spawn, destroy)
• Server ↔ Database: persistent game state, high scores, bans
• Admin ↔ Database: view/edit data
• Client uses Raylib via RenderManager for graphics
c. Architectural patterns & design principles
• Entity‐Component‐System decouples data & logic
• Mediator in NetworkManager centralizes message routing
• Command pattern encapsulates input/packet handling
• Observer via EventQueue for server‐side events
d. Key technologies & frameworks
• C++20, CMake, Conan/vcpkg
• Raylib (graphics & audio)
• Asio (networking)
• Python/Textual (admin UI)
• SQLite/PostgreSQL (database)
• GoogleTest (tests)