How uge-l3-info-2023-2024/progc-chapelain_laborde works
Project type and purpose
• This is a standalone, monolithic Tower-Defense game (“Gemcraft”) implemented in C, using the libMLV graphics library.
• Its purpose is to run on Linux, read resource files (images, fonts, wave/map definitions), handle player input, simulate game logic (waves, mobs, towers, mana, inventory), and render graphics to the screen.
File structure
• Top-level build and doc files: Makefile, Doxyfile, README.md, doc/
• Headers under include/ and specialized subfolders:
• events/ : ButtonAction, DragAndDrop, FieldEvent, InventoryEvent
• graphic/ : Font, Graphic, GraphicButton, etc.
• tools/ : Button, DynamicArray, TimeManager, Utils, Error
• Sources under src/ with mirroring subfolders for events, graphic, tools
• Resources folder for fonts, images, metadata
• Logging stub under log_dev/
• Entry point: src/Main.c
README for additional insights
• Confirms use of libMLV for windowing and rendering
• Describes command-line options, game flow (waves, mana, gem combining, traps)
Main components
a. Core Game Engine
• Game state and loop (Game.c / Game.h)
• Parser: loads map/wave definitions (Parser.c / Parser.h)
• Pathfinding (Path.c)
b. Event Handling
• Unified Event dispatcher (Event.c / Event.h)
• Specialized events: ButtonAction, DragAndDrop, FieldEvent, InventoryEvent
c. Rendering / Graphic Layer
• Window and drawing primitives (Window.c / Graphic.c / Font.c)
• UI components: GraphicButton, GraphicField, GraphicInventory, GraphicOverlay
d. Utilities
• Data structures and helpers: DynamicArray, Utils, Error, TimeManager, Button (tools/)
e. Resources
• Assets folder (images/, fonts/), metadata.tex
f. External Dependency
• libMLV graphics library
Relationships and interactions
• Input (mouse, keyboard) → Event Handler → Game Engine
• Game Engine state updates → Rendering Layer via graphic APIs
• Game Engine requests resource loads via Parser and Tools
• TimeManager drives the main loop tick
• Utilities serve both engine and rendering layers
• libMLV underpins the Window/Graphic modules
Architectural patterns / design principles
• Modular separation by concern: core logic, event handling, rendering, utilities
• Header/source mirroring for clear interface boundaries
• Single-threaded, polling game loop driven by TimeManager
• Data-driven configuration via Parser for maps/waves
• Clear, human-readable labels for each module (corresponding to folders/files)
• Code modules vs. resources vs. external dependencies