Making a Voxel Engine from SCRATCH (w/ Destruction)

Поделиться
HTML-код
  • Опубликовано: 28 дек 2024

Комментарии • 102

  • @TerribleFire
    @TerribleFire 9 месяцев назад +9

    OpenGL expects you to depth sort so it doesnt have to waste time on it.

  • @vvgr409
    @vvgr409 8 месяцев назад +6

    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.

  • @ndreOnSteroids
    @ndreOnSteroids Год назад +45

    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!

    • @MaxMakesGames
      @MaxMakesGames  Год назад +4

      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 :)

    • @felixg2062
      @felixg2062 3 месяца назад

      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

  • @logosking2848
    @logosking2848 4 месяца назад +15

    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.

    • @layla.meowes
      @layla.meowes 3 месяца назад +3

      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.

    • @coltynstone-lamontagne
      @coltynstone-lamontagne 2 месяца назад +1

      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...

    • @tomtravis858
      @tomtravis858 Месяц назад +3

      @@layla.meowes Fun fact, everything that is rendered on your gpu is with triangles. It's a voxel based game lol

    • @layla.meowes
      @layla.meowes Месяц назад

      @@tomtravis858 first, wrong. second, minecraft has non-voxelly triangles.

    • @Tanicorn
      @Tanicorn Месяц назад +5

      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.

  • @darylg.4270
    @darylg.4270 9 месяцев назад +1

    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!

  • @SuperLowe1
    @SuperLowe1 Год назад +19

    Dude how are you not more popular, the impressiveness of this aside this was really entertaining, keep it up homie.

    • @MaxMakesGames
      @MaxMakesGames  Год назад

      Thanks a lot

    • @ZrionDev
      @ZrionDev 11 месяцев назад

      Bro this game is awesome keep working on It i love it@@MaxMakesGames

  • @SCPokSecondaccound
    @SCPokSecondaccound 9 месяцев назад +5

    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

    • @MaxMakesGames
      @MaxMakesGames  9 месяцев назад +2

      Yes you're right I actually did this recently. Checkout my lastest videos I have 2 about raytracing ;)

  • @jumbledfox2098
    @jumbledfox2098 10 месяцев назад +1

    That was epic! Loved the part when it looked like a drug trip hahaha

  • @SadTown99
    @SadTown99 7 месяцев назад +1

    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 😵‍💫

  • @PickIeJuice
    @PickIeJuice Год назад +10

    Does it have an ak

  • @isaaccauchi2358
    @isaaccauchi2358 Месяц назад

    Just gunna take a moment to appreciate the tog knife there, either a man of culture or a lucky coincidence

  • @solid_caliber6256
    @solid_caliber6256 11 месяцев назад

    your content is very impressive, enjoyed watching it ! :D

  • @tonypop1007
    @tonypop1007 Год назад +2

    this was extremely entertaining

  • @Surr3alD3sign
    @Surr3alD3sign Месяц назад

    "It cant be that hard" famous last words shared by indie devs all over the world 😂

  • @samnelson7428
    @samnelson7428 Год назад +1

    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

  • @naokizimmer4129
    @naokizimmer4129 Год назад

    C'est super stylé ce que tu fais continue comme ça

  • @echo_the_developer
    @echo_the_developer 4 месяца назад

    whats that tutorial you used to get started? also have you ever tried vulkan? and i would love to see a PyOpenGL video

    • @MaxMakesGames
      @MaxMakesGames  4 месяца назад

      @@echo_the_developer 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

    • @echo_the_developer
      @echo_the_developer 4 месяца назад

      @@MaxMakesGames allright thanks! ive seen learnopengl i just thought it looked a bit different than learnopengl

    • @MaxMakesGames
      @MaxMakesGames  4 месяца назад

      @@echo_the_developer I also used chat GPT to help me understand how some things worked and fix some issues I had. I 100% recommend using it :)

  • @williamjthebest
    @williamjthebest Год назад

    Nice job ! Vive notre rayonnement culturel X)

  • @timmygilbert4102
    @timmygilbert4102 6 месяцев назад

    Did you backfaces? 😩

  • @Skeffles
    @Skeffles Год назад +1

    Fantastic start on your voxel engine. Do you know what you're going to add to the engine? A certain game perhaps?

    • @MaxMakesGames
      @MaxMakesGames  Год назад +1

      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
      @Skeffles Год назад

      @@MaxMakesGames If the player can make their own monsters that could be pretty unique. I guess animation might be an issue though. 🤔

    • @MaxMakesGames
      @MaxMakesGames  Год назад +2

      @@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

    • @Skeffles
      @Skeffles Год назад

      @@MaxMakesGames fantastic idea! Best of luck making the engine.

    • @bisisnowhere
      @bisisnowhere Год назад +1

      @@MaxMakesGames bro is making minecraft 2

  • @knuxuki1013
    @knuxuki1013 Год назад

    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

    • @MaxMakesGames
      @MaxMakesGames  Год назад +1

      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 :)

    • @knuxuki1013
      @knuxuki1013 Год назад

      @@MaxMakesGames well, I am glad this tactic exists at least, I had a feeling something like this did lol

    • @maxbrundev
      @maxbrundev Год назад

      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

    • @MaxMakesGames
      @MaxMakesGames  Год назад +1

      @@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.

    • @maxbrundev
      @maxbrundev Год назад

      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

  • @pedroarthur2246
    @pedroarthur2246 Год назад +1

    It's amazing! Brazil is watching you ❤

  • @TriviaQuizocity
    @TriviaQuizocity 10 месяцев назад +1

    Im currently making a voxel engine in scratch😂... Im in hell

  • @datcanard4
    @datcanard4 Год назад +1

    Le mec est juste trop fort...
    Your accent is great though (and coding skills are epic)

  • @rafa_br34
    @rafa_br34 Месяц назад

    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.

  • @revanxanbabayev1621
    @revanxanbabayev1621 Год назад +3

    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

  • @manking89fps
    @manking89fps Год назад +2

    does it have a baguette

    • @MaxMakesGames
      @MaxMakesGames  Год назад

      Not yet, but that's definitely the first thing I'm adding once the engine base is done haha

  • @Vilebreken
    @Vilebreken Год назад

    You're a baguette! Trop bien je m'abonne!

  • @AllExistence
    @AllExistence Год назад +4

    "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!"

    • @MaxMakesGames
      @MaxMakesGames  Год назад +1

      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

    • @AllExistence
      @AllExistence Год назад

      @@MaxMakesGames Haha, totally not relatable...

  • @solid_caliber6256
    @solid_caliber6256 11 месяцев назад

    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?

    • @MaxMakesGames
      @MaxMakesGames  11 месяцев назад

      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
      @solid_caliber6256 11 месяцев назад

      @@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?

    • @MaxMakesGames
      @MaxMakesGames  11 месяцев назад

      @@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

    • @solid_caliber6256
      @solid_caliber6256 11 месяцев назад

      @@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?

    • @MaxMakesGames
      @MaxMakesGames  11 месяцев назад

      @@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.

  • @aa898246
    @aa898246 Год назад +2

    cool video

  • @yal1621
    @yal1621 9 месяцев назад +1

    yayy

  • @korigamik
    @korigamik 8 месяцев назад

    Cool stuff man, can you share the source code for this project?

    • @MaxMakesGames
      @MaxMakesGames  8 месяцев назад

      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 :/

  • @dumdum7099
    @dumdum7099 8 месяцев назад

    Isn't Minecraft also a voxel engine? Why did you say it wasn't?

    • @MaxMakesGames
      @MaxMakesGames  8 месяцев назад

      I didn't say it wasn't lol I said my project is different

    • @dumdum7099
      @dumdum7099 8 месяцев назад

      ​@@MaxMakesGamesOohhhh I see, my bad then.

  • @Amigo-oh2vv
    @Amigo-oh2vv Год назад

    The hard work u put in is insane
    Keep it up bro❤❤

  • @alikyssss
    @alikyssss Год назад +1

    Make an apocalypsegame. In voxel engine

    • @MaxMakesGames
      @MaxMakesGames  Год назад +1

      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

  • @semydev
    @semydev 7 месяцев назад +1

    WTF was that backface culling explanation 😂😂😂

  • @october6432
    @october6432 5 месяцев назад

    RIP backfaces

  • @moonshot3159
    @moonshot3159 Год назад

    ayo bro why is it not possible to do this in unreal engine like brooo whyyy

    • @MaxMakesGames
      @MaxMakesGames  Год назад

      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
      @moonshot3159 Год назад

      @@MaxMakesGames but bro they have nanite and stuff wont that make things quicker? (I'm not a programmer)

    • @MaxMakesGames
      @MaxMakesGames  Год назад

      @@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.

  • @_Braised
    @_Braised Год назад +2

    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

    • @MaxMakesGames
      @MaxMakesGames  Год назад +1

      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 :(

  • @i_like_pengwinz1065
    @i_like_pengwinz1065 Год назад

    Thank you for making my ass research fun

  • @rexoverwatch
    @rexoverwatch Год назад

    yes!111 black and white for the f/s

  • @TheGreatProphecy
    @TheGreatProphecy Год назад +1

    I wish you would have showed how to make this instead of super vague shots.

    • @MaxMakesGames
      @MaxMakesGames  Год назад

      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

  • @nadeekathusharidayananda4094
    @nadeekathusharidayananda4094 Год назад

    Wow that's really cool, but now I challenge you to make a fps game in opengl 👿👿👿

  • @albert_ac1045
    @albert_ac1045 7 месяцев назад

    i start to count from 0

  • @simongido565
    @simongido565 Год назад +2

    Every time I have to write it one kitten dies. THIS IS NOT A VOXEL ENGINE.

    • @CheeseIndex
      @CheeseIndex Год назад +1

      yeah the moment i saw the triangles i stopped the video and went to the comments.... now to look for another video

    • @Erkle64
      @Erkle64 Год назад +1

      It is a voxel engine. It's not a raymarched voxel engine, but it is a voxel engine.

    • @simongido565
      @simongido565 Год назад

      @@Erkle64 This is a polygon engine... Does not matter that you shape polygons like cubes.

    • @Erkle64
      @Erkle64 Год назад

      So you're saying there's no such thing as a voxel engine? @@simongido565

  • @michak7163
    @michak7163 Год назад

    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??

    • @MaxMakesGames
      @MaxMakesGames  Год назад +2

      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.

  • @patekfrfr
    @patekfrfr 5 месяцев назад +1

    erm actually this isnt from scratch 🤓👆

  • @BitBloxDevs
    @BitBloxDevs 7 месяцев назад

    Ouup

  • @rtsrt165
    @rtsrt165 Год назад

    WTF, i thought i was watching ultra popular programmer, but after i seen that there’s only 270~ views…