A downloadable game

'A collection of game engine features'

The engine exists as a series of 3 projects : the core library, the editor and the game project.


The base class for the game itself inherits from the Engine class which gives it access to all of the functions that allow it to run a full gameloop upon which can then be expanded upon to add additional game specifc systems.

For example, this render function draws the basis vectors from the origin as a series of debug lines before calling the base engine render function.

The idea behind this is that the vast majority of the functionality for the engine exists externally and so the individual game projects can pick and choose which of those systems to use dependant on its needs. The engine solution itself builds into a DLL which is then referenced as part of the other builds and the other projects existing as containers for the library to execute. 

The editor project is mostly untouched other than the addition of the renderer to one of the windows. In the future, I'd like to implement a scripting solution (similar to that in hTech) with the ability to write and assign scripts to game objects within the editor. The inspiration comes from Valve's Hammer Editor and someday it'll be a good even a fraction as cool (🤞) but for now, it is an empty game project with some fancy borders.

Now, what cool systems can the game projects use? I'm so glad you asked.


RENDERING

Asset Management

The Asset Manager classes contains and manages creation, storage and cleanup of the majority of assets within the game, primarily models and textures. It contains a series of maps with the user accessing a loaded asset using the name of the origin file or name within the hierarchy as a reference.

An example of loading and setting meshes within the engine.

Models

The engine supports the loading of models from GLTF files as well as creating models from raw vertex and index data. The loader is capable of parsing the GLTF files for its hierarchy and storing the meshes seperately. These are stored as a series of Mesh objects which can either be stored by the project or loaded automatically into the Asset Manager.

Textures

Textures work in a similar way to models. They are loaded from PNG files and stored in Texture objects which are either stored by the project or loaded automatically into the Asset Manager.


LIGHTING

Testing out the new lighting system with some funky new headlights.

The engine contains support for Point, Directional and Spot lights. It can currently support 8 of each concurrently but this number can be changed within the engine project along with a recompile. The lights are found within the renderer's uniform buffer and are updated at the start of each frame's rendering.

An example of one of the light structures - the enabled variable is a float to ensure packing is consistent between the class and the shader. Anything non zero is treated as enabled by the shader although I try to stick to only using 0 & 1.

PICKING

The engine contains support a form of screen picking through the use of rays from the camera and checking for collisions. This can be seen further down when clicking on a cube to apply force in the physics section.


TERRAIN

Although the idea was scrapped and the code removed, the engine did contain an implementation for chunk based terrain generation using perlin noise! These chunks were bound to the quadtree and factored in (broadly) with the collision detection. The code still exists within the commit history but it is not currently in the development branch. It was removed in favour of the new collision resolution system and loading models as part of a singular level file rather than generating terrain at runtime.

Terrain Generation

Flying through the world generating terrain chunks.

PHYSICS

This engine contains my first ever attempts at 3D physics, collision detection and resolution.

Applying forces to specific points on the rigidbody using a ray cast from the camera.

The engine uses a rigidbody based physics model and allows for a large amount of flexibility in the models data such as the ability to alter an objects inertia tensor,  coefficient of friction or whether it is effected by forces at all.


'BESPOKE' COLLISION DETECTION AND RESOLUTION

The engine contains an implementation of the GJK algorithm to determine intersection and the EPA algorithm for the penetration normal, depth and to compute the contact points on the respect colliders. It then uses an iterative impulse solver to adjust the velocities of each object in accordance with their rigidbody settings in a semi-realistic way.

Above: The GJK simplex of the collision being drawn using the engine debug tools! You can see the origin exists within the simplex shape, therefore the objects are intersecting.

1st CD

The first attempt as a collision system was abit 'quirky' but with a little bit of refinement he wasn't as nervous.


But still, a bit too much bouncing.

Collision Detection and Resolution

The second attempt at a realistic collision resolution between a cube and plane. The red flashes are circles drawn using the debug draw functions and represent the collision points.

This is the current implementation of the physics system for the engine and while it works, there are still some rare issues causing some unexpected 'rapid accelerations'. I'd like to dedicate some time to this again soon because I think it's one of the major roadblocks in making a game using this engine. 

DEBUGGING

In terms of debugging, the engine currently contains a set of line and circle drawing functions, a set of hard-coded auto-loaded primatives, including quads, cubes and spheres,  that act as default shapes and a very brightly coloured logging system that let's you know when things aren't going so well...



Unfortunately, the project as a whole has fallen foul to the fact that I like to work on what I think is cool and it is mostly inspiration driven. While I am proud of what I've produced, I seem to use it as a testbed for developing features and systems I find cool or interesting rather than a game. Maybe one day I'll end up with something because I think there is enough to produce something very cool. The working idea is a 'Crazy Taxi' clone so keep your eyes peeled!