3 ms·
I've been working on a voxel game engine called Bonsai for ~10 years. Probably the most interesting thing about it at the moment is the editor. The world, and
by jesse__ 13d ago
I've been working on a voxel game engine called Bonsai for ~10 years.
Probably the most interesting thing about it at the moment is the editor. The world, and most things in it, are represented as collections of SDFs. More accurately, they're density fields, but, potato-tomato.
Bonsai has undergone a large rewrite over the last couple years that's nearing completion. A world edit is defined as a bunch of SDF parameters which get projected/rasterized into the voxel grid by a shader on the GPU. One neat thing about SDFs is they've been thoroughly researched and documented by a guy named Inigo Quilez, and they have a lot of nice mathematical properties. For example, you can do a smooth union of arbitrary SDFs to get nice rounded contours where shapes join.
I've written every system from scratch, all the way from the memory allocators and font rasterizer to the collision detector and simulation loop. I even wrote a metaprogramming language as a replacement for C++ templates, which is a whole other story. IIRC the only external dependency is the C runtime library for starting the process and my very occasional use of variadic functions arguments.
For a long time, an explicit non-goal of the project was to ship a game. It sounded insane to me to write an entire 3D engine and then ship a game. As it turns out, I've gotten it to the point where I can actually make a game. I've got a start on the game systems in a closed-source repo, and hope to have a steam page for it by the end of the year.
I'll do some shameless self-promotion and leave some links here for anyone interested in looking at the engine, language code, or some pretty pictures.
https://github.com/scallyw4g/bonsai https://github.com/scallyw4g/bonsai
https://github.com/scallyw4g/poof https://github.com/scallyw4g/poof
- shoobiedoo 13d agoWow, unbelievably cool. Good luck with the new game using the engine
- Boss0565 13d agothis looks amazing
- erwincoumans 13d agoVery cool. Are you familiar with the game Voxile? Its author also created custome languages, and the game uses Lobster.
- jesse__ 12d agoI'm tangentially familiar .. I played the demo a couple times over the last few years when they did major releases. It's impressive to say the least.
- joystick_0x0 13d agoJust amazing.
- freakynit 13d agoHoly moly!!!! Bonsai is freaking crazy!! That scale and view-distance..wow!! Brilliant work..
- derpyzza 13d agoomg you're the poof guy!! i really like trying to shove metaprogramming systems into C and poof is one of the best i've ever encountered!! it's so damn good! good luck with the game btw, is there anywhere i can follow development?
- jesse__ 12d agoWow, high praise! Thanks :D I'm slightly biased, but I tend to agree with you; it's actually the best metaprogramming language I've ever used. JAI is probably better, but I haven't sat down and done a real project with it yet. As far as following development on the game .. I'll probably start doing marketing when I've got enough for a trailer. I'll announce updates on Discord and Youtube, if you'd like to follow along there https://discord.com/invite/kmRpgXBh75 https://discord.com/invite/kmRpgXBh75 https://www.youtube.com/@scallyw4g https://www.youtube.com/@scallyw4g
- iugtmkbdfil834 12d agoI.. want to join to chorus of praise here. Nice work man!
- montenegrohugo 12d agopretty damn cool. SDFs are the best. I've been playing around with an idea around this on the weekends. Such a cool primitive!
- jesse__ 12d agoWow, thanks for all the kind words folks! I really appreciate it <3
- epiccoleman 12d agoDefinitely interested in where you take things with the actual game - the engine looks really cool. It seems like we're in the midst of a bit of a cambrian explosion around "survival games descended from Minecraft" (Hytale is top of mind, but there's also Vintage Story and iirc there's a few others of note either in early access or development). Not that a voxel engine can only do a Minecraft-like - but there's definitely a market for someone who wants to take that formula and run with it.
- jesse__ 12d agoYeah, it seems enough people have done enough work on voxel engines now that we're actually starting to see games proliferate. I'm stoked about it! I'm a lot less interested in minecraft-style survival games than I am in exploring .. other .. types of games that push the medium further. Most voxel games that make it to release basically boil down to 'hack-n-slash RPG with a lego world'. As you mentioned, it's obviously a successful recipe, but I feel like it's barely scratching the surface in terms of how far the underlying tech has come. I've got a game in-flight where the primary mechanic is modifying the environment to achieve a goal. Teardown is really the only other game that's made it to market and done this. The mechanics are going to be intentionally simplistic .. it's more of an existence proof that a deeper game could exist and people are interested in it.
- saidnooneever 9d agominecraft offers a good interface. i am experimenting with blocklandscapes as control plane for other applications (currently photo editing). Its fun :D (not as useful as i hoped lol)
- chamomeal 12d agoThe draw distance thing is insane. I would love to see some ridiculously scary-huge landscapes!!
- UltraSane 12d agoThis guy is creating what looks to me to be a very impressive 3D version of Noita using a custom microvoxel engine https://www.youtube.com/watch?v=Y8HRCXxI0BY https://www.youtube.com/watch?v=Y8HRCXxI0BY
- jesse__ 12d agoOh yeah, I've seen that guys engine before. It's super impressive.
- nonethewiser 12d agoLooks cool. What would you say its defining features are? What makes it different than Minecraft? Seems like its probably more performant. Whats the license situation. I see your own license which sounds maximally permissive but written by you. Is that just how it works? I can do whatever I want with that license? It doesnt need to be a “real” license? Maybe your bonsai logo should come from your voxel engine instead of pixel art? Idk why but my first thought was somehow that i misunderstood “voxel engine” when i saw the pixel art.
- jesse__ 12d agoHey, thanks for the kind words! I'd say the defining feature is the editor and terrain generation system. At the moment it's not well documented, but once the big rewrite I've been working on has settled I plan to take some time to make tutorial materials. As far as the license goes, I chose WTFPL originally because I figured it would dissuade 'real' companies (with legal teams) from using it. I've since thought about changing the license to something permissive that might play nice with legal teams, like MIT. You can do whatever the fuck you want; it says so right in the license ;) I'd actually love it if people used it. My intent now is to keep the engine open source, and build games with it in closed-source repos. You're right, I should change the logo. It's on the todo list .. it's just a really long list ;)
- DANmode 8d ago> It doesnt need to be a “real” license? Tell me you were born after 2000 without telling me. A younger relative asked me how a flight simulator showing a view of common flights posted here “was even legal”, and I’ve been on watch for similar mentality ever since lol
- PatronBernard 12d agoWhat's an SDF?
- 0x20cowboy 12d agoSigned distance function (or signed distance field depending). Simplified: rendering via maths equations instead of triangles.
- jesse__ 12d agoI actually convert the SDFs to voxels and render triangles, but.. some people have written direct SDF renderers. There's a guy that posted to YouTube not too long ago that wrote a really cool one with physics and everything
- cookiengineer 12d agoOh my gosh, it's so freakin pwetty! Kudos, this looks like the shaders took a long while to get right. Love the art style, keep it going!
- 21asdffdsa12 12d agoSDFs are the future at least when it comes to level design - especially because they have that "subtract" railgun cone of death functionality baked in. A boss fight feels different, if where the hammer comes down there is a crater afterwards.
- bob1029 11d agoThe future of level design is now. https://en.wikipedia.org/wiki/Constructive_solid_geometry https://en.wikipedia.org/wiki/Constructive_solid_geometry If you are trying to rapidly iterate a level layout, nothing comes close to the power of a hierarchy of CSG brushes. You can change one parameter and have the work of an army of artists executed in milliseconds.
- 21asdffdsa12 11d agoThese are SDFs? - The problem is though to do level of detail with these functions. Like you have to add interpolation rates to the various subfunctions - and distancevalues to them.
- hanzihang 11d agobonsai, its pronunciation is quite interesting in southeast China.