Skip to content

A rewrite of the GameMaker Classic engine runners with additional tooling

License

Notifications You must be signed in to change notification settings

OpenGMK/OpenGMK

Repository files navigation

OpenGMK

OpenGMK is a modern rewrite of the proprietary GameMaker Classic engines, providing a full sourceport of the runner, a decompiler, a TASing framework, and libraries for working with gamedata yourself. It’s being worked on almost every day! We’re constantly adding new features and updating the code. Please remember that this project is a work in progress and is unreleased. Until there’s an official stable release, please note that your savestates may break in future releases.

Building GM8Emulator / GM8Decompiler

Start by cloning the repository. We use some git submodules at the moment (unfortunately), so make sure to clone with submodules.

git clone --recurse-submodules https://github.com/OpenGMK/OpenGMK.git

You can also recursively initialise the submodules after you’ve already cloned.

git submodule update --init --recursive

This project is written in the Rust programming language. You can download the toolchain manager directly from https://rustup.rs or a package manager of your choice. Our current minimum supported rust version (MSRV) policy is version 1.59, if you’re downloading it at the time of writing then you almost definitely are up to date but you can check with rustc -V to be sure. Please note that currently building for glibc on Windows (...-pc-windows-gnu) does not work. Once that’s set up, building everything in release mode is pretty simple (but might take a while the first time).

cd path/to/repo-folder
cargo build --release

The build artifacts will be located in <repo-folder>/target/release including libraries and binaries.

Native DLLs for 64-bit Windows

If you’re on Windows 64-bit and would like to play games with GM8Emulator that require 32-bit DLLs to function such as GMFMODSimple or supersound you’ll also need to build the WoW64 server, preferably in the release profile. It requires the additional installation of the i686-pc-windows-msvc toolchain with rustup and you will need to build it separately.

rustup target add i686-pc-windows-msvc
cd path/to/repo-folder/gm8emulator-wow64
cargo build --target=i686-pc-windows-msvc --release

The build artifacts for the WoW64 server will be located in <repo-folder>/gm8emulator-wow64/target/i686-pc-windows-msvc/release. The binary should either be manually copied to the same folder as gm8emulator.exe to work, or the OPENGMK_WOW64_BINARY environment variable should be set with the path to the binary.

A much easier alternative to this is building the project as 32-bit on Windows, where the WoW64 server is not required and the DLL loading logic is bundled inside GM8Emulator. It should be noted that cross-platform extension emulation is planned for the long-term future.

Recording & Replaying TASes

To play a game normally, simply pass the only argument to gm8emulator:

gm8emulator path/to/game.exe

To start record mode, or continue a previous recording, also pass a project name with -n. A folder for the project will be created in:

Windows
<working-directory>/projects/
Linux (Near Future)
$XDG_DATA_HOME/opengmk/projects/ or ~/.local/share/opengmk/projects/
gm8emulator path/to/game.exe -n project-name

While in record mode, a save#.bin is generated for each savestate. You can export a save#.gmtas file, which is for sharing, and has input data only. If you’ve lost your save#.bin, or need to migrate OpenGMK versions, you can recreate it by simply replaying your save#.gmtas:

gm8emulator path/to/game.exe -l -f path/to/save#.gmtas -o path/to/save#.bin

Note that -l here means disabling the framelimiter so it goes by faster.

All command-line steps will be streamlined in a future release.

Load / Runtime Errors

Loading a game gives “failed to load ‘filename’ - unknown format, could not identify file” or similar

OpenGMK is made to support GameMaker Classic games. It’s possible the game you are trying to load was actually made with GameMaker: Studio, which it does not have support for at the moment. Whether it will in the future is unclear right now.

Loading a game or while playing a game, “unimplemented kernel function” or “not yet implemented” or similar

Your game tried to access functionality that’s yet to be implemented. The full GameMaker Classic standard library is absolutely massive, and there’s a good bit left to cover.

Entering record mode gives “invalid u8 while decoding bool” or “expected variant” or similar

This means that the save#.bin file in your project directory is out of date with OpenGMK. This is a byproduct of it being actively developed, and is bound to happen.

To fix it, open it in the build of OpenGMK it was created with, export a save#.gmtas from it, and recreate the save#.bin in the new build with that as described in the recording section.

About GameMaker Classic & OpenGMK

GameMaker (formerly Game Maker) is an engine for creating Windows games, originally created by Mark Overmars in 1999 and YoYo Games since 2007. GameMaker 8 (“GM8”) was the last of the numbered releases of GameMaker, released on December 22nd 2009 (surpassing GameMaker 7) and succeeded by the vastly more popular GameMaker: Studio in 2011. The pre-Studio versions are often referred to as GameMaker Classic. Due to the huge behavioral differences, as well as Studio’s lack of backward-compatibility, the classic engines are still very widely used, with thousands of games to their name.

One of GameMaker’s original strengths as a game engine was its ability to compile an entire project into a single executable. No external dependencies or installers, just compile, send the .exe file to your friend and they will be able to play your game. This is achieved by having the target executable act as a phase file for the entire collection of assets required to run the game. In other words, the executable contains not only the game engine code, but all of the objects, scripts, sprites, room layouts, everything required for the game logic. This behaviour was made optional in Studio, giving the creator a choice between a standalone executable or .msi installer, however the standalone builds just extract the contents of the installer to a temporary folder when they’re launched, so sending the extracted contents as a .zip became much more preferable.

This project was originally started as GM8Emulator, a program that can load GameMaker Classic games, and accurately play the game within. The goal was to have it mimic the original engine as closely as possible, down to the sub-frame and implementation detail (if observable). Strictly speaking, emulator was not the correct term. In computing, an emulator is a piece of software on a computer system which emulates the behaviour of a different computer system. We aren’t emulating any computer system, just the engine, unless you consider Game Maker Language its own architecture. A more accurate term would be a sourceport, but it didn’t sound as cool at the time. The project required us to write a decompiler as a starting point to extract the assets, and since we were already maintaining the most up-to-date fork of Zach Reedy’s gm81decompiler from 2013, we used that as a starting point to develop a much faster version from scratch out of the new codebase, released as GM8Decompiler, which was originally a separate repository, but the code is now merged into the unified repository we named the OpenGMK Project.

Contributing

This project has only been worked on by a few people so far in their little free time. Contributions are always welcome, although we’d prefer if you got in contact beforehand to discuss details (opening an issue, for example). All contributions are licensed under the same licence as the project.

Additional Credits

  • DatZach for creating the original free and open source decompiler.
  • Jabberwock-RU for creating the project icon and logos.

Licence

OpenGMK is free and open source software, provided under the GNU GPL v2, and is in no way affiliated with GameMaker™ or YoYo Games Ltd.