G-Engine

G-Engine is a hobby project of mine that I started developing in 2017. It is complete C++ rewrite of the engine for Gabriel Knight 3: Blood of the Sacred, Blood of the Damned, a 3D adventure game released in 1998 by Sierra Studios.

GK3 is a mostly data-driven game; even most of the gameplay logic is implemented using a custom scripting language. As a result, you can write an engine that is able to parse and utilize these data files to recreate the original experience (or improve upon it).

One way I hoped to improve upon the original game was by enabling cross-platform play. The original game game was only playable on Windows, but here is a screenshot of the game now running on Mac in the new engine: GEngine Screenshot

Gabriel Knight 3 is one of those games 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 the following features:

  • Math library with common math functions, 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)
  • Multithreaded asset and scene loading
  • Uses CMake to achieve cross-platform IDE and build support

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 from the public repo to try it out.

I am also accompanying development of this engine with occasional blog posts - you can find a complete list here.

comments powered by Disqus