G-Engine

G-Engine is my game engine passion project! It’s intended to be a complete C++ rewrite of the game engine for Gabriel Knight 3: Blood of the Sacred, Blood of the Damned, a 3D adventure game released in 1998 by Sierra Studios.

Gabriel Knight 3 is a mostly data-driven game; even the majority of the gameplay logic is implemented using a custom scripting language. As a result, it’s possible to write an engine that is able to parse and utilize these data files to recreate the original experience (or improve upon it).

One obvious improvement I wanted to make was enabling cross-platform play - the original game was only playable on Windows, but the game can now be run on Mac and Linux in this new engine: GEngine Screenshot

Gabriel Knight 3 is a game I played as a teen and really latched onto - I enjoy it immensely, and it holds a special place in my heart. Besides being able to interact with a game I love in a unique way, a primary motivation behind this project is to improve my C++ skills and become more familiar with the internal workings of a 3D game engine.

Since starting, I have implemented many features, including:

  • Math library with vectors, matrices, and quaternions
  • Geometric primitives library with support for various shapes (lines, rays, planes, triangles, AABBs, etc) and various useful utilities for detecting collisions or finding nearest points
  • 3D rendering pipeline with meshes, materials, and shaders
  • BSP rendering logic
  • Static lightmap and dynamic lighting calculations
  • Key-framed vertex animation
  • Compiler for the game’s custom scripting language, Sheep, which parses the language grammar into byte code (uses Flex and Bison)
  • Virtual machine capable of executing custom Sheep scripts AND pre-compiled Sheep scripts packaged with the original game
  • Game loop, input, and delta time calculations using SDL
  • Component-based game object model
  • Sound effect, music, and VO playback using FMOD
  • Unit tests using “Catch” framework
  • Binary parsers for proprietary assets for 3D meshes, vertex animations, and BSP (reverse engineering with Hex Fiend and HxD)
  • Multithreaded asset and scene loading
  • Uses CMake to achieve cross-platform IDE and build support
  • A C++ reflection system that enables runtime data inspection and modification.
  • A flexible and extendable save/load system.
  • A general purpose asset management system.

There’s still a lot of work to do, but I’m happy with what’s been implemented thus far! Feel free to grab the code or a release from the public repo to try it out.