Most Normal C++ Project: Coding a B2 Stealth Bomber in GTA 3

Lobsters Hottest News

Summary

A developer explains building the open-source RE3 project for Mac, fixing mouse input bugs, and planning to add a B2 Stealth Bomber to GTA 3, focusing on software engineering methodology.

<p><a href="https://lobste.rs/s/uzbhh8/most_normal_c_project_coding_b2_stealth">Comments</a></p>
Original Article
View Cached Full Text

Cached at: 09/19/26, 10:08 PM

# Most Normal C++ Project: Coding a B2 Stealth Bomber in GTA 3 **TL;DR:** A developer builds the open-source RE3 project for Mac, fixes platform-specific bugs like mouse input, creates an efficient development environment, and plans to implement a B2 Stealth Bomber into the game. ## Introduction: A New Series on Software Engineering This video marks the first in a new series focused on applying real software engineering methods to large problems within existing projects. Moving beyond simple code reviews, the goal is to implement new systems and features, starting with adding a B2 Stealth Bomber to *Grand Theft Auto III* using the open-source RE3 project. The core philosophy is about system architecture and problem-solving methodology, not just tools or themes. The first step involves building the RE3 engine, getting the game to run, establishing a development environment, and then beginning the work on the aircraft systems. ## Building the Engine and Running the Game The process begins by acquiring the original game assets. The narrator mentions buying a physical copy on eBay. The RE3 project is built using several dependencies on macOS: * **Premake** for generating build files. * **GLFW** for window and input handling. * **OpenAL** for audio, with **libsndfile** and **MPG123** for decoding audio files. * **librw**, a render library, is included as a git submodule. After compiling, the RE3 binary is placed in the game's asset folder. The initial test confirms the engine can find and load the original resources without crashing—the first "Hello World" moment. ## Fixing the Mouse Input Bug on macOS The first major bug encountered is non-functional mouse input. The keyboard works, but mouse clicks and camera rotation do not. Using the "Source Dive" tool for code navigation, the investigation centers on the `cpad_update_mouse` function, which uses GLFW's `glfwGetCursorPos` and `glfwGetMouseButton`. The problem is traced to a conditional guard: ```c if foregroundApp && PSglobal.cursorInWindow ``` Debugging reveals that while `foregroundApp` is true, `cursorInWindow` is false, blocking all mouse data from reaching the menus and camera. The root cause is a platform assumption: `cursorInWindow` is set by a `cursorEnterCallback` that only fires when the cursor crosses the window boundary. In macOS fullscreen mode, the cursor is captured from the start, so this event never occurs, leaving the flag permanently false. **The Fix:** Instead of a simple override, new conditions are added to the check: ```c bool cursorCaptured = glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED; bool allCursorHovered = glfwGetWindowAttrib(window, GLFW_HOVERED) == GLFW_TRUE; ``` The updated condition becomes: ```c if (foregroundApp && (cursorInWindow || cursorCaptured || allCursorHovered)) ``` This allows mouse input processing if the app is in the foreground *and* the cursor is either in the window, captured by the window, or hovering over it. The original `cursorInWindow` check is preserved. ## Creating an Efficient Development Environment With the game running, the focus shifts to optimizing the development cycle. The initial loop of change-compile-run-navigate-test is too slow. A dedicated `re3_dev` build configuration is planned with several features to accelerate iteration: * **Windowed Mode:** Running in an 800x600 window instead of fullscreen. * **Skip Intros:** Bypassing cutscenes, story segments, and menus. * **Controlled Test Arena:** Spawning the player in a suitable location (like the airport) with ample space, no NPCs, and access to desired vehicles. * **Reset Button:** A quick restart function. * **Telemetry:** Monitoring for performance regressions, like unintended CPU hot paths. This environment is designed for rapid, low-overhead testing of changes. ## The Next Goal: The B2 Stealth Bomber The video outlines the subsequent phases, which are not detailed in this transcript. Once the development environment is stable, the project will proceed to: 1. **Fix the Dodo Plane's Physics:** Improve the flight characteristics of the existing airplane. 2. **Add the B2 Bomber:** This involves creating a new aircraft model in Blender, defining its flight profile, implementing collision detection, and adding bombing functionality. 3. **Conclusions:** Wrapping up with findings. The core engineering challenge presented is the systematic decomposition and solution of complex problems, from platform-specific bugs to building new gameplay systems from scratch. **Source:** [YouTube - Most Normal C++ Project: Coding a B2 Stealth Bomber in GTA 3](https://www.youtube.com/watch?v=OQM42Ee0fn8)

Similar Articles

What are you doing this weekend?

Lobsters Hottest

A developer describes porting Perfect Dark 64 levels to noclip.website, highlighting the challenges of reading N64 display lists and reimplementing the rendering engine.

Remaking Party House

Lobsters Hottest

A developer recounts remaking Party House from UFO 50 as a browser game using Godot and Claude, sharing insights on game development and releasing a playable version.