Game Engine Engineering Assignment - 6
- Vikram Venkatesh

- Oct 15, 2020
- 2 min read
Updated: Sep 25, 2023
The main highlight of this Assignment was to remove the mesh creation data from game code and replace it with something more flexible. Something which is more human- readable and easier to tweak for non-engineers. The best way to go about this would be to create a 'mesh' file and modify our CreateMesh() factory function to take the path of that file instead of the tedium of giving it all the vertex and index data.
Now for the format of the mesh file, I chose JSON, because its the closest to non-engineer readable and I have some prior experience using JSON libraries, which just makes programming this assignment a bit faster. Though the recommended JSON library was nlohmann, I chose RapidJSON instead just because of its sheer dominance over nlohmann, on parsing performance, and for a Game Engine enthusiast, that should be good enough of a reason.

So currently my mesh representation looks something like this:

..which I feel is quite readable. I was wanting to add comments for ease-of-use, but found some posts on the internet saying JSON files should never contain comments. You can notice that Position is enclosed in a curly brace. This curly brace should contain all information pertaining to a Vertex(Normals, UVs etc.) and as we move forward, I'll update the model accordingly. I chose this kind of format, because not only is it easy to read, but easy to parse as well, because of the repetitive parameters.
So now we have our MeshBuilder, ready to go and once we change the Factory CreateMesh() function, we are now able to load meshes from the disk. Here's a snippet of the MeshBuilder tool while in debugging mode:

...and a snippet from the game, though visually nothing has changed. Just the fact that now this square is just being loaded from a file instead of specifying the vertices and indices in game code, which is pretty neat.

While working on a previous assignment, I realized that I somehow screwed up the OpenGL implementation and that at this point, nothing shows up but the fading background. I'll work on fixing that for the future assignments as I'm clueless myself on what made that happen, at this point. So sorry, but no OpenGL implementation this time.
Controls:
ESC – exit.
Up/Down/Left/Right - Move the square
W/A/S/D - Move Camera Forward/Left/Backward/Right



Comments