Engine Update

by Debbie Liknes 5 min read
C++ Game Engine Architecture Chai Update

Chai update. Progress and lessons learned

Previously on Chai:

I had big dreams and a triangle. Now I have slightly bigger dreams and… well, let me show you what happened.

Major wins

Plugins

I really wanted my engine to be plugin based. My dream went something like this:

ahem

I just wish I could load a glb model! Oh wait, I can just write a plugin that says it supports the .glb extension, and now I can load it! Ta-da!

And I’m pretty freaking close to that. Right now it’s just .obj files, but the architecture is there. glb, fbx, whatever I want next is just another plugin away.

Assets and Resources

I’m not gonna lie this one threw me for a loop. I knew I needed some kind of manager for things I was loading from files (duh) but the issue I quickly ran into was giving raw mesh and material pointers the renderer. Ew. I wanted a system that had handles where the assets and resources were owned by a manager, and we could get access to them via the handles.

Okay, great. But this posed a very important question. What the heck is the difference between a resource and an asset? Kinda sounds like the same thing. They are not. Assets are the .obj file on disk. Resources are the vertex buffer living in GPU memory. One’s the recipe, one’s the cake. Aha! It became clear. I needed an Asset Manager AND a Resource Manager.

Materials

My asset and resources discovery naturally led to question on materials. With meshes, it feels simple because im not likely to edit the vertex data. Materials are more complex. Shaders were my gateway drug into graphics programming, so I wanna do it justice. Right now I have a Material class that plays nice with the managers, but it’s pretty basic. Shader hot-reloading? Parameter tweaking? PBR? That’s all coming soon. This is where I want to geek out next.

Road blocks

Sometimes I get stuck in a Vulkan mindset. OpenGL very much has global state and when I’m at work thinking about immutable pipelines and PSO objects, I confuse myself when coming back to OpenGL. I want to be careful not to build any application architecture that is suspiciously OpenGL specific. I want all of that to only exist in the OpenGL plugin, and keep the application truly agnostic.

Vulkan Renderer?

It’s absolutely on my list of things to do in the very near future. But I like doing OpenGL because while its less powerful, it’s also less fussy and I’m less familiar with it. It forces me to write better software so that I can leave room to make the Vulkan Renderer of my dreams.

What I’m loving

RenderDoc. RenderDoc has saved my butt more times that I can count. I spent almost an hour trying to figure out where the lovely Suzanne went. 5 minutes in RenderDoc and whoops, my view matrix wasn’t updating. Suzanne wasn’t missing, she was just behind me the whole time.

And Now…Suzanne!

I am now proudly rendering Suzanne with a phong shader Suzanne

Next up

Better materials, maybe some lighting that isn’t just phong, and eventually that Vulkan renderer. And probably more time in RenderDoc. Always more time in RenderDoc.