Knaj's Engine! banner

Knaj's Engine!

17 devlogs
62h 28m 45s

Basically a game engine made using Vulkan in C++. I’m still torn between regular and voxel. It’s just me working on it, and quite frankly it is scary thinking of how big of a project it is, so I’m keeping progress slow and steady.

This project uses AI

NO COPY/PASTE USED, NO VIBECODING USED. Used GPT and Claude for debugging and learning, i.e. “how do I…”, “what is…”, “explain this…”

Demo Repository

Loading README...

knaj

Added 3D!

At last, I’ve done it. I added a 3d rendering pipeline (basically altered the pre-existing scene pipeline). I added depth buffering allowing me to render the 3d object cleanly, without any weird artifacts, also altered some functions to accept 3-component vertex positions, instead of just accepting 2d. I’m not sure what to say more, to be honest. This wasn’t exceptionally hard as I’ve done stuff like this before. Next up, I’m adding a way for the user to input their own 3d model and render it.

Psalm 145:18
“The LORD is near to all who call on him, to all who call on him in truth.”

0
knaj

Shipped this project!

Hours: 14.46
Cookies: 🍪 271
Multiplier: 15.63 cookies/hr

I added a working (!) text renderer to my game engine. It was quite hard, especially debugging it and adding msdfs for smoother rendering far away. It works by generating a VkImage for every font in the fonts folder by rasterizing every single glyph using msdfgen, then packing it and uploading to Vulkan. The main issue after I ‘completed’ it was wrong glyphs being displayed. At first I thought it was a Vulkan upload issue, then maybe a coordinate issue, but in the end it turned out to be just my mistake (as always). I was using ASCII codepoints for rasterizing glyphs instead of msdfgens GlyphIndex. Incredibly frustrating, to be honest. I’m really proud of this one, especially this was my first time creating something like this in Vulkan. Got some spicy ideas for my next ship (if I do it quick enough). Also, as some feedback suggested, I added a video demo in my latest devlog. Cheers!

Truly, He is risen!

knaj

At last, it is done! (almost, the line is annoying.)
The text renderer was insanely annoying to do, and the error I mentioned in my last devlog was in fact not an upload error. I was using the ASCII codepoint instead of msdfgen’s GlyphIndex, resulting in the wrong character being drawn. I figured it out, though (with the help of Claude, sadly). Up next I’m thinking of making an input field marker in my XML parser, then using user input to render a 3D model on the screen. I don’t think it’s going to be too hard, though I might eat my words later.

Happy Easter!
Christ has Risen!

Matthew 28:6
“He is not here; he has risen, just as he said. Come and see the place where he lay.”

Attachment
0
knaj

Holy fuh. This is my biggest devlog so far, and by biggest I mean most time-consuming. In fact, I still haven’t finished working on this one hell of a feature. The feature is nothing else than my beloved Text Rendering. Now don’t get me wrong, I’m really close to finishing it, and from your feedback I know that voters do not like such big devlogs, but I truly lost track of time trying to get this to work. I got to the point of the text itself rendering, but the sampled Glyphs are not the ones that should be sampled. For example, when I try to sample ‘h’ for ‘hello’, it gives me an ‘e’. Do I know why that happens? Not at all. I mean, I guess it could be coming from how I actually send the Glyph data to the GPU using image copies and all that, but I can’t be sure until I check it out for myself. I was struggling with a bunch of validation errors all along the process of implementing this, which ended in me creating another VkPipeline, another VkRenderPass, more descriptor sets, including a bindless one. That was really hard. Well, not necessarily hard, but time-consuming, yeah. It’s weird having to make a devlog mid-implementation, but eh, at least I get to yap a bit and share another Bible verse. Speaking of which,

Psalms 23:6
“Surely your goodness and love will follow me all the days of my life, and I will dwell in the house of the LORD forever.”

Attachment
Attachment
Attachment
0
knaj

Shipped this project!

Hours: 43.63
Cookies: 🍪 638
Multiplier: 14.7 cookies/hr

