



An open source Metroidvania.
Created from the ground up in C99.
Generate a Makefile using Premake and use that to compile everything.
Before you can run the game in release mode, build thepacker
project and runit from the project root to create a file namedres.pck
which contains all ofthe game's resources. The game reads from this file in release mode so thatshipping the entire resource folder isn't required. The packer packs all ofthe files listed inpacked.include
; This file is sometimes out of date,so if the game struggles to load in release mode, try debug mode instead.
Dependencies on Linux:
libdl
libGL
libm
libX11
libpthread
Dependencies on Windows:
opengl32
gdi32
user32
kernel32
winmm
I develop everything under 64-bit GNU/Linux, with Clang and glibc. There's noreason why it wouldn't work under a 32-bit system with GCC, though (The Premakescripts will need to be modified to build under 32-bit). Windowsshould work,but I rarely test it, so some minor modifications might be needed here and there.
OpenMV builds and runs under MSVC, as of recent. It relies on the__LINE__
preprocessor directive that is a part of ANSI C. However, Microsoft's edit andcontinue debugging feature does something stupid that causes this directiveto be variable, which breaks the build. To "fix" this, you must disable theedit and continue feature in the project settings, by selecting "ProgramDatabase" under "Debug info" instead of "Program Database for Edit andContinue".
You may use this project as a fairly solid foundation for other game projects. Therenderer, entity component system, map loader, resource manager and audio systems areall fairly stable and bug-free to my knowledge. The scripting language and the IMGUIprobably have bugs.
Use mksdk if you want to use the bootstrapper with code hot reloading. This offersless control, but allows rapid prototyping.
A utility inutil/mksdk
exists so that manually copying files isn't requiredin order to create a new project. Simply build this project and run it fromthe project root to create a file namedsdk.tar
. Extract this file andstart creating.
The default project creates a blank window and spams the console everyframe. Edit the code inlogic/src/main.c
to create your game logic. All thecode compiled in this project is hot-reloadable, meaning you can re-compileit and have the code update in real time without needing to restart the program.The default project also creates a loading screen while theon_init
functionin the logic project is running. Comment out lines 32-65 inbootstrapper/src/main.c
to remove this if you don't want it.
Alternatively, you can simply use thecore
project by itself to manage thingsfor a game. Doing this, you have manual control over things like the game loop.
By default, the core is built as a dynamic library. It can also be built as astatic library, by editing the premake script. Note that this has some technicalimplications.
Levels are created using the Tiled level editor and exported using a custom binaryformat. An extension for Tiled to add this format can be found intiledext/mapformat.js
.
c.vim
contains a Vim syntax file to highlight common types used in OpenMV'scode, such asentity
,null
andv2f
. It should be placed in yourafter/syntax
folder, asc.vim
.
Below is a list of pieces of code that I didn't write:
Everything else was written by me, from scratch.
If you have plans to contribute code to this repository: First of all, thank-youfor your time! Second, please follow the general style of the existing code asmuch as possible. This includes: Using tabs for indentation (not spaces), usingdouble
instead offloat
for timing and nottypedef
'ing structures orenumerations. Everything should adhere to standard C99 where possible or atthe very least compile with Clang (minimise the use of GNU extensions). Externallibraries should also be avoided, though single-header utilities are fine.