Menu Share

C++ Packages for a custom Game Engine

by | Last Updated:
C / C++

Developing a game engine is hard work. It is really harder if you have to do it by yourself. This is why most people turn to production ready game engines like Unreal, Unity or Godot. But if you’re like me and you like developing your own tools you will find here listed a pretty good amount of packages. These packages will really help you out when creating your own engine so that you have some work done for you and also in an optimized way. This way you can focus on the places you want to make your tool custom and not on reinventing the wheel.

If you want to know how to include these packages in your project using CMake you can check the article where I talk about managing dependencies or even easier how to manage them with VCPKG.

Table of Contents

Graphics

Let’s start with graphics. This is arguably the most important thing a developer focuses on when creating his own game engine. And the choices here are huge. So much that you often can freeze trying to choose the best one. Or even worse – decide in the middle of engine development that the one you chose is lacking. So I’ve prepared only the best choices for you here:

Windowing

GLFW3 or SDL2 are the most popular choices here. I often go for GLFW as it is focused on just the windowing part and allows me to pair it up with other libraries. SDL2 of course is more like its little engine out there since it provides also code for audio, keyboard, gamepad, mouse, etc.

Graphics Libraries

Again a popular choice here for your game engine is SDL2 but there is one that is ofter overlooked when choosing your graphics library. This is because it is not that popular on the web and people don’t talk about it enough. This one is BGFX a rendering library. It is one of the best choices as it is API agnostic and can work with OpenGL, Metal, Vulkan, Direct3D, WebGL and also GNM for licensed playstation developers. It also supports a lot of platforms. You can check out my BIG2 stack for this library.

Other than these two you could go for raylib which like SDL2 gives you access to a few more functions except the graphics. An honorable mention is also SFML for creating 2D games.

Update: It is also possible to work with Google’s Dawn framework which is based on WebGPU and also provides a desktop implementation through whatever the native API is.

Utilities

Well no graphics programming goes without shaders or math libraries. So the choices here are pretty clear:

  • SPIRV-Cross – is a set of libraries and tools that allow you to compile but also inspect and read shaders into all kinds of formats.
  • GLM – is a really popular math library for graphics. Originally it was created for OpenGL but it can be used with all kinds of projects.
  • ImGui – of course you would always need to display intermediate information and imgui provides you with a nice GUI interface to do that.

Physics

This is the next major topic. Some people will go with their own physics libraries and what is the purpose of creating your own engine if you’re not going to create something yourself. Well if physics is really not your strong side here I would suggest either going for licensing a good engine like havok (being very hard to get your hands on) as a paid option or going for the free ones – Jolt, Box2D, PhysX & bullet3.

Audio

Don’t leave the audio for last. A lot of people that I’ve heard of always leave the audio implementation for last but it is one of the most important decisions. There are a lot of paid audio libraries so I will give you the only free option that I recommend. This is OpenAL-soft.

Update: Steam also released an open source 3D audio library called Steam Audio. It is limited to PC though.

Tooling

You cannot create a game engine without having some tooling around. And there are quite a few libraries that you can look at here so let’s get started:

  • Filesystem – implement C++20’s filesystem API in earlier C++ versions.
  • Watchman – Utility for monitoring file changes on the filesystem. Useful for monitoring data and scripts.
  • Optick – Performance profiler for games. Cannot build an engine without monitoring performance. It will split and show you data in frames.
  • MTuner – Memory profiler. Very good for catching those leaks. I also talk about it in this post here.
  • Emscripten – for porting your game to the web. I have an article here on the blog on how to use it with CMake.
  • Tiled – is a 2D map editor you can already use. You can have libraries that help you read tiled files in your engine.
  • CR – for hot-reloading shared libraries. This way you don’t need to restart your game when you build your project.
  • Backward-cpp – for getting a nice stack trace to include in crashes of your game.

Other

Well there are some more that you might want to include in your game engine. This is based on your use case of course.

  • EnTT – Entity Component System
  • Lua – Incredibly useful scripting language. I recommend using it with the library sol2.
  • RapidJson – for storing and reading data in a JSON format. Will also help you for reading formats like gltf for 3D models which is based on json.

Conclusion

These are the most basic ones to get you started. If you feel like there is something missing that you know is a great package – do not hesitate to write in the comment section so that other people find it later.

And if you wonder how to use packages in your C++ project or how to start with managing your project check my CMake articles.

Time4VPS - VPS hosting in Europe
Leave a comment