This is a big ship. The biggest one so far.
It includes:

  • Scene aspect ratio fixes
  • Texture system (bindless, a lot of fiddling around with Vulkan’s bufoonery)
  • Event system (Big thanks to TheCherno for the tutorial)
  • Input polling
  • Audio system using OpenAL
  • Precompiled event header
  • Buttons!

Yeah, a lot of stuff, a lot of different stuff. I really liked implementing the textures, despite it being one annoying process. I love how the texture system turned out and all the stuff I learned while doing it. Another thing, the Audio system. That’s completely new for me, I’ve never tried adding audio to any of my games/apps, but it was fairly simple, unlike what I expected it to be. The event system, input polling and buttons were quite straightforward, though. Anyways, I loved working on shipment. Next up, button functionality… yay…

Proverbs 13:10
“Pride only breeds quarrels, but wisdom is found in those who take advice. “

knaj

Added buttons!
This required some tweaking in how I handle XML and stuff, also the event system I built came in handy! The GLFW/Vulkan coordinate system discrepancy really was a pain in the ass, since I hate doing math. Next up, I’ll add actual functionality to the buttons, maybe make them look better, actually handle user input. Damn, it’s a long way to go…

1 Peter 3:15
“In your hearts, set apart Christ as Lord. Always be prepared to give an answer to everyone who asks you to give the reason for the hope that you have. But do this with gentleness and respect.”

Attachment
0
knaj

This wasn’t much work, but certainly something very new for me. I added audio, using the OpenAL library. When I saw the name, I really got flashbacks from learning OpenGL for the first time and wanted to quit. Glad I didn’t, it was fairly simple compared to what OpenGL had to offer. The hardest thing was abstracting all the call into the Audio & Audio Manager classes, but I’ve done that before with Textures, so it was no big deal. There are no issues with the audio, just some backend stuff that is not in my control, so I could not care less, frankly. Toodles!

P.S.: I cannot be asked to set up screen recording for Linux, so enjoy this screenshot of the backend error.

Psalm 5:12
“Surely, Lord, you bless the righteous;
you surround them with your favor as with a shield.”

Attachment
0
knaj

New bug found!!11! I’ll have to adress scene object scaling. Anyway, I added an event system! To be expanded though, I’m not sure what I’ll need in the future. Next up, some input polling, maybe an audio component, adding objects by user, yap yap yap yap…

Matthew 6:3
“But when you give to someone in need, don’t let your left hand know what your right hand is doing.”

Attachment
0
knaj

I addressed the bugs. It was annoying to be fair, had to deal with move semantics and other really boring stuff. Glad that’s done tho, can now move on to some more juicy stuff.

Matthew 22:37-39
“Love the Lord your God with all your heart and with all your soul and with all your mind. This is the first and greatest commandment. And the second is like it: Love your neighbor as yourself.”

Attachment
0
knaj

Not as much work. But there sure is a lot of bugs. Anyway, I did some abstracting and actually managed to create a separate class for what the user sees. A Scene Object, if you will. Next I’m planning to either address the bugs (eughhhhh) or add a way for the user to add objects themself. Does that sound fun? Not at all! Will I do it? Probably. Anyway, toodles!

1 John 5:11
“And this is the testimony: God has given us eternal life, and this life is in his Son”

Attachment
0
knaj

This took a long, LONG Time. Holy, I’m so glad I’m done with this. What I was working on were bindless textures. These require tons of extensions and a somewhat decent graphics card. How they work is: you add alllll your textures into a single descriptor and select textures with indices (using a push constant or something), instead of swapping between desriptors or descriptor sets. This is more efficient and - after setting it up, a lot easier. This was a major pain in the ass, though and I really felt like giving up or starting over. I’m so glad I didn’t! Either way, I’m planning to add other texturing methods than bindless in the future to allow weaker cards to run the engine.

Romans 8:38-39
“I am convinced that neither death nor life, neither angels nor demons, neither present nor the future, nor powers, neither height nor depth, nor anything else in all creation, will be able to separate us from the love of God that is ours in Christ Jesus our Lord.”

Attachment
0
knaj

