As a hobbyist game developer starting a new game, I was faced with the dilemma of what game engine to pick. Should I use a prebuilt game engine like Unity, Unreal, or Godot? Should I just build out my own engine?
After research, I stumbled across Raylib, a game library built in C. On its website, Raylib is described as “a simple and easy-to-use library to enjoy videogames programming”. While traditional game engines come with a full suite of tools including scene editors, animation tools, physics, particle systems, and a plethora of other built in features, Raylib keeps things simple. All of the available Raylib functions fit neatly onto a seven page PDF including functions to draw objects to the screen, handle keyboard/controller inputs, audio, and some basic collision detection.
Despite already having a decent amount of Unity experience, I decided to pick Raylib for my game, and it’s been an absolute joy to use! Here are my top 4 reasons why I chose Raylib over other game engines.
Reason 1: Lack of Prebuilt Features
This first reason may seem counterintuitive, but this was actually the main drawing point for me. It would have been easy for me to jump back into Unity and leverage all of its built-in features. But I wanted the learning experience of designing my own game architecture and systems.
For example, Unity comes with built-in logic for rendering, updating, and deleting game objects, where the main game loop logic is abstracted away. Raylib gives you functions for drawing things to the screen, but it is up to the programmer to program their own game loop logic. For my game, I have a list of all game objects that need to be rendered. My game loop function iterates through this list and draws them to the screen. Then, it loops through this list again to call each object’s update function (to show animations, movement, etc.).
I also had to implement code to check for game objects marked as deleted to safely remove them from the list of objects to render without causing memory errors. Implementing this was a lot more work than if I’d gone with a more established engine, which handles all of this for you. But designing this system myself taught me a lot about how these underlying systems work in other engines.
Another huge pro of Raylib’s simplicity and lack of features is that it makes the library extremely lightweight. The base engine for Unity takes about 4-6GBs and Unreal takes about 30-40GBs. And on top of that, adding in more modules can add an additional 30-40GB for Unity and 100-200GB for Unreal! Raylib, on the other hand only takes up a few MBs. That means I still have plentyyyyy of space left on my computer.
Reason 2: Convenient Built-in Features
Contrasting with my previous reason, while Raylib lacks some of the features other engines have, the library is very intentional about the functions it does give you. While I really wanted hands-on experience writing my own systems, I didn’t want to get bogged down doing too much from scratch. For example, if I had decided to design my own game engine from the ground up, I would have had to write my own graphics renderer, which would have taken a significant amount of time. It would have probably been months before I even started coding the actual game if I had decided to go with no game engine.
Since Raylib already comes with basic drawing functions, I was able to get something drawn to the screen within minutes of setting up my project. The library strikes the perfect balance of giving you the basic tools you need to get started while also giving you the freedom to implement things yourself.
Reason 3: Free and Open Source
Raylib is completely free to use, and all of its code is publicly available. In contrast, while game engines like Unity and Unreal are free to use, they each have their own pricing models to take a cut of revenue for released games that make a certain amount of money. Game developers who use these engines are at the mercy of these companies’ pricing models. And, there is often a lot of backlash when these pricing models are updated. With Raylib, developers don’t need to worry about this at all.
Another free, open-source game engine I was highly considering is Godot. This is a newer engine that has built a lot of traction in the game development community as an alternative to Unity and Unreal. The main reason I didn’t go with Godot was related to the reasons outlined above. Godot comes with too many built-in features, and I wanted the freedom to implement them myself.
Reason 4: Getting Experience with C++
C++ is often the go-to programming language in the gaming industry due to its blazingly fast performance. That’s a crucial metric for games, which often make hundreds if not thousands of updates per frame. While in university, I was primarily exposed to Java in my courses. And at my current job, I primarily use TypeScript and Kotlin. Because of this, I’ve never really had the chance to dive into C++.
While Raylib is built in C, it comes with a lot of other bindings. That makes it possible to use Raylib with your programming language of choice, including Java, Python, Go, etc. I went with C++ because I wanted the language’s performance benefits while also learning more about memory management, something that’s handled automatically for all the languages I primarily use. There has definitely been a learning curve with managing memory, needing to deal with countless unexpected segfaults. However, it’s been extremely rewarding.
Raylib: A Library That’s Easy to Work With
Raylib is an extremely simple, super fun library to work with. I’ll continue to use it for all of my games for the foreseeable future. I highly recommend it to any game developers who want hands-on experience coding their own systems to gain a deeper understanding of game architecture.