What is it?
This project is a simple walking simulator game made using OpenGL, freeglut and glew.
For this project, I had to make a 3D scene using OpenGL. So, I decided I would attempt to make a walking simulator where the player can explore a museum.
For this, I had to make a basic 3D engine from scratch using modern OpenGL (4.5). This required me to implement a basic lighting system (including point and directional lights),
loading a mesh from .obj files, loading textures from .bmp, .tga and .raw files, a basic font rendering system using shaders,
collison detection using the separating axis theorem, a simple input manager and skyboxes.
Who did what?
During tutorials, we were given some code which could be used to make a basic OpenGL application.
However, this was for OpenGL 1.1. So, I ported the tutorial code to modern OpenGL and updated it
(adding Buffer, BufferLayout, Renderer, Shader and VAO classes) based off of code from
The Cherno's OpenGL series (1-27).
Additional resources used:
Tutorial that Cubemap class and Skybox shaders are based off
Tutorial that Camera is based off
Source used to get the axis and formula for SAT
Tutorial used for lighting in shaders
Tutorial used for materials in shaders
In addition to using some tutorials, the following textures and 3d models were used:
Dove image
Frog image
Robin image
Deer image
Frame model
Penguin model and texture
Fish model and texture
Glass texture
Fence texture
Grass texture
Brick texture
Wood texture
Skybox texture
Press Start 2P Font
Tool used to create bitmap of font
Stone texture
Fossil model and texture
NOTE: the fossil model has had the decimate modifyer applied to it in Blender to decrease the tri count
Everything else in the project was done by myself
When was it worked on?
Work started on the project around January of 2020 and finished at the end of April 2020
What are the controls?
WASD to move and mouse to move the camera. I and O can be pressed to dim the lights and to turn them back on. P can be pressed to make the penguins rotate about the z axis.
What went right/wrong during development?
One of the things that went right was shaders. Up until starting this project, I had never done shader programming or branchless programming.
Because of this, I was unsure if I would be able to figure them out. I was however able to write basic lighting shaders and a wave effect shader for the fish.
I do think however that the code surrounding the shaders could have been improved to allow for #include.
This way, code wouldn't have had to have been copied from one shader to another.
Another thing that I think went well was the collision detection code.
For a project like this, it would be expected that the algorithm used for collision detection would be aabb (axis aligned bounding boxes).
I however chose not to use this as it does not allow for rotating colliders. I instead chose to use SAT (separating axis theorem).
It took me a while to fully understand the algorithm. However, once I understood it, writing the code for it didn't take too long.
This now allowed me flexibility in how objects and their colliders were positioned in the level.
Another thing I think went well was transparent objects.
Getting transparent objects rendering correctly required my program to sort objects into transparent and opaque each frame (per frame as an object could swap if its texture changed).
It then rendered all opaque objects and sorted the transparent objects by their distance from the camera and rendered them back to front.
One downside of the way I implemented transparent objects is that the back faces of transparent objects aren't visible. This can be seen in the display cases.
One of the big problems with this project is that scene objects were all defined in the code.
This meant that any changes to the level layout required recompiling the project.
Additionally, it meant that creating the level required writing a bit of code and then checking how it looked.
Then editing the code slightly and checking how that looked, and so on.
This was a tedious process that could have been solved by having an editor. I chose however to not attempt to make an editor, as I didn't think I had the time to.
Where can I play the game/access the source code?
Both the game and the source code can be found on my github account. Alternatively, you can click here to go straight to the github page.