Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

My experience using a custom game engine.

A topic by bluesillybeard created Mar 12, 2024 Views: 308 Replies: 2
Viewing posts 1 to 2
Submitted (2 edits) (+1)

Around February 1st, I started working on a custom game engine. I was originally intending to use it for a large project, but I did have plans to make some smaller games along the way. At some point I heard about the Acerola game jam, and I knew this would be the perfect opportunity to test my engine!

My engine is written in the Zig programming language, and makes use of a library called Kinc (Kore in C) for opening a window and drawing graphics. Using Kinc might have been a mistake, but we'll get to that. Since I only had 28 days to make a fully functional engine, it was a bit of a crunch to get it working in time. Add onto that the fact that I am taking 16 credit hours of college courses (so ~48 hours a week of schoolwork), not to mention other things that happen in life.

What was easier than expected
I actually had a pretty solid idea immediately: fruit ninja, but with a twist. I won't spoil the twist (play the game yourself bro). It was also surprisingly easy to do the art - I am extremely bad at art, but it actually only ended up taking a negligible amount of my time.

What was harder than expected
There were so many problems that I don't think I could explain all of them without writing a book. The most annoying problem was how I integrated my entity component system into the rendering system. Each entity could only represent a single draw call - so for example, text has to have an entire object for every letter that has to be drawn. Speaking of text, my engine has no text rendering. All the text in the game is drawn ahead of time, and rendered as individual entities. Implementing the main menu was also unreasonably difficult. My engine has no scene loading system, so I had to manually delete all of the entities and spawn them back with every scene change, which caused a number of bugs and a lot of wasted time. My game engine also does not have utilities for things like cameras or physics, so getting a "camera" working was difficult, and I'm pretty sure I did it incorrectly since the horizontal positions are all inverted and I still have no clue why.

Kore in C: the most badly made windowing and graphics library ever created
The most difficult thing, despite all of that, was dealing with Kinc. My first issues were before I was working on the engine, but when I was getting Kinc working with Zig. Their build system (a program that turns the code into an actual binary that computers can understand) is completely insane. It's a fork of Node JS, which means their build system is also a fully self contained javascript runtime. Not only that, but compiled versions of this build system are included as git submodules for every platform. So when you use it, you're downloading the same thing about 7 times, which ends up being >1 gb of useless junk. The build system also does not have cross compilation, so to export a Windows build from my Linux computer, I have to spend an hour running a virtual machine to get it exported. But that's not the worst of it. As I was working on the primary mechanic of my game, Kinc had one more painful trick up it's sleeve: event spamming. When someone develops a game, they expect mouse movement events to occur once per frame. Each frame, the mouse moves x amount in some direction. Instead, Kinc would send somewhere between 1 and 4 events each frame, which wreaked havoc on my game. In the end, I had to apply a seriously janky patch directly to Kinc's source code to get my game to work correctly, and that was that point when I realized I should probably just finish the game and submit it before I loose my mind.

If you're still here, congrats! I myself barely made it through this jam without having a mental breakdown. If you want to play the result of my suffering, you can click the link next to my username.

Submitted

Hey man!  I also wrote mine in Zig, although I targeted the web.  My game isn't finished yet, but if you wanna check it out the code is on github :) https://github.com/ofrank123/acerola-jam.  I'd also really recommend something like https://www.raylib.com/ if you don't want to deal with all the hardware abstraction BS next time ;)

Submitted

I would have used Raylib, but it's missing a lot of features that are somewhat fundamental to the big project I plan on using my engine for. Thanks for sharing your own project, I can't wait to give it a look!