No history yet

Core Architecture

The Engine's Blueprint

OpenClaw is a from-scratch C++ reimplementation of the 1997 platformer Captain Claw. The project's goal isn't just to mimic the original, but to achieve bit-perfect logic on a modern, modular, and cross-platform engine. This means a player's inputs should produce the exact same game state as the proprietary 1997 engine, frame for frame.

To achieve this, the architecture rigidly separates concerns into three distinct layers: the Frontend, the Logic, and the Backend. This clean separation is key to its portability and maintainability.

The Frontend is responsible for everything the player sees, hears, and touches. It handles rendering graphics to the screen, capturing keyboard and controller input, and playing audio. The entire Frontend is built on , a hardware abstraction layer that provides a consistent API for these tasks across Windows, macOS, and Linux. This means the core game logic doesn't need to know whether it's running on DirectX, OpenGL, or Metal; SDL2 handles the translation.

The Backend manages data. Its primary job is to load game assets—sprites, sounds, and level data—from the original game's proprietary .REZ files. By isolating this legacy file handling, the rest of the engine can work with simple, modern data structures without being coupled to an archaic format.

Logic and Physics

The Logic layer is the brain of the engine. It contains the state machines, character behaviors, and the specific rules that defined the original Captain Claw experience. This is where the bit-perfect requirement is most critical. This layer is intentionally decoupled from both rendering and file loading, allowing it to be tested and validated in isolation.

For physics, OpenClaw integrates , a popular 2D physics engine. It handles collision detection, gravity, and object momentum. While the original game used a custom physics implementation, Box2D was chosen for its robustness and performance. The developers carefully tuned Box2D's parameters—gravity, friction, and restitution—to precisely replicate the feel and behavior of the 1997 engine's physics. This includes matching the arc of Claw's jump and the velocity of projectiles.

This modularity means the physics engine could theoretically be swapped out with another one without requiring a rewrite of the rendering or resource management code.

Data-Driven and Cross-Platform

OpenClaw embraces a data-driven design. Instead of hard-coding values like enemy health or item locations, this information is stored in external configuration files. The engine uses to parse level data and game configurations from XML files. This approach allows developers to modify game behavior and design new levels without recompiling the C++ source code, dramatically speeding up iteration.

The entire project is managed as a monorepo and built using CMake. CMake generates native build files (like Visual Studio solutions or Makefiles) from a single set of configuration scripts. This allows developers to compile OpenClaw for Windows, Linux, and macOS from the same codebase.

Furthermore, the project supports WebAssembly (Wasm) as a build target using . This toolchain compiles the C++ code into a highly optimized Wasm binary that can run in a web browser. The use of SDL2 is critical here, as Emscripten provides a compatibility layer that translates SDL calls into browser-based equivalents like WebGL for rendering and the Web Audio API for sound.

This project is a multiplatform C++ reimplementation of original Captain Claw (1997) platformer game

Time to check your understanding of OpenClaw's architecture.

Quiz Questions 1/6

What is the primary goal of the OpenClaw project?

Quiz Questions 2/6

The OpenClaw engine is separated into three distinct layers: the Frontend for rendering and input, the Backend for data loading, and the _______ for game rules and state machines.

This modular and data-driven approach provides a solid foundation for preserving a classic game while enabling future development on modern platforms.