Modern Vulkan

modern vulkan image

Intro

A game engine using modern vulkan techniques such as descriptor buffers, dynamic rendering and pipeline state-less rendering using VK_EXT_shader_object.

This game engine was created after my attempt at a cross-platform DirectX12 and Vulkan renderer to discover the differences between the APIs. After learning about the new vulkan extensions I decided to create a pure vulkan renderer using the new extensions.

Besides the renderer, the engine has many additional elements for my learning of game engine architectures.

Project overview

View repository

Engine standouts

Created using the BBFramework, my custom framework

My own framework to replace parts of the STL to learn how and why it works. At times adjusting it to exactly what I need. Most data containers and cross-platform code comes from here. The base bones of the project. This project has a modified version of the BBFramework and is consindered to be the most up to date.

Tight memory control

Most if not all memory is managed via memory arena's, which are linear allocators with debug functionality to track memory usage. There are memory interfaces for freelists, but the underlying memory comes from a linear allocator.

ECS

The engine's internals are using an ECS system per scene/game, this makes adding new features much easier.

Multiple scenes with async updating

The engine is made to support multiple scenes. With the image above you can see the the showcase rendering scene, and a game scene with a generated "dungeon" layout. These scenes can be updated async and you can have multiple of these scenes. All scenes handle their own input events and scenes have a compile-time enforced interface due to c++20 concepts.

Custom math library

In order to learn the underlying math I have implemented most math functions and primitives myself. Pure for learning.

Lua support

Lua acts as the high-level language for gameplay code, each scene/game has it's own Lua state that it handles. Specific C++ plugin code can be written for specific games.

Content

Rendering Features: 1

Material change on models

Thanks to the VK_EXT_shader_object extension the engine supports changing materials on models in a very simple way, in this example the models waves and is transformed to a lower resolution by just switching a shader around. No pipeline recompilations needed.

Bloom

The renderer supports bloom, this is implemented with a ping-pong render target, with the final render target being the geometry pass result.

With the above solution there is no need to do any manual blending.

Shadow Mapping

The renderer supports multiple lights and shadow maps. Each frame holds a number of textures that represent these shadow maps.

The shadow maps are represented as an texture array.

shadow mapping image
Engine Features: 1

Lua support

The engine support supports lua scripts and can reload them, if they get dirty due to bad calls the engine will catch it.

Multiple games in the Editor

The editor can support multiple games, since they hold their own ECS structures they do not interfere with each other. All games use Lua as their high-level language.

Editor Gizmo

The editor has a gizmo where you can change the position or scale for game objects. Math needs improvement and rotation is WIP.

Rendering Features: 2

Normal Mapping

The renderer supports normal mapping for pbr

normal mapping image
Engine Features: 2

Shader hot reloading

The engine support hot reloading shaders, it came very useful when developing the bloom and shadow map shaders.

This website was partially made with the thanks of our wonderful new technology, ChatGPT