Skip to content

djmuted/ClawSwitch

Repository files navigation

OpenClaw - Captain Claw (1997) reimplementation

  • This project is a multiplatform C++ reimplementation of original Captain Claw (1997) platformer game
  • Whole codebase was written from scratch
  • Game uses assets from original game archive (CLAW.REZ)

Level 1 youtube playthrough:

OpenClaw - Level 1

Build status

Windows:

Build Status

Linux (debian), macOS, Windows, Android, Emscripten:

Build Status

Static analysis / Code coverage:

Static analysis

Tech

  • SDL2 Libraries (SDL2, SDL_Image, SDL_TTF, SDL_Mixer, SDL2_Gfx) for graphics, input, font and audio
  • Box2D Library for Physics
  • Tinyxml library for data-driven approach

Building and running

For all platforms you will need original CLAW.REZ game archive in Build_Release directory from original game

Zip all content inside Build_Release/ASSETS directory to ASSETS.ZIP file.

Windows

  • Project contains VS2017 solution with all libraries and include directories preset
  • Project also contains CMake files if you want to use other IDEs.
  mkdir build
  cd build
  
  cmake -G "Visual Studio 15 2017" ..
  msbuild OpenClaw.sln
  # Or
  cmake -G "NMake Makefiles" ..
  nmake
  • Box2D is generated by CMake and it hardcodes the file paths. If you want to compile it on your own, you must run CMake on the CMakeLists.txt in the Box2D root directory
  • Do not try to use different versions of SDL libraries than the ones which are already included in the Build_Release folder

Linux

Prerequisites for Ubuntu 16.04 (should be almost identical for Fedora/CentOS/*):

sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libsdl2-gfx-dev

You could also install libtinyxml-dev but this library will be compiled and linked from ThirdParty/Tinyxml directory. Edit root CMakeLists.txt file to change this behaviour.

Compilation:

  • git clone https://github.com/pjasicek/OpenClaw.git
  • CLAW.REZ iz required from original game in the OpenClaw/Build_Release folder
  • Use cmake to build fresh Makefile. There is no need specific arguments.
  • make (it's going to use all threads to compile, edit Makefile in Build_Release folder to whatever number of simultaneous threads you want it on your machine to run)

Remarks:

  • For hearing background music play, you need to install timidity (or timidity++) and freepats. Some linux distributions come with it by default, some do not (fedora, archlinux)
  • Does not work with SDL 2.0.6 - if you have the latest one from repository, you should be fine

Android

  • Compilation / Deployment steps will be updated in near future, game itself is successfully running on Android

WebAssembly (Emscripten)

The project can be compiled as wasm code. This code is executed by modern web browsers without any additional runtime dependencies. Compiled once this code can work on any devices with different operation systems.

Compilation:

  • Install Emscripten SDK from official website. I'm not sure that compilation will be successful on a Windows platform. If you use Windows then don't show off, enable Windows Subsystem for Linux (WSL), download Linux-like system (for example, Ubuntu) from Windows Store and install Emscripten SDK. It should be something like:
    git clone https://github.com/emscripten-core/emsdk.git
    cd emsdk
    ./emsdk install latest
    ./emsdk activate latest
    source ./emsdk_env.sh
    # Try to use latest version.
    # If it doesn't work the project was successfully compiled on 1.39.11 version.
  • Make sure you have python and cmake packages. Ubuntu: sudo apt install python cmake.
  • Make sure you have fresh ASSETS.ZIP and CLAW.REZ files in Build_Release directory.
  • Compile:
    mkdir build
    cd build
    emcmake cmake -DEmscripten=1 ..
    # -DExtern_Config=0 parameter includes config.xml file in game resources
    make

Run:

You will need web server to run compiled project. There are 2 options:

  • You can upload openclaw.html, openclaw.js, openclaw.wasm and openclaw.data (and config.xml if you build the project without -DExtern_Config=0 parameter) files from Build_Release directory to any web server.
  • Or run Python server:
    cd Build_Release
    python -m SimpleHTTPServer 8080
    # Go to http://localhost:8080/openclaw.html

Remarks:

There are some limitations:

  • Some old web browsers does not support WebAssembly code. Hi Internet Explorer!
  • Some web browsers does not support .wav file formats. Microsoft? Again?
  • All web browsers does not support .xmi (MIDI) file formats. This files should be converted to another compatible formats. All MIDI audio are disabled for now.
  • Some specific SDL_Mixer audio functions aren't implemented (you can find it by TODO: [EMSCRIPTEN] search query) but the game is playable.
  • Death and teleport fade in effects are broken. Emscripten erases graphic buffer after each draw call. Do not use buffer from previous calls.
  • There is a FireFox bug with a very long story which doesn't allow to prevent ALT default actions. ALT key presses will open window menu. Workarounds:
    • Contribute to Mozilla and finally close this bug.
    • Use fullscreen mode.
    • Disable default ALT actions in FireFox about:config properties.

In-game images

  • TODO - add screenshots

Claw Launcher

  • Precompiled for Windows natively and for Linux use through Mono runtime
  • Locates Claw binary and corresponding config.xml file
  • Provides GUI to modify configuration (Video/Audio/Assets)

For Linux

Prerequisites for Ubuntu 16.04 (should be almost identical for Fedora/CentOS/*):

sudo apt install mono-runtime libmono-system4.0-cil libmono-system-windows-forms4.0-cil

Then run it like this:

~/OpenClaw/Build_Release$ mono ClawLauncher.exe

  • TODO - add screenshots