How ali5917/captale works
Project type and purpose
• This is a native C++ object-oriented desktop game (“captale”) composed of multiple mini-games or “cities” (atmCity, carCity, earnCity, etc.), built as part of an OOP course.
• Key activities include initializing the game engine, loading assets (graphics, audio, fonts), driving the main game loop, switching between scenes (cities), handling input, timing, and rendering.
File structure
• Top level:
• main.cpp — entry point and core game loop
• headers/ — all class and module interface definitions (scene controllers, timer, message, settings, sprites)
• assets/ — grouped by scene, containing images, audio, fonts, and data files
• Makefile and .gitignore for build and version control
• Pattern: a central “Engine” or “GameManager” in main.cpp that delegates to per-scene classes (ATM City, Car City, etc.). Scenes implement a common interface (in headers/*.h). Asset loading is likely centralized or per-scene.
README
• Confirms it’s a game for an OOP project, no further architectural notes. We infer a modular design: core engine + pluggable scenes + shared utilities.
a. Main components
• Game Engine / GameManager (in main.cpp)
• Scene Manager (factory or controller that switches between scenes)
• Scene modules: ATM City, Car City, Custom City, Earn City, Energy City, Pong City, Space Shooter, Lobby, GameOver, Intro
• Asset Manager (loads images, audio, fonts, CSV data)
• Input Handler (keyboard/mouse events)
• Timer / Custom Timer
• Message Bus / Event System
• Settings Manager
• Sprite / Renderer subsystem
• External resource store (assets folder on disk)
b. Relationships and interactions
• Game Engine invokes Scene Manager each frame
• Scene Manager forwards update() and render() calls to the active Scene Module
• Scene Module requests assets from Asset Manager, issues playSound() or drawSprite()
• Input Handler feeds events into Message Bus or directly to the active Scene
• Timer triggers time-based events or scene transitions
• Settings Manager provides configuration (screen size, volume) to all subsystems
• Message Bus allows decoupled communication (e.g., a collision event in Space Shooter is broadcast)
c. Architectural patterns / design principles
• Strategy / Polymorphic Scene pattern: each city implements a common Scene interface
• Singleton or centralized Asset Manager and Settings Manager
• Event-driven design via Message Bus for loose coupling
• Modular folder structure: headers define interfaces, assets are externalized
d. Relevant technologies and frameworks
• Standard C++17 (or earlier)
• Makefile build system
• Custom rendering (probably SDL or OpenGL though not shown, inferred by OOP game class headers)
• CSV parsing in earnCity, WAV/MP3 audio files