GameDev Log #3
Long time no see, or read? Well, either way here I am with a new GameDev Log. And of course I don't really know it this gets read by someone at all. If so, please comment below.
But I wanted to talk about the things I'm doing right now in my free time beside studying.
I threw my 2D SDL2 based Game Engine in the bin. Sort of.
I began with the goal to develop a little game for me and my friends, which we can play in Multiplayer. For the graphic part I used SDL2, I developed my own little Gui Library with Debug views and InputText fields and so on. Little I knew then, that there are some really powerful GUIs out there. But well you write code and then you discard it. Then you write new code, or you know that sometimes it is better to use code of someone else.
At university I took a class called "Computer Graphics" it's an course which gives you all the basics of Rasterizers and Ray-Tracers. You also have to implement all the relevant parts of it. It was so much fun. If you are at Uni or College I really emphasize that you should take a similar course. What can be better, you get credit points for things you do in your free time. Not often that happend at uni so far.
It's like a childhood dream of me, and now I'm here developing my own engine. Tell that to my 8 year old me.
So while learning and doing the stuff for our assignements, I began to develop my own little Game Engine. For those who ask, yes yes I know Unreal is real and its out there. It's good and very usable for probably 99% of the games out there. But I want to learn how a Game Engine works under the hood. It's like a childhood dream of me, and now I'm here developing my own engine. Tell that to my 8 year old me.
So whats the stage of my engine so far?
I've done the basic stuff so far. Overall the most time I spent is probably on Loading things into my engine. Like loading Shaders, OBJ files, FBX files. Create Scenes and managing them.
For parsing the files I'm using the following libraries:
Tinyobjloader
tinyobjloader (GitHub)
It's an fast libray which can load *.obj files with their attached *.mtl's. I used this library to get some more advanced geometry into my engine, like the Stanford Bunny. http://graphics.stanford.edu/data/3Dscanrep/
It's fast and really easy. In my engine everything I load gets first loaded into an object called "SceneData" it has as a lot of std::unordered_map
's. Later on I plan to make this serializeable, to sort of load things into my own structure and save it as a binary.
class ObjLoader : public Loader {
public:
bool load_scene(const std::string &path, SceneData &sceneData) override;
private:
static void process_meshes(SceneData &scene_data, tinyobj::ObjReader &reader);
template<typename T> static void process_materials(std::vector<T> materials, SceneData &sceneData);
};
I have different loaders that all load things from a file into my SceneData. Later on I used ASSIMP to load *.fbx files. But I don't wanted to throw my tinyobjloader wrapper in the bin.
Well now I have the possibility to use this or that libary to load stuff.
The really good thing is with the tinyobjloader lib, is that *.MTL or *.OBJ files are just plain text and that way you can easily change some values without doing that in blender or something. It also supports PBR-MTL files like this: PBR material extension for .MTL. Its proposed here: http://exocortex.com/blog/extending_wavefront_mtl_to_support_pbr
One really cool thing is, that this library is open source.
Okay enough talking, what works now is that:
- Loading Scenes into the Engine. I use FBX files for loading stuff and *.mtl files for my materials.
- Automatic Hot reloading shaders (really cool for changing shader code while the engine is running)
- Basic Phong Shading with with directional light
- Texture loading
- Entity-Component-Sysem with entt. Thanks to Skypjack for this awesome library. I used my own ECS system with my "old" engine, but well I think this library is really really good.
- Basic "Editor" Fly Cam.
- Framebuffers
- Forward Kinematics with entt. I'm using a RelationshipComponent to get the relations right.
- Basic Keyframe Animations
For now I'm working on:
- Shadows
- Procedural Animations (Inverse Kinematics).
Still things I have to do:
- Physics Engine - maybe Bullet?
- Multiplayer
- PBR
- more Visual things, like Skyboxes, Water, Reflections... God Rays?
- LOD - Level of Detail meshes. Load different meshes for different LOD Stages. Then render those.
- Proper View Frustum Culling so I don't have to render the wholse scene.
I have some thoughts on Multiplayer, but I think first I will improve the visuals so that I have PBR rendering with proper shadows and maybe some reflections.