A minor fix.
As you can see, contrary to the last devlog, the triangle is a bit taller! Why? Turns out, I’ve been using the same aspect ratio for the scene view as I was for the rest of the UI. Rookie mistake, innit? Either way, to fix it I just expanded my descriptor pool, created additional descriptor sets dedicated to the scene view, created new uniform buffers for those descriptor sets and bound the descriptor sets when binding the Scene pipeline. A simple fix, not gonna lie. Next up, ray tracing! yay…

Ephesians 4:2
“Be completely humble and gentle; be patient, bearing with one another in love.”

Attachment
0
knaj

Shipped this project!

Hours: 17.72
Cookies: 🍪 220
Multiplier: 12.39 cookies/hr

Created the XML parser, used it to create a basic (extremely basic) UI layout and get an even more basic scene rendering.

James 1:2-3
“Consider it pure joy, my brothers, whenever you face trials of many kinds, because you know that the testing of your faith develops perseverance.”

knaj

Oh my, this took a lot.

I had to create a whole another pipeline for this, and fiddle around with the viewports.
I also ran into a weird issue where 1% of the screen turned into 1.46% after it was displayed.
I don’t know how I fixed it, it just went away and we’ll keep it at that. Amazing.

John 3:16
“For God so loved the world that He gave His only begotten Son, that whosoever believes in Him, should not perish, but have everlasting life.”

Attachment
2

Comments

Jahaan
Jahaan 2 months ago

I’m basically doing the same thing, except I’m making a graphics engine in vanilla java, so its a lot different in terms of how you manage data and memory allocation, but the underlying concepts for triangle rasterization, and other graphics concepts are the same. I’ll be looking forward to your progress.

knaj
knaj 2 months ago

Thanks! I’m actually gonna go for raytracing in the scene view (the black part). I have no clue how to do that yet, though.

knaj

Today’s a boring one.
I just improved the XML parser a bit, which did take WAY longer than I wanted it to take.
Oh well.

Attachment
0
knaj

Hi!

I’ve finished working on the XML parser (for the most part, i can only render “Frames” for now).
This was quite a challenge, requiring me to consider multiple solutions to various problems.
I suppose the next step would be to add buttons or stuff.

Attachment
0
knaj

This was rather long, and I hated every second of it. Eh, I guess you learn through pain. The result is underwhelming nonetheless. What I’ve done is I made a very basic XML data parser using pugixml. Sorting and figuring the data out was a real pain. To be fair, I’m still unsure whether it works. Hopefully it does. I hope the next devlog will show the data being implemented.

Attachment
0
knaj

Had to install NSight for this one. I added Uniform buffers, descriptor sets, etc. This allows me to translate, rotate both the geometry and the camera! Now that’s fun. It really is not. Either way, this should allow me to make a GUI, at last.

Attachment
0
knaj

Shipped this project!

Hours: 1.81
Cookies: 🍪 14
Multiplier: 7.8 cookies/hr

Finished the basics.

At last, the very groundwork of the Vulkan rasterizer is done. Now I’m here with my square and a vision. I really didn’t enjoy writing this, but I suppose I learned more about how Vulkan works. On the bright side, I’m now able to move on to the more juicy stuff, which I’m surely looking forward to.

knaj

Now it’s not just a triangle, it’s a square. A rather neat one as well.

What I’ve done is optimize memory a bit by using so-called Staging Buffers. These buffers allow transferring data from the HOST_VISIBLE | HOST_COHERENT memory to the DEVICE_LOCAL memory, effectively improving GPU read times. Another thing I’ve done (also the more noticeable one) is implement index buffers! These allow me to reuse vertices and help me draw a beautiful square like this one with just four vertices instead of six.

Attachment
0
knaj

Still using the Vulkan tutorial (vulkan-tutorial.com), however in a somewhat ‘me’ way. Vulkan is honestly such a headache. I can never remember what comes next. Enough ranting, I’ve managed to get the Vertex Buffers working, and I’m getting quite the beautiful triangle. The result is kind of underwhelming for this amount of code and work, however I’m still proud of it.

Attachment
1

Comments

agrus101
agrus101 3 months ago

hey