How jackhumbert/let_there_be_flight works
• Core Mod Logic (the “Mod Core”): This includes the main entry point (src/red4ext/Main.cpp) and the overall orchestration of the mod’s hooking/injection into Cyberpunk 2077. It encompasses the FlightSystem, FlightController, and the various flight submodules.
• Flight Subsystems: Break these down further into:
– Flight Mechanics & Configuration: Components include FlightConfiguration, FlightEvents, FlightSettings, and the configuration classes (like CarFlightConfiguration, SixWheelCarFlightConfiguration, etc.).
– Visual Components: Camera (FlightCamera), UI elements (handled partly in Redscript under src/redscript/UI), and any particle or effects code.
– Audio Components: The FMOD integration provided under src/fmod_studio and the Audio code in src/red4ext/Audio (including FmodHelper). These handle the custom audio effects like explosion audio cues and engine sounds.
• Hooking & Patching Infrastructure: This includes the Hooks folder in src/red4ext where game functions are intercepted (e.g., FPPCamera_Update, Entity_InitializeComponents, etc.) to inject new behavior.
• Scripting & Extensions: The Redscript directory (src/redscript) contains flight scripts, compatibility patches, and additional extensions that provide gameplay behavior. Also, note the experiments folder that shows prototypes and example scripts.
• Build and Deployment: The presence of CMake files (CMakeLists.txt, cmake configuration scripts) and related build/dependency folders indicate a robust build system with external dependency integration.
• External Dependencies/Integrations: Clearly denote connections to dependent projects such as:
– RED4ext (for game mod injection)
– TweakXL and ArchiveXL (for asset packaging and tweaks)
– Input Loader (for handling customized control mappings)
– Redscript (scripting layer for game behavior)
– FMOD Studio (for managing the mod’s audio system)
Relationships and Data Flow
• Data flow from user inputs (captured via Input Loader) to the FlightController in the mod core.
• Interconnections where the FlightController interacts with the FlightSystem (updating vehicle state, triggering flight mode) and then calls into separate subsystems (camera updates, audio cues via FmodHelper, visual effects, etc.).
• Arrowed dependencies where the mod core communicates with the scripted behavior in Redscript, and both layers access configuration data (from XMLs in src/input_loader and configuration files in red4ext directories).
• Build system, where CMake aggregates all the submodules and integrates the external dependencies from the deps folder.
Architectural Patterns and Design Principles
• Modular Design: The code is split into clear modules—each specialized for a particular function (e.g., audio, physics, UI, flight mechanics).
• Hooking/Injection Pattern: Show how the Hooks components intercept game functions so that the mod can inject its own logic.
• Event-Driven Flow: The flight events, user inputs, and audio/visual triggers can be depicted as asynchronous events driving changes.
• Configurability: The configuration files and the use of specialized configuration classes (evident in the README snippet) demonstrate a design aimed at making the mod highly customizable.