Remc2
Recode Binary code of game Magic Carpet2 to C/C++ language(remake MC2 for any platform)
Install / Use
/learn @turican0/Remc2README
Magic Carpet 2 HD
Now actually in HD or 2K!
Based off the Reverse engineering of game Magic Carpet 2 from assembler to c/c++ language by Tomas Versly <br /> Forked from Tomas Vesely's repo here: https://github.com/turican0/remc2 <br /><br /> Tomas has done amazing work, not only reverse engineering this code but updating it to use more modern memory allocation and use the SDL library for input and sound. He has even increased the sprite resolutions.
Download the latest Alpha Here (now with MSI Installer)!
https://github.com/thobbsinteractive/magic-carpet-2-hd/releases/latest
Install Guide for GOG Edition or from Magic Carpet CD
https://github.com/thobbsinteractive/magic-carpet-2-hd/wiki/Windows-Installation-Guide
Basic Controls
Controls can be redefined in the Config.json file, however here are the defaults: </br> Forward = W</br> Backwards = S</br> Move Left = A</br> Move Right = D</br> Open Spell Menu = LCtrl / Mouse 4</br> Open Map = Tab / Middle Mouse</br>
Command Line Args
You can use the following arguments:</br> To jump to a selected Level use:</br> --set_level [0-25]</br> To run a level you have created using the editor:</br> --custom_level "[Path to .mc2 file]"</br> To record a playthough (only works for x86):</br> --record_file "[File Path]"</br> To playback a playthough (only works for x86):</br> --play_file "[File Path]"</br></br> To change the log level of the game:</br> --log_level [Info, Debug, Trace (will impact performance)]</br> To run the game with option to show in game debug info (press "J" to show):</br> --enable_in_game_debug</br>
FAQ
https://github.com/thobbsinteractive/magic-carpet-2-hd/wiki/FAQ
For more information on Magic Carpet 2
Moburma has been tirelessly working to document cut levels, level data structures and missing graphics at: https://tcrf.net/Magic_Carpet_2:_The_Netherworlds
My intention is to make a patch for Magic Carpet 1 and 2 (GOG editions) that initially will:
- Add more screen resolution options
- Increase draw distance
- Seperate Render and Simulation code so that game speed is not dependent of FPS (or fix FPS)
- Enable local multiplayer without NETBIOS
Build Status:
|Branch|Windows|Linux|
|------|:-----:|:---:|
|master||
|
|development|
|
|
STATUS: Code now runs and all of MC2 (in both Windows and Linux) seems to be playable. Anyone with the GOG edition can download this repo, extract the Game Assets (from a legal GOG copy of the game) and run it.
Steps: to build and run this code
Windows:
- 1: Install the latest version of Visual Studio 2022 Community. Ensure you install vcpkg
- 2: Pull the development branch
- 3: Open "remc2.sln", you can build either x64 or 32 bit versions
- 4: Build the code
- 5: Purchase a copy of Magic Carpet 2 from GOG here: https://www.gog.com/game/magic_carpet_2_the_netherworlds
- 6: Install the Game. Copy the "NETHERW" directory to "remc2\Debug" Folder
- 7: Copy the "Extract" folder to your Game Directory, run extract-GOG-CD.bat. The CD Data will now be copied to a directory called "CD_Files" in the "Extract" directory
- 8: Move "CD_Files" directory into the "remc2\Debug" Folder
- 9: Run
Linux:
Building on Linux
There are two ways to build the Linux binary.
-
Building a native binary
- Pull the development branch using GitHub (this is much easier if you install Visual Studio Code and install C++ Extension, cmake, cmake tools). When pulling the branch either do a recursive clone of the repository or ensure that after the pull you run:
git submodule initandgit submodule update - Once pulled, within the
magic-carpet-2-hd/directory pull thefindfirstrepo. - Make sure that you have
CMake,makeand a recentGCCinstalled- To install them on Debian/Pi OS:
sudo apt install -y cmake
- To install them on Debian/Pi OS:
- Make sure that you have the following dependencies as development packages (the exact names depend on your distro)
- SDL2
- SDL2_mixer
- SDL2_image
- SDL2_ttf
- libpng
- boost
- boost-system
- spdlog
- rapidjson-dev
- To install them on Debian/Pi OS:
sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libpng-dev libpng++-dev libboost-system-dev libspdlog-dev rapidjson-dev
- To install them on Debian/Pi OS:
- Build the code
export BUILDTYPE=Debug # or Release mkdir -p build/${BUILDTYPE} cd build/${BUILDTYPE} cmake -DCMAKE_BUILD_TYPE=${BUILDTYPE} -DCMAKE_INSTALL_PREFIX=./inst [SOURCE_DIR] make make install- Magic Carpet 2 is now built. you can find it in
build/Debug/inst/bin- You can also run the code with sanitizers (leak, address, undefined behaviour, pointers) by passing
-DUSE_SANITIZERS=Trueto CMake
- You can also run the code with sanitizers (leak, address, undefined behaviour, pointers) by passing
- Pull the development branch using GitHub (this is much easier if you install Visual Studio Code and install C++ Extension, cmake, cmake tools). When pulling the branch either do a recursive clone of the repository or ensure that after the pull you run:
-
Building a flatpak
- Pull the development branch
- Build the flatpak
cd flatpak ./build.sh- Run the
remc2flatpak via
flatpak run com.github.thobbsinteractive.magic-carpet-2-hd -
Running clang-tidy for static code analysis
- Run CMake with the flag
CMAKE_EXPORT_COMPILE_COMMANDSfor exporting the build commands like this
cmake -GNinja -DUSE_SANITIZERS=True -DCMAKE_BUILD_TYPE=${BUILDTYPE} -DCMAKE_INSTALL_PREFIX=./inst -DUNIT_TESTS=True -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../..- Run clang-tidy
run-clang-tidy -p . -j 4 -export-fixes clang-tidy-fixes.yaml - Run CMake with the flag
Providing the original game assets to remc2 and running the game
In order to run the game you need to own a copy of Magic Carpet 2. We provide a script to extract the assets from the GOG version. The following steps extract the required files from the original.
- Purchase a copy of Magic Carpet 2 from GOG here: https://www.gog.com/game/magic_carpet_2_the_netherworlds
- Download the Windows "Offline Backup Game Installer"
- Open GOGGalaxy
- Install the game
- In order to retrieve the original game's assets run the following script located in the root of the repository:
bash check_install.sh -s [directory where GOG installed MC2] -d [destination directory]
# for example :
bash check_install.sh -s "${HOME}/.wine/drive_c/games/Magic Carpet 2/" -d "build/${BUILDTYPE}/inst/bin/NETHERW"
# or :
bash check_install.sh -s "/mnt/c/Program Files (x86)/GOG Galaxy/Games/Magic Carpet 2/" -d "build/${BUILDTYPE}/inst/bin/NETHRW"
Please note that if you have used any other method to get the assets, at least run a check to make sure that remc2 has access to every file it needs:
bash check_install.sh -d [destination directory]
# for example:
bash check_install.sh -d "build/${BUILDTYPE}/inst/bin/"
[ ok ] CD_Files directory
[ ok ] GAME directory
this script will fix the permissions, make everything uppercase, check all file hashes and complain if any file is missing.
it's also recommended that before the first run you remove the file GAME/NETHERW/CONFIG.DAT if it exists.
4. NOTE: The game will search in the following locations (and in this particular order) for the game assets. For the flatpak only the first two locations can be used.
1. $XDG_DATA_HOME/remc2/
2. $HOME/.local/share/remc2
3. next to the remc2 binary
5. Run the remc2 executable in install directory
cd magic-carpet-2-hd/build/${BUILDTYPE}/inst/bin
./remc2
Configuring remc2
Some settings can be configured via the file config.json. An example for this file can be found in the root directory of the remc2 repository.
The game will search for this file in the following locations and this particular order. For the flatpak only the first two locations can be used.
$XDG_CONFIG_HOME/remc2$HOME/.config/remc2- next to the
remc2binary
ROADMAP:
MILLSTONE 1
- [x] Get solution runnable from Visual Studio 2019 build, with minimum of setup. Cut down on unnecessary extra files and libraries and use nuget instead.
- [x] Refactor reverse engineered code into seperate classes where possible.
MILLSTONE 2
- [x] Add resolution support
- [ ] Implement Open GL render
- [X] Implement Controller Support
- [ ] Implement a (platform independent) Launch menu to adjust settings in config.ini before launch
MILLSTONE 3
- [ ] Improve sounds and music using updated original scores and directional sounds in game - In Review!
- [X] Implement a wix sharp .msi installation for new .exe to make patching the and running existing game simple and something similar for the Linux versions
MILLSTONE 4
- [ ] Get basic LAN/IPv4 multiplayer working again (Tom is currently making great progress on this!)
MILLSTONE 5
- [ ] Get Magic Carpet 1 working using this engine. Ideally with original music and graphics.
LONG TERM GOALS
- Add VR support back into the game (yes it was originally supported! This game was waaay ahead of its time)<br />
- Implement online multiplayer match making
