About your comment on depth (4:44) - OpenGL is not drawing things "in random order" without depth testing. It is drawing in in exactly same order you draw it. And why would you want to draw things without depth testing? Because there are situations when you don't want to depend on depth buffer and sort your geometry manually. One example is transparent surfaces (in case of Minecraft like game blocks like water or glass). Sure in most situations you want to have depth buffering enabled but OpenGL is not game engine and it doesn't provide any default settings. It provides features you need to enable if you want to use them. That includes depth buffering.
That's some accomplishment... damn! I myself tried to make a voxel terrain demo in Vulkan/C++ a year ago. Let me say this: I did not have the mental stamina to withstand these constant setbacks for the most trivial seeming features. You pointed that out: It's actually quite hard to make anything work this close to the metal. So I definitely can appriciate what you've done there. Also the dry oak tree pun made me laugh, so I decided to comment. Nice work, man!
Thanks a lot for the comment ! I'm glad you enjoyed :) Yea it was hard but I did it as a side project over a month or so. That gave me time to breathe. Doing it all in one go would have made me go crazy I think haha I worked a bit on procedural generation after making this vid and it was ( and still is ) making me go crazy... Loading and unloading all that stuff without lagging or having any memory leak... oof Give it a shot again one day if you feel like it, it's a very nice project imo :)
Haha i know it’s hard. I currently am struggling to understand level of details and smoothing over multiple chunks 😅 But I also started using a really basic implementation of it in unreal. That were only three classes one for the world one for the voxel itself and one for a basic chunk. But got marching cubes working. Applied a smooth filter and everything got holes. Even when looking for the corners and borders maybe I need to overwork the pipeline for that. And then I need to make another system something like chunk workers or so dirty chunks and voxels and much more. But basically it’s just a 3 dimensional array so it’s gonna be easy I thought
This may sound like a bad idea but trust me it's not. Try using raytracing for the render engine since it can get faster than rasterizasion if you want bigger renderdistance or smaller voxels, it would also make upgrading the graphics easier by just using more rays per pixel
That is really amazing! Thank you for the hard work and for the video, I hope you are proud!! I am blown away. Today i discovered what "voxel" is I guess. I am impressed!
Minecraft is a voxel game. Cube size isn't a requirement for a voxel game. Some renderers try to push voxelization to the extreme, but you could have even bigger cubes than minecraft and still have a voxel game.
Minecraft is a voxel game. No mans sky is also a voxel game. Just because they use polygonal rendering doesn't mean they are not voxel games. They still store world data as voxels. Difference between those games and the ones commonly found on youtube is the rendering method. Those games use polygonal rendering methods to polygonalise the voxels, and then they use some acceleration algorithm like marching cubes, greedy meshing and the such to optimise the polygonal way of rendering. Whereas non-polygonal rendering generally ray traces the voxels and as such have to use different rendering acceleration structures. A lot of non-polygonal rendering methods end up using sparse voxel octrees the acceleration structure as a start because it's the most accessible. If they don't raytrace sometimes they raymarch and use (god forbid) sdf's. There's a lot of ways to do it, but they are all voxel games. Just need to make a distinction on rendering method, world data, data structures, and the such. Hope that clears up some confusion as it's a minefield to navigate.
The dirt/grass could just be, "if air above, then grass, if not, then dirt." This is just for generation, I don't know if Minecraft generates dirt in caves, I assume you could create special code for any specific instances you have where you generate dirt under air but with a block higher above it, if that even ever happens in your game
Thats dope, youre a really good developer especially when you realise that all great games loke minecraft started from sh*tty games but yours, your are far better, keep it up man never give up
Thanks ! Yes I'm hoping to make a game once the engine is good enough. Since I'm focusing quite a bit on the world and destruction right now, I'm thinking a simple game where you move around and destroy things at first ( the ground, trees, rocks, etc ) and also maybe use different powers to do so. I also always loved monster collection games like Pokemon so I thought maybe something like that with the monsters made of voxels too but I'd need to work on it for a while for that haha. Let me know if you have ideas :)
@@Skeffles Maybe you could collect voxels while playing and use them to "craft" monster presets with a few customization pieces so it's custom but not fully to allow animations, spells, etc to make sense... Anyway before my engine can handle that I have a long time to think about it haha
I'm no programmer (which makes this funnier to me) but I had this idea where things that can't be seen aren't rendered or acknowledged by the system, I come n watch this to discover back face culling and me and my smooth brain is actually surprised wasn't even being original at ALL lol
Yeah there's back face culling which makes it so back faces are not rendered and also frustum culling which makes objects ( or in this case chunks ) that are outside of the camera's view not be rendered. Culling improves performance a lot :)
Hey I do not understand how some faces of your cube are not rendered with only glCullFace(GL_BACK); in order to not render some faces that are hide you have to re construct the mesh and disable some faces no ? @@MaxMakesGames
@@maxbrundev Yes you have to construct the mesh with only the necessary faces ( squares ) but without culling those faces will be rendered on both sides so under the map too, but with culling they are only rendered on one side ( the clockwise triangles I think ) so you get 1 sided squares which is the better than 2 sided.
Ohhh you are not using cube but 6 squares and you place your squares like a cube that's right? I am currently using a cube that's why I was having trouble, I cannot use different meshes with instancing and all my face are Counter clockwise already @@MaxMakesGames
@@vortexstudios_echo I started using a website called learnopengl it's good ! Also I did try Vulkan in my opinion it's really good but a bit harder to learn
"Should i fix my very faulty memory problem before adding complexity to the project so it won't come to bite me in the ass as few things already did?" "Nah, it'll be fine!"
lmaooo yes that's exactly what I did and you will see in the next part that it DID end up screwing me over and I struggled to fix it... You predicted it haha
I just want to know if it's possible to make a proper sequel to Ace of Spades. Y'know- that awesome WW1 voxel shooter- ruclips.net/video/a2VMz3r8U4E/видео.html
That looks pretty fun haha Well yes it's definitely possible to make an FPS using an engine like this, but the multiplayer would be difficult to do. There's also a lot of things I'm missing to make games like a UI system. I still have a lot of work to do before my engine is capable of doing all that... In short: it's possible, but not right now :(
Thanks ! Maybe one day but not yet because it's still very messy and bad. I would have to maintain everything clean and working and have versions and everything that's a lot of work :/
i am trying to make something similar but i cannot find a solution on the voxel culling, i tried some stuff but it resulted in even bigger lagging, how did you achieve it?
You mean culling things outside the camera ? I didn't do it at all for a while and at one point I didn't render whole chunks outside the camera view. Trying to cull too much based on the camera view often results in lag as you said so I think it might be better to avoid culling voxels. Instead, you should focus on only adding the necessary faces like I spoke about in this vid. If a voxel only has air above it, you only need to draw a square, not the whole cube. That's not dependant on the camera so it's a 1 time calculation and is much more worth it. And a square is 1/6 the amount of verts of a whole cube so huge improvement. Also like I did you should only render the surface. Voxels under the surface should not be rendered at all. You can do that in the world generation :)
@@solid_caliber6256 I save air positions on world gen. I place air above the voxel and on the side if the terrain on the side is lower than that voxel. Then I use that air to add faces and destroy and when I destroy I update it
@@MaxMakesGames so you save some air positions when making a cube and then every frame you go through all the air positions and check if they're above,next,etc... to the block?
@@solid_caliber6256 No when I create my world, let's say I place the voxel at 50,20,50 (x,y,z). I know nothing is above it, so above is air. Then I check all 4 sides around. If the y is lower ( like 51,19,50 ) then I know that in that direction there is air. If it's equal or higher ( like 51,21,50 ), no air. At the moment of this video I didn't actually save air, I just had 6 bools for each cube that saved if each direction had air. Then when rendering I can loop all 6 bools and if they are true ( that direction has air ) I render that side. This way any side facing an other voxel or under the map will be false and not rendered and you only need to set the bools when you create it, not every frame.
Thanks for the suggestion, I actually have something like that in mind. I mean, if I make an engine with a fully destroyable world, I sure am gonna make a game where you can destroy everything haha
I'm trying to make videos for everyone to enjoy so I don't want to get too technical but maybe one day I'll make an other video going more into details
I think it is possible, but not optimal. Unreal engine was not made for voxel games so you would have to code all the optimizations and features yourself so it would still be as difficult and you would probably end up with a more laggy game because of the engine. There's no point taking an engine, not using its features and doing something completely different in it haha at that point just make your own engine :P
@@moonshot3159 Nanite is used to reduce the rendered triangle count of meshes. So it takes a mesh with millions of triangles and reduces it based on distance and stuff. But cubes only have 12 triangles. There's nothing to reduce here. The problem is the amount of them. In unreal, you'd probably have to create an "Actor" for each cube and that would create lag because unreal will do some logic for each one of them ( such as checking the distance to them, if they have tick enabled, etc ) that my engine won't do. Basically, by making my own engine I can remove all the things that UE does that I don't want & that would slow things down and since it is pretty different from normal games, that means pretty much everything.
OpenGL expects you to depth sort so it doesnt have to waste time on it.
About your comment on depth (4:44) - OpenGL is not drawing things "in random order" without depth testing. It is drawing in in exactly same order you draw it. And why would you want to draw things without depth testing? Because there are situations when you don't want to depend on depth buffer and sort your geometry manually. One example is transparent surfaces (in case of Minecraft like game blocks like water or glass). Sure in most situations you want to have depth buffering enabled but OpenGL is not game engine and it doesn't provide any default settings. It provides features you need to enable if you want to use them. That includes depth buffering.
That's some accomplishment... damn! I myself tried to make a voxel terrain demo in Vulkan/C++ a year ago. Let me say this: I did not have the mental stamina to withstand these constant setbacks for the most trivial seeming features. You pointed that out: It's actually quite hard to make anything work this close to the metal. So I definitely can appriciate what you've done there. Also the dry oak tree pun made me laugh, so I decided to comment. Nice work, man!
Thanks a lot for the comment ! I'm glad you enjoyed :)
Yea it was hard but I did it as a side project over a month or so. That gave me time to breathe. Doing it all in one go would have made me go crazy I think haha
I worked a bit on procedural generation after making this vid and it was ( and still is ) making me go crazy... Loading and unloading all that stuff without lagging or having any memory leak... oof
Give it a shot again one day if you feel like it, it's a very nice project imo :)
Haha i know it’s hard. I currently am struggling to understand level of details and smoothing over multiple chunks 😅 But I also started using a really basic implementation of it in unreal. That were only three classes one for the world one for the voxel itself and one for a basic chunk. But got marching cubes working. Applied a smooth filter and everything got holes. Even when looking for the corners and borders maybe I need to overwork the pipeline for that. And then I need to make another system something like chunk workers or so dirty chunks and voxels and much more. But basically it’s just a 3 dimensional array so it’s gonna be easy I thought
Dude how are you not more popular, the impressiveness of this aside this was really entertaining, keep it up homie.
Thanks a lot
Bro this game is awesome keep working on It i love it@@MaxMakesGames
This may sound like a bad idea but trust me it's not.
Try using raytracing for the render engine since it can get faster than rasterizasion if you want bigger renderdistance or smaller voxels, it would also make upgrading the graphics easier by just using more rays per pixel
Yes you're right I actually did this recently. Checkout my lastest videos I have 2 about raytracing ;)
Geeeeez I had no idea this stuff was so complex… Now when I look at a game like “Shadows Of Doubt” it completely blows my mind 😵💫
Just gunna take a moment to appreciate the tog knife there, either a man of culture or a lucky coincidence
That is really amazing! Thank you for the hard work and for the video, I hope you are proud!! I am blown away. Today i discovered what "voxel" is I guess. I am impressed!
Minecraft is a voxel game. Cube size isn't a requirement for a voxel game. Some renderers try to push voxelization to the extreme, but you could have even bigger cubes than minecraft and still have a voxel game.
Nope. Minecraft is rendered via triangles + it has a a LOT of non-voxel models, so you can't simply deem it an implementation detail.
Minecraft is not a voxel based game. It has normal meshes just like your standard game. They're just pixilated and mostly cube/rectangle shaped...
@@layla.meowes Fun fact, everything that is rendered on your gpu is with triangles. It's a voxel based game lol
@@tomtravis858 first, wrong. second, minecraft has non-voxelly triangles.
Minecraft is a voxel game. No mans sky is also a voxel game. Just because they use polygonal rendering doesn't mean they are not voxel games. They still store world data as voxels. Difference between those games and the ones commonly found on youtube is the rendering method.
Those games use polygonal rendering methods to polygonalise the voxels, and then they use some acceleration algorithm like marching cubes, greedy meshing and the such to optimise the polygonal way of rendering.
Whereas non-polygonal rendering generally ray traces the voxels and as such have to use different rendering acceleration structures. A lot of non-polygonal rendering methods end up using sparse voxel octrees the acceleration structure as a start because it's the most accessible. If they don't raytrace sometimes they raymarch and use (god forbid) sdf's. There's a lot of ways to do it, but they are all voxel games.
Just need to make a distinction on rendering method, world data, data structures, and the such.
Hope that clears up some confusion as it's a minefield to navigate.
That was epic! Loved the part when it looked like a drug trip hahaha
"It cant be that hard" famous last words shared by indie devs all over the world 😂
this was extremely entertaining
Im currently making a voxel engine in scratch😂... Im in hell
Does it have an ak
No it does not, BUT it could... 😏
your content is very impressive, enjoyed watching it ! :D
The dirt/grass could just be, "if air above, then grass, if not, then dirt." This is just for generation, I don't know if Minecraft generates dirt in caves, I assume you could create special code for any specific instances you have where you generate dirt under air but with a block higher above it, if that even ever happens in your game
C'est super stylé ce que tu fais continue comme ça
Thats dope, youre a really good developer especially when you realise that all great games loke minecraft started from sh*tty games but yours, your are far better, keep it up man never give up
It's amazing! Brazil is watching you ❤
Nice job ! Vive notre rayonnement culturel X)
Fantastic start on your voxel engine. Do you know what you're going to add to the engine? A certain game perhaps?
Thanks ! Yes I'm hoping to make a game once the engine is good enough. Since I'm focusing quite a bit on the world and destruction right now, I'm thinking a simple game where you move around and destroy things at first ( the ground, trees, rocks, etc ) and also maybe use different powers to do so. I also always loved monster collection games like Pokemon so I thought maybe something like that with the monsters made of voxels too but I'd need to work on it for a while for that haha. Let me know if you have ideas :)
@@MaxMakesGames If the player can make their own monsters that could be pretty unique. I guess animation might be an issue though. 🤔
@@Skeffles Maybe you could collect voxels while playing and use them to "craft" monster presets with a few customization pieces so it's custom but not fully to allow animations, spells, etc to make sense... Anyway before my engine can handle that I have a long time to think about it haha
@@MaxMakesGames fantastic idea! Best of luck making the engine.
@@MaxMakesGames bro is making minecraft 2
Le mec est juste trop fort...
Your accent is great though (and coding skills are epic)
I think there's something missing in your shaders, those cubes look a bit too wide kinda as if you were not using normalized device coordinates.
The hard work u put in is insane
Keep it up bro❤❤
I'm no programmer (which makes this funnier to me) but I had this idea where things that can't be seen aren't rendered or acknowledged by the system, I come n watch this to discover back face culling and me and my smooth brain is actually surprised wasn't even being original at ALL lol
Yeah there's back face culling which makes it so back faces are not rendered and also frustum culling which makes objects ( or in this case chunks ) that are outside of the camera's view not be rendered. Culling improves performance a lot :)
@@MaxMakesGames well, I am glad this tactic exists at least, I had a feeling something like this did lol
Hey I do not understand how some faces of your cube are not rendered with only glCullFace(GL_BACK); in order to not render some faces that are hide you have to re construct the mesh and disable some faces no ? @@MaxMakesGames
@@maxbrundev Yes you have to construct the mesh with only the necessary faces ( squares ) but without culling those faces will be rendered on both sides so under the map too, but with culling they are only rendered on one side ( the clockwise triangles I think ) so you get 1 sided squares which is the better than 2 sided.
Ohhh you are not using cube but 6 squares and you place your squares like a cube that's right? I am currently using a cube that's why I was having trouble, I cannot use different meshes with instancing and all my face are Counter clockwise already @@MaxMakesGames
whats that tutorial you used to get started? also have you ever tried vulkan? and i would love to see a PyOpenGL video
@@vortexstudios_echo I started using a website called learnopengl it's good ! Also I did try Vulkan in my opinion it's really good but a bit harder to learn
@@MaxMakesGames allright thanks! ive seen learnopengl i just thought it looked a bit different than learnopengl
@@vortexstudios_echo I also used chat GPT to help me understand how some things worked and fix some issues I had. I 100% recommend using it :)
You're a baguette! Trop bien je m'abonne!
WTF was that backface culling explanation 😂😂😂
cool video
"Should i fix my very faulty memory problem before adding complexity to the project so it won't come to bite me in the ass as few things already did?"
"Nah, it'll be fine!"
lmaooo yes that's exactly what I did and you will see in the next part that it DID end up screwing me over and I struggled to fix it... You predicted it haha
@@MaxMakesGames Haha, totally not relatable...
does it have a baguette
Not yet, but that's definitely the first thing I'm adding once the engine base is done haha
yayy
Did you backfaces? 😩
I just want to know if it's possible to make a proper sequel to Ace of Spades. Y'know- that awesome WW1 voxel shooter- ruclips.net/video/a2VMz3r8U4E/видео.html
That looks pretty fun haha
Well yes it's definitely possible to make an FPS using an engine like this, but the multiplayer would be difficult to do.
There's also a lot of things I'm missing to make games like a UI system. I still have a lot of work to do before my engine is capable of doing all that...
In short: it's possible, but not right now :(
Thank you for making my ass research fun
Cool stuff man, can you share the source code for this project?
Thanks ! Maybe one day but not yet because it's still very messy and bad. I would have to maintain everything clean and working and have versions and everything that's a lot of work :/
RIP backfaces
i am trying to make something similar but i cannot find a solution on the voxel culling, i tried some stuff but it resulted in even bigger lagging, how did you achieve it?
You mean culling things outside the camera ? I didn't do it at all for a while and at one point I didn't render whole chunks outside the camera view. Trying to cull too much based on the camera view often results in lag as you said so I think it might be better to avoid culling voxels. Instead, you should focus on only adding the necessary faces like I spoke about in this vid. If a voxel only has air above it, you only need to draw a square, not the whole cube. That's not dependant on the camera so it's a 1 time calculation and is much more worth it. And a square is 1/6 the amount of verts of a whole cube so huge improvement. Also like I did you should only render the surface. Voxels under the surface should not be rendered at all. You can do that in the world generation :)
@@MaxMakesGames thank you for the reply but im not sure how do i check if there's air on that side, do i make an array of air positions?
@@solid_caliber6256 I save air positions on world gen. I place air above the voxel and on the side if the terrain on the side is lower than that voxel. Then I use that air to add faces and destroy and when I destroy I update it
@@MaxMakesGames so you save some air positions when making a cube and then every frame you go through all the air positions and check if they're above,next,etc... to the block?
@@solid_caliber6256 No when I create my world, let's say I place the voxel at 50,20,50 (x,y,z). I know nothing is above it, so above is air. Then I check all 4 sides around. If the y is lower ( like 51,19,50 ) then I know that in that direction there is air. If it's equal or higher ( like 51,21,50 ), no air. At the moment of this video I didn't actually save air, I just had 6 bools for each cube that saved if each direction had air. Then when rendering I can loop all 6 bools and if they are true ( that direction has air ) I render that side. This way any side facing an other voxel or under the map will be false and not rendered and you only need to set the bools when you create it, not every frame.
Make an apocalypsegame. In voxel engine
Thanks for the suggestion, I actually have something like that in mind. I mean, if I make an engine with a fully destroyable world, I sure am gonna make a game where you can destroy everything haha
Isn't Minecraft also a voxel engine? Why did you say it wasn't?
I didn't say it wasn't lol I said my project is different
@@MaxMakesGamesOohhhh I see, my bad then.
Every time I have to write it one kitten dies. THIS IS NOT A VOXEL ENGINE.
yeah the moment i saw the triangles i stopped the video and went to the comments.... now to look for another video
It is a voxel engine. It's not a raymarched voxel engine, but it is a voxel engine.
@@Erkle64 This is a polygon engine... Does not matter that you shape polygons like cubes.
So you're saying there's no such thing as a voxel engine? @@simongido565
Wow that's really cool, but now I challenge you to make a fps game in opengl 👿👿👿
Easier than with Vulkan.
I wish you would have showed how to make this instead of super vague shots.
I'm trying to make videos for everyone to enjoy so I don't want to get too technical but maybe one day I'll make an other video going more into details
erm actually this isnt from scratch 🤓👆
yes!111 black and white for the f/s
i start to count from 0
ayo bro why is it not possible to do this in unreal engine like brooo whyyy
I think it is possible, but not optimal. Unreal engine was not made for voxel games so you would have to code all the optimizations and features yourself so it would still be as difficult and you would probably end up with a more laggy game because of the engine. There's no point taking an engine, not using its features and doing something completely different in it haha at that point just make your own engine :P
@@MaxMakesGames but bro they have nanite and stuff wont that make things quicker? (I'm not a programmer)
@@moonshot3159 Nanite is used to reduce the rendered triangle count of meshes. So it takes a mesh with millions of triangles and reduces it based on distance and stuff. But cubes only have 12 triangles. There's nothing to reduce here. The problem is the amount of them. In unreal, you'd probably have to create an "Actor" for each cube and that would create lag because unreal will do some logic for each one of them ( such as checking the distance to them, if they have tick enabled, etc ) that my engine won't do. Basically, by making my own engine I can remove all the things that UE does that I don't want & that would slow things down and since it is pretty different from normal games, that means pretty much everything.
There is literally a bunch of tutorials on how to make a voxel game in Unity and Unreal... Why do you say it is impossible??
I never said that ? I made my own for fun and for the challenge. It is also more optimized to make your own from scratch. That's what I said.
Ouup
WTF, i thought i was watching ultra popular programmer, but after i seen that there’s only 270~ views…