Kut: Yet another game engine in Zig hits it first release, v0.1.0

Kut: Yet another game engine in Zig hits it first release, v0.1.0

Hello. For the past year or so I have been working on this game engine (although the initial commit on codeberg is like 5 months ago). This was not the first time I tried to make a game engine, I have been trying since I was 16. Those attempts were honestly horrible, but I learned a lot and think this time I actually got something worthy and I will be sticking around for a long time.

PS: This is a bit long and not necessarily technical, so if you just want to see the the technical things, get started, take a look and not deal with my yapping please jump into the repository.

I tried a lot of languages(with some considerable sized/complicated projects), eventually settled on Zig because it really is the king when it comes to ease of building cross-platform projects and having A LOT of control. Honestly, have you ever tried creating a cross-compiler for Ada? I failed spectacularly, for a long time. Anyways, now in Zig I even have apk generator for Android. I can even compile my projects from Android to macOS as well. Heck yeah! Btw, do you know how frustrating to write Android apps using the native libraries? Whenever I am working on specifically Android layers I go insane, there is so much stuff missing from the actual native ndk but it is there on Java that you can’t even set/get the refresh rate without interacting with the JVM. Ridiculous. I like low-level development, but this ain’t it chief.

Well enough with that whole ordeal, engine is very much in its early phases but quite a bit of things are working. Enough that I am currently making an Android game with my friend. Engine itself seperates into two modules: Karga and Kut.

You can think of Karga as the foundation of the entire engine. The entire point of this is to provide a stable layer to build high level systems and/or very specific utilities on top of it. So it has to be very stable. I don’t like breaking APIs but I also recognize the need for it. This was my way of providing stability and ever-changing features. Therefore, in Karga, I avoided dependencies like the plague and wrote practically everything myself, even some of the C bindings. Gaining control over how I link libraries like X11, EGL or opening their dlls at runtime. Now with just one paramater change in your project you can either link at build time or dlopen at runtime, all for more choices!
I tried to design my graphics interface as unspecific as possibly I could think of all the while providing enough information to implementations so they can optimize and go fast. Though there are still areas to improve, I think I got most of the things right there. Well, currently there are OpenGL and Vulkan implementations, they work (not that they are great at it, but they do indeed work).
The audio interface is basically designed for the purpose of making realtime audio applications with it. BUT now that I am making a game, and sometimes I just need to play a sound effect, I see how pain in the ass it is, so I am designing a non-realtime, game friendly interface to go along with it as well. Not that the realtime part of it is finished but anyways.
Platform API is pretty much done, you can create multiple windows, query the screen information. For total of … 4 platforms, Windows, Linux, Android and macOS. Well, I cheat on macOS by using SDL3 because I could not deal with Objective-C so… But hey at least Windows is comple- uh huh, you can’t go fullscreen… Linux? Welp scan_codes work but no keycodes yet… Android? Oh that one actually works, except for the keyboard input but who needs that anyways…(I need it).

Oh anyways, lets move on to Kut. Kut is built on top of Karga, it litterally uses Karga as its dependency. So as I explained above, Karga’s graphics interface is very unspecific, which means it is very verbose and does not even know how to draw a rectangle. What it knows is that vertices and indices. So there comes kut.Renderer, it gives you an easy way to do all of that. Need rectangles and circles? There you go. Need textures or text rendering? Well, kut.Renderer does not discriminate, you can do that as well! Need more? Welp I ran out of juice so thats it (currently).
Honestly, currently Kut does not have enough stuff in there so you have to make your own stuff. I am planning to introduce a GUI system soon, that will help a lot and fill the gap a bit. My android game has a GUI system but it is so specific and dependent, there really is no way to extract it and make it general without reworking the entire thing and at that point its not worth it. There are also more fundamental problems I have to work on (mainly Karga implementations) before I can actually add more stuff to Kut.

Boy, did I yap huh. Anyways, if you are still reading, know that I am very happy that you were able to get here without closing it. Oh also, know that I would also be VERY happy if you tried my engine and give feedback… You can just clone the repo and run an example, it should work, as long as you meet the dependency requirements I stated in the readme. I actually wanted to get more done before doing a 0.1.0 release, mind you it is still not mature enough, but I am quite frustrated right know and I want other people to try it out. So I can at least get a sense if I created a mess or not.

https://codeberg.org/MeKaLu/Kut

Supported Zig versions

I try to avoid master, because it breaks me… and the code. So zig-0.16.0 it is!

Thank you for coming to my ted talk.

21 Likes

I just wanted to let you know that “kut” is a very common curse word in Dutch (it means cunt/vagina). Your package is called “cunt” for about 30 million people. Perhaps change the spelling? Like Kutt, Kott, Kat, Kyt?

2 Likes

Thank you for bringing that up, but its fine. It is also a very old Turkish word. It translates to “holiness, fertility and hapiness”. It was also believed to be used as “the authority to rule given by God.”
I have given an explanation what the names mean and represent in the readme as well.

Given gimp is fine, I think this name would get a pass as well.

3 Likes

In Uzbek (also Turkish lang):

  • Kut - Wait
  • Ko’t - Ass
  • Karga - Crow
1 Like

Neat! If you want any testers, I was just trying to figure out my rendering strategy for my next project.

1 Like

Also as Dutch, I think culturally we would for the most part think it’s funny.

1 Like

Somebody emailed me anonymously to inform me that in their language, “zig” means “poop”, suggesting to change the name. I wanted to reply and say, “wait until you hear about my performance optimization and observation project…”

23 Likes