Status update (what's this?)
There was a bug here. It's gone now.
date published
category dev

Cachicamo, a humble game engine in C

As a new year's project, I set out to retake game development. For this, I needed an engine that fullfilled my needs. I've always been interested in the internals of game engines and I've spent far more time making game engines than games themselves. This time, I wanted to get the "making the engine" part out of the way as soon as possible.

So, first, where does the name come from? Cachicamo is the Venezuelan name for the armadillo. Choosing it was quite easy: I was visiting my parents for New Year's Eve and I asked my mom "hey, I need a name for a project". She just said cachicamo and I liked it. It'd be nice if things could always be this simple.

Cachicamo is being developed in plain old C for a series of reasons. The first draft of this blog post went deeper into these reasons, but you know what? I could write a thousand more blog posts ranting against OOP and the state of C++. But today I won't. This post is only about Cachicamo

Cachicamo utilizes SDL2, along with SDL_GPU, as the rendering backend. I've only had experience with 2D development, but some day I'll get into proper 3D development. I particularly would like to get into shaders, they're still just black magic to me.

It implements an ECS system. Right now it's a very simple one, where systems know each other and "talk" to each other directly, e.g., the sprite component must know the position component. In the future I'd like to implement a simple message queue as a controller to handle all interaction between components.

Game logic is handled mainly by what I've termed behaviour components. They associate game state with actions, that is: they're triggers that activate based on a certain world state. For example, a complicated AI system can be implemented by stacking behaviour components that depend on each other, as well as much simpler things such as: if player close to door allow open door action, and so on.

In just 4 days of relatively simple work, I've managed to get it to a usable state. I remember back in my second year of university I took about 6 months to get something actually usable in C++. It was this gargantuan thing that required almost encyclopedic knowledge of the whole engine to do things with it. I was then blinded by all the "good practices" of OOP design. On the other hand, with Cachicamo I can just write:

behaviour_register(closeToDoor, ENTITY_PAIR(door, player), setOpenable, door);

Which I think is just about as close as you can get to code that explains itself.

My plan is to have something decent before LD44 starts. Which is a non-hefty goal. I think I've been able to be humble and learn from my mistakes. Every day I'm able to develop better code in less time, and that makes me really happy. I finally feel, after about 7 years programming, that I'm getting the hang of making good code.

If you want to take a look at what little I have so far: here it is.

Have a good day and thanks for reading!
Love you,