Hi there, it’s been about 2 months or so since I’ve posted anything. I took on some contract dev work a few months ago (gotta pay the bills fellas) and my workload was getting too strenuous while developing this game engine at the same time. So I thought I would take some time away from it to focus on life, as well as spend more time with my wife.
But now I’m back in action, so it’s time to report some progress. First things first is a major change, not really for the user end (although there are potential benefits) but mostly on my end. Perhaps some of you may have heard the recent news that Apple has dropped OpenGL support. Why should anyone care? Well, it’s the first sign in a worrying trend about the nature of cross-platform applications. One I had to consider carefully.
So ultimately I decided to drop OpenGL and write a new renderer in kha, a library that I now contribute to. Kha is a simple, cross-platform, low-level wrapper over OpenGL, DirectX, Vulkan and has bindings to the Switch SDK as well as PS4 and Xbox One SDKs (saving me a lot of work potentially in the future).
Having become very familiar with OpenGL over the years, I was able to translate a lot of the existing renderer code easily. It’s better that I did it now, rather than later, before it becomes unmanageable to do. In many ways the API is a lot more low level and closer to the machine than OpenGL (due to bindings to Vulkan). I can also use the same GLSL shaders I used for OpenGL.
What does that mean for the average person though? Major performance boosts based on initial benchmarks. Why does that even matter for 2D? It opens the door to many possibilities. At the end of the day, it’s not just 2D, it’s 3D hardware acceleration with shaders sent to the GPU, particles, dynamic lighting, ect. You’re starting to get into very 3D-ish territory in many ways. Not only that, the less time spent rendering in the update loop (of which you only have 16 ms), the more you open the door to more possibilities such as heavy use of crazy physics, or instead of a minimap, being able to zoom out and render the entire map. It allows your imagination to go wild.
On that note, I’ve also finished the majority of the scripting API. You can see a complete list of default components in the entity creator in the level editor (still working on cleaning up the UI):
I’m using a pure Entity Component System that I wrote from scratch to be as simple and understandable as possible while being performant. ECS also creates more efficient caching, avoiding cache misses.
I’ve also introduced “Archetypes”, which will make it easier for people who are more used to inheritance. I don’t expect a newbie to get overwhelmed because they don’t know what a “MatrixStackComponent” component is, and what components to pick and choose. Instead, they can now choose archetypes like “Sprite”, “ParticleEmitter”, which will automatically choose a specific list of components for them based on what is generally needed for those types of objects. This allows people who are used to inheritance to be able to adapt easily, while more advanced users can pick and choose which components they want for specific objects, so they don’t have to deal with the gorilla-banana problem of inheritance and can favor composition.
“You wanted a banana but what you got were a gorilla holding the banana and the entire jungle.” - The creator of Erlang.
That being said, I hope to post more updates soon, as well as a new multiplayer demo. I can also host the old demo right now from a few months ago which only had lag compensation, collisions, and used the old renderer if that’s something anyone is interested in.