3D Game Engine

Key Details

  • University assignment to build a component based 3D Game Engine.
  • Graded as a 1st (79%)
  • Made use of several 3rd party libraries: SDL2, OpenGL, GLM, Glew, pugixml, Bullet & Assimp

About

Linux and Mac Builds in video were run on virtual machines as I didn’t have access to physical hardware, which is why performance is abysmal!

Assignment was to build a 3D Game Engine using a component based design similar to Unity and implement at least a basic version of many features.
The core of my engine was built using SDL2, OpenGL and Glew. I also used memory analysis tools such as Valgrind to debug and check for any hidden memory leaks in my code.

If you want to have a more illustrated view of the features and the engine check my original reports that include screenshots and UML diagrams:

Features
  • Cross Platform support to Windows, Linux and Mac OSX. I created a python script that generates the Makefile on each platform, and fetches some dependencies on Linux (2021 note, in retrospect should have used CMake).
  • Also partial support for Android using the NDK and HTML5 WebGL using Emscripten.
  • I added pugixml to handle loading a settings file containing user graphics options.
  • Input system that handles keyboard, mouse and gamepad support with haptic feedback.
  • Configurable Shader class that allows uniforms variables to be created and sent to the graphics card easily. Keeps track of what variables have already been passed to the graphics card so that it can overwrite the data rather than allocating new space.
  • Supports the loading of complex meshes made up of several sub components and materials. Currently supports: normal maps, specular maps and standard diffuse maps/textures. Utilizes Assimp library for complex models, but I have my own OBJ loader that I use for the simpler meshes like spheres.
  • Light support, in the video I have a directional light and a movable point light to demonstrate this.
  • Can use Sphere vs Sphere collision and AABB vs AABB, technically can also do Sphere vs AABB but the sphere collider falls back to its AABB component.
  • Bullet Physics Library Implementation, I have implemented most of the core functionality of Bullet (2021 note, Unfortunately there’s a lot of issues, probably due to my integration):
    • Triangular Mesh Collision: My Game Model class can be converted straight into a triangular mesh for bullet to use in collision.
    • Collision Callbacks: When a collision occurs, I trigger an onCollision event to the affected Game Objects and their components.
    • Quaternion Rotations: Due to recurring problems with Euler angles I implemented Bullet’s quaternion class to handle rotations for all objects. (I originally tried to use GLM but its data did not match bullet’s, thus causing weird behaviour). (2021 note, From memory its still not perfect and I should have used GLM’s and figure out how to fix the offset in bullet)
    • Debug Drawer/Renderer: Bullet provides an interface that if implemented will allow all physics objects to be displayed on screen as a wireframe, showing how each collision shape wraps its assigned model. I rebuilt this debug drawer to use modern OpenGL techniques (Rather than ‘glDrawLine’) and to be independent of Bullet so it could be used to render any primitive data.
  • SkyBoxes and Cube maps, Cube maps have been added on the OpenGL side to allow for 6 textures that make up the faces of a cube. I have mainly implemented these to add a SkyBox or StarScape Renderer to replace the single plane I used to display the background previously.
  • WebSocket support (Dissertation), Implemented into the engine as part of my dissertation allows mobile devices to be used as secondary displays and controllers. (2021 Note, not shown in video see Global Mobile project for an example demo of this feature)
  • Cross Platform Networking Potential, I have implemented both WinSock and BSD sockets in the engine and can be accessed by a standardized interface, with the engine doing all the platform specific networking behind the scenes. However, I do not currently have a game server component and have been testing the networking with IRC and web servers. I almost had a system that uploaded user data (logs, platform specs, general analytics) to a web page, but had to disable it as it needs more work to be stable.
  • Height Map Loader that can convert a grayscale image into geometry and height data with the option of texturing. Can scale the map in height or dimensions to increase land size (without requiring increased height map image resolution).