🖥️ C++ Game Development Libraries
In this post, we look at a couple of C++ game dev libraries. Godot and Unreal Engine, among others, allow you to create fully-featured games with fantastic lighting using in-built editors. When it comes to learning game development, as well as quick prototyping, a lightweight alternative is often preferable.
Raylib is a lightweight C/C++ game development framework, ideal for prototyping. We see some resources for getting up-to-speed with Raylib, using C++ in this post.
We will also take a peek at Flecs, a C/C++ entity component system, providing access to a modern, composition over inheritance approach.
Raylib and Flecs pair well, and both support compilation to WebAssembly (WASM), which is brilliant for prototyping, letting you share your work on the web. That is with no need for your audience to install apps in order to see your work.
Let me know if you find the post useful, and of course, if you would like to see similar content covering other C++ tooling.
☀️ Raylib Getting Started Resources
Simple, easy-to-use game development library.
Raylib 5’s release, last year, marked the tenth anniversary of the Raylib 1.0 release. Over that period, the library has been battle-tested and built up a community, which is great for finding content on getting started.
Raylib uses OpenGL, has full 3D support, you can develop with it on Linux, macOS and Windows, and you can also compile your game to WASM using Emscripten, making it quite accessible. Set up your Raylib project with CMake to make it accessible to developers working on different platforms.
The quickest way to get going with Raylib in C++ is to clone a CMake template repo, and get a copy of the Raylib Cheat Sheet (also available as a PDF). The Raylib Cheat Sheet is a list of all the functions that the API exposes, great for poking around and modifying demo code for learning purposes.
There are Rust and Zig Raylib bindings, though if you prefer working in Rust, you might consider Macroquad, which was inspired by Raylib.
Learn more about Raylib here:
- GitHub repo: raysan5/raylib
- Official Site: Raylib
- Code examples: Raylib Code Examples
- CMake C++ template: CMake template for Raylib
- Discord: Join the Raylib Discord Server
💪🏽 Flecs Getting Started Resources
Fast and lightweight ECS.
Entity Component Systems offer an alternative game data storage pattern, to a fully object-oriented approach. The ECS approach can be more maintainable as well as performant. Though not needed for all games, when you do want an ECS, you will want something performant, with a small footprint, which is where Flecs comes in.
Flecs compiles to WASM, using Emscripten, letting you deploy game demos as web pages. It has fantastic documentation, and you can see dozens of examples in C as well as C++ in the Flecs GitHub repo.
An alternative, popular C++ ECS is EnTT, which is used in Minecraft, among other games.
Learn more about Flecs here:
- GitHub repo: SanderMertens/flecs
- Official Quick-start: Flecs Quick-start
- Code Examples: Flecs Examples
- Discord: Join the Flecs Discord Server
Other C++ Game Dev Tooling
Of course, there is other C++ game-dev related tooling, alternative game frameworks to Raylib that you might consider are:
For creating a game backend, or just displaying diagnostics, on-screen during development, Dear ImGui is also popular.
🙌🏽 C++ Game Dev Libraries: Wrapping Up
In this C++ game dev libraries, we had a look at some C++ game dev tooling and the features offered. More specifically, we saw:
- why you might consider Raylib for prototyping a game;
- links to content for getting started with the Flecs ECS; and
- some alternative C++ game frameworks and ECSs.
I hope you found this useful. Do let me know if you would like to see more similar content. Also reach out if there is anything I could improve to provide a better experience for you.
🙏🏽 C++ Game Dev Libraries: Feedback
If you have found this post useful, see links below for further related content on this site. Let me know if there are any ways I can improve on it. I hope you will use the code or starter in your own projects. Be sure to share your work on X, giving me a mention, so I can see what you did. Finally, be sure to let me know ideas for other short videos you would like to see. Read on to find ways to get in touch, further below. If you have found this post useful, even though you can only afford even a tiny contribution, please consider supporting me through Buy me a Coffee.
Finally, feel free to share the post on your social media accounts for all your followers who will find it useful. As well as leaving a comment below, you can get in touch via @askRodney on X (previously Twitter) and also, join the #rodney Element Matrix room. Also, see further ways to get in touch with Rodney Lab. I post regularly on Game Dev as well as Rust and C++ (among other topics). Also, subscribe to the newsletter to keep up-to-date with our latest projects.
Top comments (0)