Buggy Engine

Graphics engine created by me and my partner Nikos Teran, the graphics API used is OpenGL 4 and for the creation of the project has been used Premake, to be able to adapt the creation for windows and PS4, without having to make many changes. In the video you can see everything that has been done, plus the technical sheet below

The Buggy Engine in which C++ 17 and object oriented programming has been used. The engine is made for OpenGL and a part on PS4.


Different libraries have been needed for the process:


  • BULLET3 - Physics system

  • GLFW - Window system

  • GLAD - Rendering and OpenGL usage

  • GLM - Mathematical library

  • ICONFONT - Icons in your fonts

  • IMGUI - Creating a Graphical UI

  • IMGUIZMOS - Scene GUIZMOS with ImGui

  • LUA - LUA scripting in C++

  • MINITRACE - Threading debugging

  • PPLX - Multithreading library

  • STB - Image loading

  • TINYOBJ - Objects loading


In the rendering engine we have used a forward rendering system in which no post-processing technique is used or with the possibility of using bloom. We can also use a hot deferred shading system to show another type of scene rendering.


It is important to emphasize that we are not going to name everything of the engine but, everything that has been a more advanced operation for the engine itself as it is the rendering system and the advanced techniques applied.

Engine Features

In the engine we are going to highlight some important features to carry out its operation and that have been implemented to give a more dynamic behavior. Such as the system of shadows and lights. And also a brief explanation about the port of the engine to PS4.


Shadow System

This system is in charge of going through all the entities looking for those that have the component of lights and shadows in case they have them, these will be saved in a buffer and their respective matrices of view and projection will be assigned to them. After that, each element of the buffer is scrolled and all the entities will be scrolled again to paint them from the perspective of that light.


Light System

It is in charge of passing the information of the entities with the light component to the light buffer that will be passed to the GPU and with which the light calculations can be made in both Deferred and forward rendering.


Rendering System

Contrary to the other systems, this one is executed at the end, and goes through all the entities present in the scene looking for the ones that have the render component and World, to make a paint call with each one of them.

In the rendering system we can find that in hot we can change at any time if we want a bloom for example. Or select whether we want a normal forward rendering without post processes or add deferred.


UI Editor

For the editor and to be able to graphically control everything we have used the imGui library in which we create windows in which we can have more control over the engine. The interface we use works as a docker so we can stacke sales within other windows and give it a resemblance to an advanced engine.

For the UI I have been inspired by unity and unreal, and we can find the following windows:

  • Scene Window: For this we have the most important window which is the render window in which we show by means of an image the whole rendered scene. With the addition that has a Guizmos to be able to control everything and move the selected entities.

  • Inspector Window: We have the Inspector window where we can see the properties of the entity as well as its components and modify them.

  • Hierarchy Window: We also have the window in which we show all the hierarchy of entities that we have in the scene and so we can select the one we want and move it in the scene or with a drag and drop make it a child of any other entity.

  • Logger Window: We also have a logger window in which we can see all the logs and see if we have any error in, for example, the loading of the lua or in any shader.

  • Composer Window: And the composer window in which we control the whole scene and see the different renders we have and how to change them. As well as the generated textures

ECS Transaction

For the ECS we have used a bitmask to check if we have the component or not. And we can also see if we are going to write in it or not when creating the systems.

For the ECS we have put an auxiliary structure called ECSTransaction in which in the constructor we have a lock and in the destructor an unlock of a mutex to avoid problems with the multithreading when using the components with the entities.


Scripting LUA

To do scripting in the engine we have LUA in which it has been used in two different ways one for the creation of scenes in which if we stop all the functions to LUA we would only have to create the scenes from there so it speeds up the process of using the engine and we could have several scenes in the same project.

We can go hot also changing scenes or reloading the scene itself if we change some of the code.

The other way that the LUA has been used is for components in which we can make sure that a single object is affected by a LUA Script so for example if we want an object to rotate we will put that script.


Entry Point

For the entry Point we have a support class that inherits from the application and by means of a MAcro we tell it that this class will be used to do everything in which we only have to modify the virtual functions that we inherit.


Multithreading

For multithreading we have used the PPLux library, in which we first start the scheduler and before entering the loop we make a first execution of the thread and once inside we wait and execute in each frame.


Draw Commands

For the correct operation of the painting, we have the display list in which we generate commands such as clear or draw to be able to submit to the Queue display list from any thread and thus by commands we can draw on the screen, with the order of submitted in the main thread at the end of the frame.


PS4 Implementation

The PS4 implementation is partially added, you can create a normal scene as in OpenGL but it does not have the added techniques implemented, there is only forward rendering. So it is a port that has been successful but the techniques that can be found in the OpenGL engine have not been applied.

For the implementation we have used PS4 libraries provided by ESAT and Sony. To make a simple implementation CC and Macros have been created according to what platform we are going to develop so for a future platform it would be something simple to be able to implement and make more ports.

IMPLEMENTED TECHNIQUES

  • Techniques Shadow Mapping

  • Normal Mapping

  • Parallax Mapping

  • Physically Based Rendering (PBR)

  • Normal Mapping with PBR

  • Tesselation

  • Deferred Shading

  • Deferred Shading with Light Volumes