Some weeks ago I found myself having a migraine. On that same day, I found out that migraine medicine is composed of basically two things. First, your average pain relief medicine. Second, *caffeine*. So, is that the secret? Is that the deal? That’s how you deal with migraines! Pain Relief Medicine with a side of coffee. I will keep that in mind.
Anyway, turns out that having a side of coffee at 9PM will keep you awake for some time. So I decided to, on a Friday night, do what every normal person does on a Friday night, write some game engine code.
Here are a few tasks that were cooking in my head.
I wanted to remove a bunch of things of my game library. The concept of layers, a debug memory tracker, precompiled headers, and dear imgui.
Having DearImGui on your C++ graphical project is pretty much a must in our Holy Year of Twenty Twenty Three. But it goes against my design philosophy that gueepo2D should only contain the bare bones to make a game. It can always be added into the game, or in a separate project alongside the game using the SDL2 and glad as dependencies, as those two are already included in the library.
DearImGui is very useful when creating tools, but I believe that tools should exist alongside games, not engines (Take that Unity Users!).
game jams, wintermute, and ECSwntrmt by gueepo
On February 26th, 2023 the world has changed. I participated in a game jam and the experience and the result were so terrible that it made me reconsider my game library, the tactics game engine that I wanted to make with it, and the games I wanted to make.
A big win I had during this game jam was adding an entire API to my json file wrapper that was able to handle arrays, this was a big step towards being able to make games that are more data-oriented. But making a game on this piece of tech was a nightmare!
Human issues aside, there were a bunch of problems in the game engine that made it harder for me to able to do something with it. The first one is that gueepo2D is, by design, a bare-bones game library. It provides you with an application interface, it is capable of handling input and drawing textured squares to the screen, sure, but making a game requires a lot more abstraction, it requires a lot more tools.
In a sense, gueepo2D is something you use to make game engines, it is not something that you use to make games, although it can be used to make games.
The biggest thing that it lacks is some sort of Entity Component System. I have probably written a dozen times that “I don’t *need* an entity-component-system”, and it’s true, when making an engine that is tailored for tactics games I am confident I can come up with my own data structures that will work better for what I want to make, but what happens when I’m not really certain of what I want to make, and I need to make it fast?
Because that’s what a game jam is!
When you want more general-purpose functionality, ECS is a pretty good solution to go to, and not having it on the engine hurt my productivity and ability to partake in a game jam.
So here’s the question: If I need ECS to make simple games quicker, but ECS is against gueepo2D’s very own core philosophy, what is the answer? What is the solution? What should I do?
the goblin game engine
The Goblin Game Engine is the answer!
If “gueepo2D” is a piece of technology that you should use to build game engines, then why not build a general-purpose game engine on top of it? The Goblin Game Engine is born.
But what does this game engine have that gueepo2D doesn’t?
- A Resource Manager – A central way to store references to all types of resources that you would need in the game, and they all can be retrieved with a function call that asks for an ID. Not only that, the Resource Manager is data-oriented, so all the resources can be loaded from a json file, so no need to create pointers to create dozens of textures in the game.
- ECS and a Game World. You create entities, and the entities have components, all this is added to the Game World, a centralized place where you can see and consult all entities. The GameWorld, the entities, and the components will also take care of updating and rendering. And, of course, entities can be loaded from a file so you don’t have to spend hundreds of lines of code creating components.
- LUA scripting. Finally. Typing C++ is too much work, we need an easier way to add functionality to our entities without typing *too* much and without having to recompile the game, LUA is the perfect solution for that.
- Finally, an editor. If we can load configurations, resources, and entities from files, how do we create those files? Creating them by hand would be less work than creating it on code already, but the ideal workflow is to have an editor capable of creating, editing, and saving those files. Hence, The Goblin Editor! (currently under development)
Obviously, the final goal is to be able to create an entire game without having to touch C++ – That is a very ambitious goal, and I’m not even sure if I want to achieve that. Having Lua as auxiliary scripting is one thing, having it do the heavy lift on systems work is a whole other thing. But who knows! There’s a long road ahead for the game engine, and soon I plan on putting it to the test by making a small game and maybe partaking in another game jam.
But that is not all.
I forgot to mention that The Goblin Game Engine has a twin brother.
the machinist game engine
I talk a lot about making a “game engine really good at making the types of games that I want to make (tactics games)”, and I finally kicked that off. Well, this actually has existed for a while under the temporary name of gpg-1. But the goblin game engine and the whole experience with the game jam made me have a breakthrough and realize how this game engine should be done, and what it should look like.
So as I started making the goblin game engine, I also started “sketching” the machinist game engine.
This engine is called “machinist” because I desperately wanted a name that was related to Final Fantasy Tactics, and after looking at all characters’ names and jobs, I stumbled upon Mustadio’s special job, a Machinist. And I think it is a suitable name for the engine.
There’s a lot of work to be done on machinist.
Just like the goblin game engine, its focus is to be data-oriented, but this game engine can make way more assumptions about the final product than goblin.
And just like goblin, machinist will also have an editor tailored for creating the adventure maps of RPGs, and creating battle maps for tactical turn-based battles.
Whatever come out of this is still months away.
Lastly, the final game engine adventure that happened on the last week or two after months of not doing game engine work was the one of adding the ability to export the games made with gueepo2D to the web.
This is very important for me because unless you are on Steam you don’t really want to download a game and click on a .exe file. Specially if we are talking about gamejams. Let’s be real, you are going to play a game jam game for 5 minutes at most, so being able to run all this on the web is very important.
Running emscripten through the engine took some work, but it is surprisingly easy considering the end result. You would imagine compiling a graphical application written in C++ into web assembly would be something extremely difficult. But it actually only took me a day. Well, whoever is behind emscripten is probably doing tons of work, and I appreciate that.
Changes to the engine include:
- Initializing OpenGL ES 3.0 instead of the default OpenGL Core 3.3 when building through emscripten
- Compiling an entirely different fragment shader and changing the OpenGL version on the header of the vertex shader
- Setting everything up on CMake so it can generate the proper makefiles to build the code where it outputs a playable version on HTML5
- An annoying thing that took me a while longer to notice and fix was that on OpenGL ES GL_RED is not a valid internal format, instead I have to use GL_R8, but when changing that my fonts worked just fine on the web, hooray!
So with all that, I’m looking to put my next little game on the web and not having people need to download it!
You can check the Goblin Game Engine HTML Demo Here:goblin game engine by gueepo
why no one ever told me boy genius was a thing?