Codebase OVERHAUL, new EVENT SYSTEM, LODs, and MORE [Voxel Devlog #9]

Sdílet
Vložit
  • čas přidán 25. 12. 2022
  • Online demo: github.com/DouglasDwyer/octo-...
    Geese event system: github.com/DouglasDwyer/geese
    This video details the voxel engine rewrite that I undertook over the past month. After overhauling my event system, I restructured the totality of my Rust codebase in order to achieve better modularity, extensibility, and performance. Along the way, I made myriad improvements to the codebase. Now that the rewrite is about done, I cannot wait to start adding new features again!
    Music used in the video:
    Peyruis - Relax
    David Cutter - Over There
    E's Jammy Jams - Jolly Old St. Nicholas (Instrumental)
  • Hry

Komentáře • 61

  • @LegoDinoMan
    @LegoDinoMan Před rokem +4

    Each time I see this engine it blows my mind. The amount of effort and hours you've dedicated to this project is incredibly impressive.

  • @ttj_
    @ttj_ Před rokem +16

    loving this style. your engine is coming along so well. i’d love to see a video where you further delve into rasterization with greedy meshing and seeing the performance impacts of it!

  • @sa-hq8jk
    @sa-hq8jk Před rokem +3

    i like the informal conversational style better. it comes off as more natural. also insane how much work you’ve done in only a month. keep up the good work!

  • @sjoerdev
    @sjoerdev Před rokem +3

    This is your best devlog so far imo

  • @wrldfrice
    @wrldfrice Před rokem

    nice to see the progress, well done!

  • @haiperbus
    @haiperbus Před rokem +1

    new Douglas update, ya love to see it

  • @GiacomoPerin
    @GiacomoPerin Před rokem +2

    light theme vscode, you are truly an amazing programmer

    • @w花b
      @w花b Před rokem

      Not using c++ too, truly based indeed.

    • @egedq
      @egedq Před rokem

      @@w花b writing cutting edge game like this in Rust is truly based, very inspiring...

  • @thomasmcbride2287
    @thomasmcbride2287 Před rokem

    Love the style. Very entertaining 10/10 would recommend :D

  • @user-pm2ru6ir6n
    @user-pm2ru6ir6n Před rokem

    Great job! The event system is a very correct decision. I also wanted to do it once, but I was too lazy) You are great!

  • @krish-ut9de
    @krish-ut9de Před rokem

    you are a hidden gem

  • @user-yi9tq7xg2w
    @user-yi9tq7xg2w Před rokem

    Great job!

  • @undefdev2239
    @undefdev2239 Před rokem +5

    So nice to see progress on this! Have you thought about making physics somewhat like Noita's Falling Everything physics engine?

    • @DouglasDwyer
      @DouglasDwyer  Před rokem +7

      I'm not particularly familiar with Noita, but I would love to have a physics simulation that allows any voxel object to interact with gravity (so that trees don't float like in Minecraft). I would probably accomplish this via some sort of 3D connected component detection whenever a user edits a chunk.

  • @lukepowers8122
    @lukepowers8122 Před rokem +4

    This is a really cool project, and I love all of the optimizations. I'm also making a voxel engine, and its an incredibly difficult journey. Its pretty funny how many people are trying to make voxel engines right now, yours seems the most developed and promising though.

  • @Vextrove
    @Vextrove Před rokem +1

    Awesome video

  • @HickoryDickory86
    @HickoryDickory86 Před rokem +2

    Got a question for you: Have you ever heard of Tom Mulgrew here on CZcams? About a decade ago he was putting up videos of his voxel/polygon hybrid engine. From the camera out to certain distance, the engine would show rasterized polygons. Beyond that distance, it would switch to voxels. It was tuned so well that you could not see a difference between the two. It was great! I have no idea what he's done with it now; but I do know he was using CUDA, because the voxels were stored in a sparse voxel octree.
    Anyway, I was just wondering if you might be interested in doing something similar, but using your parallax raymarching technique, etc.
    And if you can't tell by what I'm sure are inaccuracies with my descriptions, I know very little when it comes to rendering and software development. I just love watching these kinds of videos out of pure interest. But even with what little I know, I can tell you are extraordinarily talented and doing great things here. Please keep it up.

    • @DouglasDwyer
      @DouglasDwyer  Před rokem +1

      I hadn't heard of Tom Mulgrew before, but I had a look at his work and it's very interesting. Thanks for sharing! Indeed, I might continue trying to integrate some ray marching approaches into my work. For now, though, I want to keep things simple and start implementing more effects like lighting and multiple objects. Greedy meshing seems like the simplest way to pursue this, while still being performant (and allowing a wide range of devices to run the game with varying LOD settings).

  • @valet_noir
    @valet_noir Před rokem

    amazing !!!

  • @jonyleo500
    @jonyleo500 Před rokem +1

    I would love to see (or do it myself if the code is open source) a proper comparison between greedy meshing and parallax raymarching.

  • @dombbis
    @dombbis Před rokem

    very good!

  • @Conlexio
    @Conlexio Před rokem +1

    awesome :]

  • @Vextrove
    @Vextrove Před rokem +8

    I recommend making a game where the player character isn't two blocks tall, but much larger

    • @DouglasDwyer
      @DouglasDwyer  Před rokem +1

      That's the goal! :)

    • @Vextrove
      @Vextrove Před rokem

      @@DouglasDwyer It would be quite interesting to me to see what it'd feel like

    • @Vextrove
      @Vextrove Před rokem

      ​@@rayzorpaid4 Not really, it depends on how big objects in the world such as trees and hills are

  • @sgmvideos5175
    @sgmvideos5175 Před rokem +2

    discovered you few minutes ago, great job, I wonder how much this project was inspidered by john lin's engine (it's sad it died, it was looking so awesome)

  • @Sammy-ws9re
    @Sammy-ws9re Před rokem

    This looks awesome! I wish I understood what you were talking about. Especially with the parallax raymarching. Do you plan on making a discord server or something of the like?

  • @krish-ut9de
    @krish-ut9de Před rokem

    so coollll

  • @TinkerHat
    @TinkerHat Před rokem

    okay this is exactly what i need, when will the engine be public for use?

  • @darkandblue4118
    @darkandblue4118 Před rokem +1

    Would be interesting to have the sky with voxels too. But it needs to be drawn at a fixed voxel size in an infinite distance.

    • @valovanonym
      @valovanonym Před rokem +1

      So how one would achieve that? It would mean rendering an infinite amount of voxels?

    • @darkandblue4118
      @darkandblue4118 Před rokem +1

      @@valovanonym not an infinite amount. I just mean that the sky should be rendered at a fixed distance while the voxels should keep the same size.

    • @DouglasDwyer
      @DouglasDwyer  Před rokem

      I would definitely like to have a more detailed sky (with a sun, stars at night, etc.) in a voxel style rather than one solid color. I'm assuming that this is what you mean? My plan at current is to just render a pixelated skybox that fits with the rest of the scene's visuals. Let me know if you have any other ideas on this!

    • @LiamNajor
      @LiamNajor Před rokem

      I have done some experiments in a THREE.js voxel engine, and making any kind of mesh follow a camera is a lot more challenging then you'd expect

  • @krish-ut9de
    @krish-ut9de Před rokem

    i really want to see efficient water physics

  • @lemonke8132
    @lemonke8132 Před rokem +1

    Impressive as always! How are you able to write such complicated code (like network/event systems or rust game engines) from scratch? I feel like I have to follow a tutorial or else I have no idea what I'm doing.

    • @sechmascm
      @sechmascm Před rokem

      I don't do Rust, but in any programming language you want to start figuring out stuff without tutorials. You can do this in many ways. First step would be to take a tutorial and modify it in small ways while looking for the answer online. Could be the documentation, forums, etc. You want to get a simple idea and research how to do it. If you regularly poke around the docs and stuff you'll find methods or functions that will make you go: "hey, I could do that other cool thing using this. Let me try it out." Most functions in the docs tell you exactly what they do, and what they take as inputs, so it's easier than looking at tutorials, which may skip explanations or use cases for many functions. Another way, is to start really simple like with pong or generic platformer #12138496198411287. You'll quickly fall down the rabbit hole of making your jump feel nice. Different gravity for falling so it feels like the character has weight, coyote timer, allowing to jump a few ms after jumping if falling, and extras like double-wall-other jumping, sliding, climbing, then attacks, then enemies, then levels, collectibles, goals, difficulty, etc, etc.

    • @DouglasDwyer
      @DouglasDwyer  Před rokem +3

      This is an excellent question, which I think can be answered from a few different perspectives. The other commenter, S, is spot-on correct when it comes to building one's programming experience. The best way is to learn by doing! Start with some goal or project in mind - like building a platformer - and then follow tutorials that each contribute a piece to that puzzle, like a tutorial for how to make a jumping player, or a UI, until you have a working game.
      Another perspective on which I'd like to comment is how to produce and maintain an ever-growing codebase. Complicated code is not easy to write, even for me - this video, where I change everything, is perfect evidence for that. Another key skill, which is gained through experience, is learning to modularize one's code (keeping the graphics and networking systems separate, for example). If you keep your code modular, it's easier to debug and add new things. This is another thing I worry about when writing complex software from scratch.
      All in all, I think it does come down to experience and learning by doing. But everyone starts from the tutorial stage at one point or another! So my recommendation is to choose a reasonable goal of what project you want to build, and then attempt to use whatever resources possible - tutorials, docs, and the like - until you've accomplished it. As you build upon and *extend* others' work, you'll become more comfortable creating unique content.

    • @boredastronaut78
      @boredastronaut78 Před rokem +1

      Writing complex software is difficult. Like anything difficult, you learn through a mixture of study and practise. However, there are a manageable number of simple concepts underlying all software. Once you have an intuitive understanding of those concepts, it becomes easier to understand entire programs, no matter how large and complex. This is why you study theoretical computer science, which concerns itself with the fundamental concepts that define the fundamental nature of programs and computation.
      The majority of the concepts involve structures or behaviours. Programming itself involves translating these ideas into source code for specific tasks. One of those concepts is hierarchy, and a common example is the use of functional decomposition, which appears everywhere in software. Douglas demonstrated it in his rewriting of his event system to use hierarchical dependencies.
      Tutorials often teach specifics of the craft-mostly about programming languages and APIs-and maybe even some applied theory. But they rarely touch on the fundamental concepts. But these are essential to evolve from beginner/experienced to advanced developer. You need them in order to successfully build very large complex programs, the kind that have many different subsystems, that do different tasks that must be integrated together. A game engine that handles graphics, audio, UI, input, networking, physics, game logic, file management, re-uses fundamental software design principles throughout its subsystems, enabling the system designer to manage the complexity.

  • @Conlexio
    @Conlexio Před rokem

    does pure rasterization see more benefit to the LOD system than your parallax ray marching? i’m assuming with raw ray marching LOD won’t impact performance too much so i’m wondering if raw rasterization becomes less comparable when LOD is disabled

    • @DouglasDwyer
      @DouglasDwyer  Před rokem

      That's a great question - I haven't actually done a side-by-side profile of raster versus parallax marching with LODs enabled for both. However, I was having some performance issues with parallax marching even at low draw distances, so I'm inclined to believe that it would be the same performance at best. I would like to investigate this at some point, because I invested a lot into the parallax marching approach.
      I will say, one thing I like about pure rasterization is that it's easier to maintain (the code is simpler and there are less hiccups when it comes to things like maintaining a Z-buffer).

    • @DouglasDwyer
      @DouglasDwyer  Před rokem

      The nice thing about my engine design now is that it's easy to swap out various rendering techniques if I ever want to do so!

  • @CSPciccionsstibilepippons
    @CSPciccionsstibilepippons Před 9 měsíci +1

    how is it possible to update 256^3 chunks in real time using greedy meshing!? 😯👍

    • @DouglasDwyer
      @DouglasDwyer  Před 9 měsíci

      Chunk updates are accomplished in realtime using three key optimizations:
      - Voxel data is represented in an octree, which allows for efficiently identifying surface voxels and converting them to faces.
      - The greedy mesh output is cached after chunk generation is complete, and parts of it are re-used when a chunk is edited.
      - Multithreading is employed so that when multiple chunks are modified their meshes are recomputed simultaneously.

  • @memyselfishness
    @memyselfishness Před rokem +2

    I really did enjoy this style to the old ones, but maybe that's because you had less to show off?

    • @DouglasDwyer
      @DouglasDwyer  Před rokem

      Glad to hear it. This new style was easier to produce as well, so I think that I might continue with it in the future. Thanks for the feedback!

  • @infernoplayzgames1684

    Where did you start with when you began writing this engine? I want to make one myself but don't know where to start.

    • @DouglasDwyer
      @DouglasDwyer  Před rokem

      Much work on the engine has involved integrating different concepts, including 3D graphics, networking, octree algorithms, and more. I think that it's important to learn about each one of these in turn, so I'd recommend picking one area with which you're unfamiliar and working on THAT part of the project. If you're looking to work on 3D graphics in particular, I highly recommend learnopengl - it's a great tutorial series for all levels of programmers. There are similar resources out there for other parts of game engines. The most important thing is that you learn by doing!
      See also the following reply on another comment for this video. The commenter does a great job of describing how to build up knowledge by following tutorials, and then attempting to implement new/unique features on top of them:
      czcams.com/video/YQ83XfZQHHA/video.html&lc=Ugx8bR15w00QkXtopB14AaABAg.9k86iH6brPV9k8EorfJPB0

    • @infernoplayzgames1684
      @infernoplayzgames1684 Před rokem

      @@DouglasDwyer Sweet thanks!

    • @infernoplayzgames1684
      @infernoplayzgames1684 Před rokem

      @@DouglasDwyer Do you have any good resources I can use to learn opengl?

    • @DouglasDwyer
      @DouglasDwyer  Před rokem

      As I mention in my other comment, I think that learnopengl.com/ is probably the best resource out there :)

  • @Borgilian
    @Borgilian Před rokem

    You don't need to reload your entire OpenGL context just to enable or disable vsync... you don't even need to reload your renderer for this. All you have to do is call "wglSwapIntervalEXT" with your desired swap interval... as many times as you want.

    • @DouglasDwyer
      @DouglasDwyer  Před rokem +3

      Indeed, on desktop, it is possible to change the swap interval dynamically. However, I am also targeting the web. In WebGL, the only way to hint that the browser should use VSync is to pass the desynchronized context attribute during WebGL context creation; you cannot change it afterward. Perhaps a better example, which is true for both web and native, would be antialiasing - as far as I know, you cannot change whether multisample is enabled on the default framebuffer once the window is created. Having a reloadable graphics system has other benefits as well, like allowing the user to switch their active GPU at runtime. Nonetheless, the information that you provide is good to know - anyone developing a desktop game need not worry about changing vertical sync. Thanks for your comment!

    • @Borgilian
      @Borgilian Před rokem

      @@DouglasDwyer Oh wow.. I was ignorant of WebGL's state and its relation to the browser. Didn't know it was this bad on the web side.

  • @Dongxkld
    @Dongxkld Před rokem

    Voxel coin??

  • @benrex777productions9

    I'm in favor of any video style which is easier to make for you and is still pleasant to the eye. Making videos should not be a drag.

  • @BanditBloodwyn
    @BanditBloodwyn Před rokem

    Two things I wouldn't have done:
    1. Creating more system dependencies always is a bad thing to do. Refactor one system and you might have to change every system which is dependend on the first one.
    2. Do not use inline comments in your code. They will be ignored most of the time, sooner or later. You should try to use code based naming instead. For example by extracting code blocks out into separate methods and/or classes (which have good descriptive names) and by using descriptive variable names.

    • @DouglasDwyer
      @DouglasDwyer  Před rokem +6

      Thanks for your feedback! I think you raise two good points; excessive dependencies are not great and inline comments may be ignored. Let me try to clarify for you how these relate to my project:
      1. Of course functionality should be modular and self-contained. But I would argue that, in my case, this is exactly what a dependency system does. When functionality is separated into a DAG of dependent modules, if you refactor one (as long as no changes are made to the public-facing API) you don't have to refactor the others. It's like using a Java interface; the implementation details change but consumers of the interface don't.
      2. Those are Rustdoc comments, so they're treated specially. They are converted to HTML documentation pages and also show up in the IDE when you hover over items. It's the standard way of documenting Rust code :)

    • @BanditBloodwyn
      @BanditBloodwyn Před rokem

      @@DouglasDwyer Ah I see. Yes, in my way of thinking, "refactoring" often means changes in the public interface. As long as this doesn't change, you have no problems.
      And yes, I don't know anything about Rust, so if your inline comments contribute to the HTML docs, they have a right to exist.👌