How rbardet/cub3d-de-la-commu works
Key Components
• Main Entry Point: Include the “srcs/main.c” which bootstraps the application.
• Parsing Module: Represented by the “srcs/parsing” directory. This module handles loading and validating map files (from the “maps” directory), setting up configurations such as textures (e.g., PNG loading) and RGB values.
• Graphics and Raycasting Engine: Captured in “srcs/raycasting”. This is the core of the rendering process that uses raycasting for 3D visualization. It includes calculation of rays, intersection tests, drawing routines, etc.
• Movement Module: In “srcs/movement” which processes player input and rotation, updating the player’s position within the world.
• Bonus Features: Modules like “srcs/bonus” contain additional elements like animated sprites, doors, and a minimap, which extend the base engine.
• Utility Functions: Found under “srcs/utils” which support debugging, structural management, and other common operations.
• Graphical Assets: The “graphic” directory contains media such as animations, videos (e.g., “john.mp4”), and texture packs that support the visual aspects of the engine.
• Configuration and Map Files: The “maps” directory holds different .cub files with various scenarios (valid, invalid, different design types) showcasing how the game levels are defined.
Relationships and Data Flow
• The Main Module initializes the application and calls the Parsing Module to load game configuration and level data.
• The Raycasting Module uses the provided configuration to render the 3D environment. It interacts with the Movement Module to update the player’s position so that scenes can be recalculated and redrawn in real time.
• The Bonus Modules integrate with the primary game loop to manage extended gameplay features (doors, animated sprites, minimap) and enhance the overall functionality.
• Utility modules are invoked by the other components for debugging output and for structured management of runtime data.
Architectural Patterns and Design Choices
• The structure is modular, clearly separating concerns such as input parsing, rendering (raycasting), and movement.
• There is likely a game loop that continuously updates the player’s state (movement) and renders the scene (raycasting).
• The project seems to follow a procedural design with separate functional units (or “modules”) and single-responsibility functions for tasks like parsing, drawing, and movement handling.