Key Details
Language: C++, OpenGL
Platform: Windows
Project Duration: 1 Month
Description
For my third year Graphics module, i was tasked with creating a simple three dimensional scene using an OpenGL and freeglut framework provided by the lecturer.
However, this framework was very simplistic and really not appropriate for what I had in mind, and, in addition, since my work on Escape From Goblin Keep the previous year, I had been considering starting work on my own game engine in my free time but hadn’t gotten around to doing so yet. This seemed to be to be the perfect opportunity to do so then, and so I set about creating a simple game engine built in C++ using OpenGL and freeglut (freeglut, and the old immediate mode functionality of OpenGL were required by the assignment).
The key features of the Engine over the simple framework we were given are:
- A basic physics system with simple gravity, velocity, friction, and collision detection and handling.
- A custom main loop, with manual rendering and updating, to allow me to have a fixed physics and logic tickrate separate to rendering frame rate.
- Frustum culling for object rendering to aid performance in large scenes.
- Support for more than 8 lights by sorting lights by distance to the scene camera and rendering the 8 closest.
- A simple wrapper for drawing text to the screen for making GUIs.
- A global input management system was to avoid having to use multiple call-backs for objects to be aware of button presses, and to allow finer grained control of input polling, for example, checking if a button was pressed in the current update tick only.
- Support for non bmp texture formats via the use of DevIL image loading library.
Collision detection was for me the key feature missing from the framework, as I wanted to create a fully interactable first person scene that a user could explore in a natural familiar way. The solution used for collision detection was a custom oriented bounding box system, (support for aligned boxes only was also included for performance).
This system was far from perfect, and does fail for some edge cases, however as the creation of this engine in the first place was already far beyond the scope of the assignment, I was simply unable to justify the time investment that researching and implementing a more rigorous and researched collision algorithm would have involved.
Working on this engine was a very good learning experience for me to hone my C++ skills with, and the first project in which I really learnt to utilise the power of template classes and operator overloading. This project also denotes my first C++ project which makes use of C++11 smart pointers, which were something I had only dabbled with previously. Having now been properly exposed to just how much nicer smart pointers are to work with I can say with certainty that moving forward wherever I can use them over raw pointers I will do so.
The demo scene made using the engine for the assignment can be downloaded and tried out here: