Cardinal-Engine

Cardinal Engine is an experimental game engine programmed in one month for a project at the Enjmin, the national school of video games. The main goal of the project was to learn about rendering and procedural generation in video games. Cardinal Engine is fully written in C++ with OpenGL 3 and use some third party libraries :

  • Glew
  • Glfw
  • Glm
  • OpenAL
  • OpenVR
  • Bullet3
  • ImGui
  • Google Test

The project is under CMake 3.2 and is compatible (tested) with Microsoft Visual Studio 2017 (CMake support), CLion (tested) and more. The engine is currently compiling on Windows and has a theoretical compatibility with Linux and Mac if the right flags are passed to CMake because the project contains only sources.

You can find here the teaser of the project and here a video of all engine features.

Summary

Scene example preview

Features

General

  • Plugins
  • Independent game loop
  • Message logger
  • Assertion utilities
  • ImGui support
  • Hierarchy and Inspector
    • Inspection of instantiated objects
    • Modification of attributes in real time

Rendering

  • Virtual Reality
    • OpenVR
    • Working with HTC Vive
    • Custom mirror window
  • Post-processing
    • Post-processing stack
    • Blur (Box blur, Gaussian blur)
    • Kernel (Edge detection, Sharpen)
    • Debug (Depth buffer, Light scattering pass)
    • Utility (Mirror, Negative, Identity)
    • Sepia tone
    • Vignette
    • Depth of field
    • Fog
    • Bloom
    • God rays
    • FXAA
  • Renderer
    • MeshRenderer
    • LineRenderer
    • TextRenderer
    • ParticleRenderer
  • Built-in shaders
    • Unlit / Lit (Color, Texture, Transparent, Line)
    • Particle
    • Text
    • Standard (Diffuse + point lights)
  • Particle system
    • Customisable particle system
    • GPU Instantiation based
  • VBO indexing
  • Lighting
    • Directional light
    • Point light
  • Debug
    • Gizmos (Box, Cone, lights etc.)
    • Lines
    • Rays

Audio

  • OpenAL
  • Wav file loading
  • Audio listener
  • Audio source

Usage

This section will enumerate all engine-side implemented features.

Plugins

Because the engine was designed to create procedural voxel worlds, the code of the project has been quickly split into two main parts : Engine and Game. To achieve that, the game part is compiled separately into a plugin that can be registered later and called by the engine.

The first thing to do is to create a class that will extend the engine plugin interface and implements virtual pure methods.

Code

 

Then to register your plugin into the engine, you have to implement a function called “OnPluginRegistration()”. This function will be called after the engine initialization so it is already safe.

Code

Log

At any time in your code you can log debug messages using the engine built-in log system. There are 4 log levels : User, Info, Warning and Error.

Code

 

Output example

Rendering

The engine has 4 types of renderers that extends the renderer interface IRenderer : MeshRenderer, LineRenderer, TextRenderer and ParticleRenderer. Each renderer can be allocated by calling the appropriate function in the Rendering Engine. Calling one of those functions will return a pointer on a initialized renderer ready to be used. The renderer will be autonomous and there is nothing more to do, you can send your vertices, normals and uvs to the renderer and your mesh will be drawn.

Code


 

Lighting

It is possible to illuminate the scene with two kinds of lights : Directional, Point. Just like renderers, there is only one function to call.

Code

 

Output (Gizmos enabled)

Virtual Reality

The engine supports stereoscopic rendering with OpenVR. It allows you to see the world in VR through an HMD (Tested with an HTC Vive). To enable stereoscopic rendering just write the following lines at the beginning of your code.

Code

The first call will initialize VR rendering and start SteamVR. It might fail if SteamVR is not installed or if there is no HMD connected. The engine embeds his own system to mirror the frames that are sent to the HMD before the pass of the SteamVR compositor.

Output

Note : In VR, the post-processing is disabled but there is at least the MSAA (x4). You can watch a short video showing this feature.

Particle system

Cardinal Engine has it own basic particle system GPU instantiation based. So it allows you to deal with a lot of particles at the same time. The only emission shape available is the cone. Particle systems can be created through code and modified with the GUI.

Code

Output

Note : Here is a short video demonstrating the modification of the particle system through the inspector.

Gizmos

At any time, you can request the engine to draw debug information. The engine only supports gizmos for built-in components :

  • Box
  • Ray
  • Line
  • Axis
  • Grid
  • Cone
  • Point Light
  • Directional Light

To enable or disable a gizmo, just call a small function :

 

Note : You can also enable or disable gizmos directly from the game with the gizmos window.

Gallery

Copyright © 2018 Vincent STEHLY--CALISTO. All Rights Reserved.

Up ↑