top of page

GAME ENGINE

Capture.PNG

At FIEA during our second semester we were tasked with building our custom game engine using C++. The learning outcome of this project was tenfold as it helped me get comfortable with modern day C++ and follow good programming practices while also understanding how a game engine would function.

​

Developing a game engine has helped me :-

  • Enhance my knowledge of C++ and understand a variety of object oriented concepts like inheritance, raw pointers.​

  • Develop and maintain a large code base.

  • Use the visual studio unit testing framework to Iteratively test and maintain code.

  • Develop a scripting language to de-serialize raw data from JSON.

  • Implement a variety of design patterns like Observer and Factory design pattern.

​

​

Below you can find a rough over view showing the step by step process involved in building the game engine

​

CUSTOM CONTAINERS

The first requirement of the game engine required us to have some sort of containers that would be used to read and write data from. To achieve this we engineered custom STL containers like SList,Vector and Hashmap.

​

Writing custom STL containers helped me :-

  • Understand C++ copy and move semantics.

  • Implement compile time polymorphism using templates

  • Develop custom iterators for each container.

​

The next step was to build higher level abstractions built on the STL containers to enable the engine to de-serialize data frpm JSON, read and write game data. The system engineered to accomplish this had  3 main components:-

  • Datum : A container that is used to store a variety of data types (int,float,string,etc.) and can also store elements whose memory it does not own.

  • Scope : A mapping container that helps map a string to a Datum to provide us with a hierarchical structure , where one scope can contain more nested scopes.

  • Attributed: Inherits from scope and is used to define a certain set of "properties" an Attributed object would have. Helps provide a place to store data and use them during runtime. This system makes use of a singleton type registry where each Attributed derived object can have its own set of attributes.

​

​

​

​

​

​

HIERARCHIAL SCRIPTING LANGUAGE

Once the data structure system was built, the engine had to have a way to convert data from a JSON file into objects/C++ classes that could be used during runtime. 

​

The parsing system accomplishes this by using the chain of responsibility pattern to convert JSON data to actual game entities with their own properties. 

PARSING SYSTEM

At this stage we had a data driven engine capable of creating objects by de-serializing data from the JSON. To further develop the engine we created a Game object class which would act as the root of the scene and provide a mechanism to update itself and all of its children every frame.

​

This class functions similar to a gameobject in unity, where a gameobject has a transfrom and can have many nested children each with their own update. 

​

​

​

​

​

​

GAMEOBJECT

Finally , the game engine needed a mechanism to respond to events and enable users to create C++ style conditional and expression statements through JSON.

​

The action system inherits from game object and provides the user with great flexibility. It allows a user to create If,Switch and expression statements via the JSON 

ACTION& EVENT

UNIT TESTING FRAMEWORK

Every individual unit of the game engine had to be extensively tested using the Visual Studio Testing framework.

bottom of page