niku: Year One
by Jan Kelemen
After working for a year on my game engine jan-kelemen/niku, time has come to publish an anniversary release 0.1.
What was done?
The engine development is primarily done with demo applications that reuse the same codebase. Currently, there are three of them:
gltfviewer
- Forward 3D renderer for glTF files implementing a Physically Based Rendering workflowgalileo
- Deferred 3D renderer with physics and scriptingreshed
- Text editor with bitmap font rendering and GLSL syntax highlighting
The complete list of features for each is shown in the intro video.
I quite like this approach as it allows me to figure out how things should work before promoting them into the core parts of the engine. Having a wildly different set of features between the demos also helps with making sure I don’t make the core parts too restrictive.
How did we get here?
It was raining on a Sunday. That was pretty much the moment when I decided to open the Vulkan Tutorial, having almost no prior experience with graphics or game development.
Following that rainy night (well, actually it took me a week to go through the tutorial), I continued by doing graphics demos until I had gotten the basic architecture of the code to a stable state. The video above features previously unseen footage of vkpong and vkchip8 demos.
I’ve gotten familiar with glTF loading and basic lighting model with pawn. Learned how to use a physics engine with geos and terrain rendering with soil.
I’ve also did a compute shader raytracer with beam, which unfortunately I wasn’t able to capture on video now. Recording it with OBS didn’t want to cooperate and the footage ended up jittery.
Contributing back to open source
I don’t want to reinvent the wheel completely for this project, so the engine requires quite a few open source libraries.
At the time of writing, working on niku
has directly or indirectly contributed to:
- 19 package versions to Conan Center
- Bugfixes to SPIRV-Tools, glslang, fastgltf, Vulkan-ValidationLayers and HarfBuzz
Along with some issues being reported to other libraries.
It’s funny, in the years prior to this, I was looking for open source projects to contribute to. I guess it’s true to simply contribute to projects you are actually using.
Development update
Some time has passed since I started to implement support for the VK_EXT_swapchain_maintenance1 Vulkan extension.
I finally got around to implementing the rest of the features provided by the extension. The swapchain can now be recreated by reusing the old one and the swapchain images use a deferred allocation. These changes should allow for a smoother experience when resizing the windows and a deterministic way of knowing when to release GPU resources used in commands that have been submitted to the GPU.
The code for this is mostly based on the official Swapchain Recreation sample. I won’t go into much detail here, but it almost made me draw UML sequence diagrams, probably for the first time in many years.
I still need to implement the nonblocking resize for the gltfviewer
and galileo
demos.
Final words
To be fair, according to the modern definition of the term game engine
, niku
would currently be classified as a game framework
.
I should probably add support for audio and make an editor for it.
Though the editor part requires some experimentation on my side on how it should work.
Thanks to my friends who discussed development topics with me, and to folks from Vulkan Discord and Graphics Programming for help along the way.
For any questions or corrections to this post, leave a comment in discussion thread on GitHub or any other place where you see this.
Diff compared to the state shown in the previous post.
Check out other posts in this series with #niku tag.
tags: C++ - Vulkan - niku