Skip to content

Latest commit

 

History

History
138 lines (100 loc) · 4.55 KB

README.md

File metadata and controls

138 lines (100 loc) · 4.55 KB

game-engine

Game engine built in C99 using raylib and Lua scripting for mods

Features:

  • Cross platform
    • Runs on Linux, Windows, and the web
    • Builds on Linux can target multiple platforms
  • Easy modding and extensible
    • Game logic is defined as mods in Lua scripts
    • Lua metatables provide intellisense and completion suggestions for LSPs
    • Hooks can be user-defined at runtime, and optionally registered
    • Event system allows for messaging and communication within the engine
  • Hot-reloading
    • Modifications to Lua files will see changes reflected in real-time
    • On POSIX systems, scenes can be loaded at runtime as shared libraries (.so files)

Building

Arch Linux

The prerequisite packages for building are:

sudo pacman -S --needed git gcc cmake ninja
## Optionally pass the -d flag to build for debug
./build.sh

And run the example project with the run script

./run.sh test-game

Web builds with Emscripten

Web builds use Emscripten, and need the following additional packages:

sudo pacman -S --needed emscripten

Build by passing in a new target flag to the build script

## Optionally pass the -d flag to build for debug
./build.sh -t web

And run the web build with the run script

./run.sh -t web holojam

Warning

Currently, the test-game project does not run with Emscripten due to ASYNCIFY stack corruption when using dlopen() and dlsym() to load and run functions from a shared library file

Windows builds with Wine

Windows builds use Wine to run Microsoft's MSVC compilter, through the msvc-wine project.

For Arch Linux, the prerequisite packages are,

sudo pacman -S --needed git gcc make cmake wine msitools samba python python-simplejson python-six

To install the MSVC compiler, we can clone the repository and run the install scripts

git clone https://github.com/mstorsjo/msvc-wine.git
cd msvc-wine

# This example installs the compiler to ~/my_msvc/opt/msvc
./vsdownload.py --dest ~/my_msvc/opt/msvc
./install.sh ~/my_msvc/opt/msvc

# Add compiler commands to PATH
export PATH=~/my_msvc/opt/msvc/bin/x64:$PATH

# Optional: Start a persistent wineserver
wineserver -k # Kill a potential old server
wineserver -p # Start a new server
wine64 wineboot # Run a process to start up all background wine processes

Build by passing in a new target flag to the build script

./build.sh -t windows

Note

Debug builds will not work when targeting Windows in Wine, and will give errors for various missing DLLs

And run the windows build with the run script

./run.sh -t windows holojam

Warning

Currently, the test-game project only builds and runs properly on POSIX systems, due to the global symbol table not being shared with functions from shared libraries in Windows

Building for release

Releases builds are done in a special release directory and the specified release files are copied into the release[-<project-type>] directory

# build files are located in build-release/ and releases are copied to release/
./build.sh --release
# build files are located in build-windows-release/ and releases are copied to release-windows/
./build.sh -t windows --release

Release builds are meant to be the final version of your software that is shipped, so make sure all paths are valid when running from the right directory and remember to include all relevant asset files

Note

The release directory has its file structure determined by a project's CMake config. This is typically done by copying specific files and directories to specific locations with post-build custom commands and CMake variables. Refer to the holojam project's CMake files for an example of how its release is configured.

Libraries