This project masterfully strips away modern engine bloat to showcase the elegant logic of voxel architecture through pure C++ and Raylib. It is a refreshing return to first principles that prioritizes fundamental engineering over high-level abstractions.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
I made a Minecraft Clone in Raylib and C++Added:
While I was streaming implementing the skeleton in my Java Minecraft clone, I got this message from a viewer. Dude, no offense, but your project management worse than beginner. Dude, a bad project manager just slows you down. Sorry for sounding rude. I could explain that when the churner revealed my project and I wanted advice on how to stop making so many Minecraft clones, he said this.
What advice do you have for organizing and abstracting the code? This is my fourth attempt and I always start over.
So, on one hand, I think starting over is probably healthy. However, on the other side of this coin is the fact that if it's the your fourth attempt of writing this Minecraft clone and you think that you keep having to start it over and you're not sure about how to organize and abstract the code, you might also just not be implementing the complete picture. That's why the project has become such a mess where I have my new entity implementation using components while somehow still using my old implementation labeled entity old.
But he also said this, I think based on what I've seen here, my advice to you might be to just push through this desire to organize and abstract the code and actually get the product working.
get what you're trying to make working, at least to an extent where you're like, "Okay, this is like an MVP." I added smooth movement, ambient occlusion, zombies, skeletons. They can even shoot at me with arrows. I have redstone that works, a bow, even with a cool animation. I pushed through enough and this time I want to do the clone in Railip. It's open source, which means you can see the code that has built it.
And behind the scenes, it uses OpenGL, which I also used in my Java clone. And the exciting part is I can use C++ with it. Finally, I can code in a language that doesn't have a garbage collector.
This is my old RAI project. I was trying to make a physics library, and I needed quick visuals. I cleaned up the project and set up the sky to be the same color as in Minecraft. Railip has a web page filled with all the functions it offers and to the right some context to what each one of them does. I have a set target FPS function. You know how hard this is to implement in with OpenGL. The first and most important feature we need is an indication in which direction we are currently looking at. Even in this video we will need its help in two situations. once to render a cube through code and another to render multiple subchunks. And one subchunk is a group of 16x 16x 16 blocks. Every game engine, even in Minecraft, you can see these colored lines. They show the positive X, Y, and Z axis directions. I drew them in my RA project. Well, it's hard to see since they're very thin.
This is better. The idea is once I have the direction I'm looking at on screen, I can test if it's accurate using these lines. First, I got the direction the camera is looking at as a normalized 3D vector and drew it in the top left corner. You can think of a vector as this arrow in 3D space. Normalized vector means its length should be exactly one. So, basically looking around is the same as moving this vector along the outlines of this circle with radius of one. Using math, I had to somehow check in which quarter of the circle we are looking and output with text on the screen the information.
Positive x, positive z, negative x, negative z. Perfect. Yeah. So now we get where we're looking at. This will be important when we try to draw uh cubes.
What is the next most important thing we need to implement? It would be this cube mesh template where using it I can easily create any kind of shape. How do you think Minecraft renders a complex block like the anvil? Every block in Minecraft is stored in a text file as instructions on how to draw it. These are the instructions for the anvil. The part we will focus on is the list of elements. The list is a couple of cubes that form the anvil and how to texture them. And let's keep it just between the two of us. But this is the project today. And we implemented that same anvil with what we are about to build.
All of these are cubes. This is what I want to abstract this creation of cubes.
And each one of these is the same. It has from, it has to, and it has description about the faces like which texture are we using and what part of the texture and I had this in Java as this class cube mesh template where I use it for example when creating the iron block here. It's from 0 to 16. So it's a full block. This is actually the limit for it. and I set up the information and I generate it. Now I have a class that I can configure and generate data needed to render a simple cube and I need to give this information to ray lip in order to draw it. Now in Ray lip how can we draw a custom mesh?
For example in Unity to draw this subchunk I had to create this through code. This is called a mesh. It's a collection of positions texture coordinates and colors relip custom mesh. How do they do it? Here is an example. And they create a model from mesh. And here they generate a mesh. Generate mesh custom. This is what we're interested in interested in. We'll follow this guide and actually first we'll just use this generate mesh cube as of now. Get accustomed to using models, textures, etc. And then we will replace generate mesh cube with generate mesh custom. Now the question is why the model is dark? They're obviously using a texture here. If we look at it.
Yeah. Here the cube sphere hemisphere cylinder. All of these they're using this texture. Oh, because it's Yeah, I need to do the white color. Yeah, that fixed it.
That fixed it. And how do they do it?
They create a mesh. Oh, they allocate memory for the mesh. And here the vertex normal and text coordinates.
Vertex normals text coordinates. And here this is just one triangle. Okay. So it's the last model custom triangle.
Yeah, just one triangle. Um this is our mesh for each side. It's drawing a triangle.
Yeah. Once we solve at least we're uploading something and drawing something. Uh but we're making somewhere a slight mistake. To the left is our monstrosity and to the right is our goal. This is what we want. Using a special program called render do I inspected the mesh of the cube. Here I can inspect the data received and looks like there are only 24 vertex positions and I expected 36. And now we have a cube with textures that are probably bad. But the cube is drawn properly. Only the textures are wrong. We can simplify it and do just one face. Let's just do the north and see what's up. This is the north which is towards negative z. Yeah, it's the north. This is actually the north. And then here, why is it time three? Oh, it should be times two. Finally, I saw the mistake. Don't tell me that was the mistake.
Okay. And now we have a cube generated by ourselves. Finally, without much change in the code, I generated two cubes. And then quickly after that, 20 cubes with a single mesh. If we look inside, you can notice how there are faces of the cubes drawn that will never be seen. We need to fix this. Yeah, here it is. This is one sub chunk. And I think it's working without mistake because if we go inside, it's empty. So, we are we are properly cutting everything. Yeah, that's cool. And now we can make another sub chunk. If we can have two sub chunks, then we can have a whole terrain. The lowest part for me when using C++ came when I started organizing the code from one file to multiple files. I had an error after an error after an error. Finally, man.
Finally. Finally, it compiles. Finally, it compiles. Finally. Finally.
What a pain, man. What a pain. Now, we in theory should be able to easily create another subchunk. Now, in theory, I was drawing two sub chunks, but all I could see was one. So, what's going on now? Let's hit F12 and see. Do we have drawing? We have through two draw calls.
This is one. Oh, they are drawing in the same place. Oh my god.
Yes, I have two sub chunks and they are killing the blocks. They're killing the blocks. Let's do a couple of them. And because of a very simple mistake on my part, the game couldn't start when I wanted to render more than 30 sub chunks. Oh, think of a simple cube. A simple cube is uh has six faces. Each face four vertices. So 6 * 4 24. This is if you use indices. If you don't use indices, it's 36 because it's six faces. Each face has two triangles. Each triangle has three vertices.
So each face has six vertices in 6x6 is 36. So we have two options to pick for vertex size. And I picked the lower one since I use indices. But as it turns out, it was too little space. Yeah, that was dish. Yeah, my bad, guys. It's finally time we add terrain generation and use Minecraft textures. I downloaded this pearly noise C++ library. You can barely notice the terrain generation, so let's remove this texture and the fuzzy pixels at the distance. I reused the texture from my other Minecraft clone, but when I run the game, everything was dark. It turned out there was no texture that was used. I remember that this amazing channel once shared a trick on how to easily access files in C++. Once I put this line in my CMake file, we don't need to worry what a CMake file is right now. But pasting this text to my path file, the game will now find the texture. Yo, we have dirt.
We have dirt. Yo, we can make it into grass. We have grass in rail lip. Man, this was so much work.
This was so much work. To remove the annoying fuzzy look at the distance, we need mip maps. Mip maps are the eight images the game generates that are lower resolution version of the same texture.
In my Unity Minecraft clone, when I used MIP maps, it solved the fuzzy look problem, but the fuzziness was replaced with this gray color. That is because at the distance it's using mapipm mapap 8 the lowest resolution version of the texture which is a solid color. To solve this we need to set a limit up to myipm mapap 4 because after that the color start to occupy multiple blocks. Even in Minecraft settings you have an option to set a limit up to four for the myip maps. In Java you can set the limit to myip maps with a single line one line.
The cool part about relip is that it's open source and I was able to find that exact line in the source files and set up the mip maps. Whereas in Unity, which is a game engine, there isn't an option for that. At least I haven't found one.
Finally, we have the terrain with no fuzziness in the distance. The Java clone may be quite ahead, but reimplementing existing features should not take too
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 viewsโข2026-05-28
How agent o11y differs from traditional o11y โ Phil Hetzel, Braintrust
aiDotEngineer
450 viewsโข2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation๐ฏโ
LearnwithSahera
1K viewsโข2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 viewsโข2026-05-29
Search Algorithms Explained in 60 Seconds! ๐ค๐จ
samarthtuliofficial
218 viewsโข2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 viewsโข2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 viewsโข2026-05-29
So What's Odin Lang Even Good For
TechOverTea
131 viewsโข2026-06-01











