octo-release
octo-release copied to clipboard
My Thoughts
Just saw your video about the physics, great stuff! As soon as I saw the video title I thought of that Teardown talk so I was so glad when you not only mentioned it but based your implementation on it. I had a chance to play around with the demo and just wanted to put my thoughts down for you. Please don't take any of them as criticism as I think you are doing amazing work.
When I saw you video it seemed that voxels became un-editable when part of a rigid body and when I tried the demo I confirmed that. This is something that I see in a lot of voxel games/implementations and it's an understandable compromise. But personally I would love to have editable moving voxels. I don't know how Teardown does theirs and it's probably way more complicated than what I have in mind. But the ability to continue to break down larger objects like trees is very satisfying. Also this could enable support for boats and airships in the future. These are obviously long term goals but I know that they become more difficult to add alter if they aren't taken into consideration early on. There are some Minecraft mods that attempt to add these but they have to be complex and often introduce bugs. They also become a nightmare to maintain. I think Vintage Story just moved to a system where dynamic voxel grids are possible. They call it mini dimensions. Vintage Story also has a good portion of their source code under a code-readable license. I'm only able to find the API for their mini dimension and not the underlying code but the game is written in C# so you could read it using dnspy. Having disconnected voxels become separate interactable voxel grids instead of just rigid bodies would be huge improvement in my opinion.
When I tried your demo I was glad to see the behavior of targeting voxels was switched from fixed distance to what is probably a raycast and that was awesome. It feels way better to use now. The first thing I did though was to try and a large rigid body by removing all voxels that connect to a large roof and saw that it failed to make a rigid body. I wasn't surprised this is a common limitation. I know that the algorithms to detect disconnected voxels can be unwieldy at larger sizes. I expected either that the game would freeze until calculation was complete or not work at all. Again as a long term goal it would be great to have larger rigid bodies. I think I saw a Youtube comment about internal forces in rigid bodies which would be great with larger objects as well. But again long term goals.
After stress testing the physics engine I noticed it would slow down but was completely disconnected from frame rate and I just have to say that was amazing. Well done. I absolutely did not expect for my frame timing to stay the same and objects just start to slow down. Some objects would slow down and then speed up which makes me think that instead of fixed rate physics happening say 60 times a second you are using the delta time to handle changing intervals in the physics steps which I think is the right choice.
My first test bogged the physics down pretty bad and it never seemed to get better. At first I thought that objects weren't being put to sleep. But after placing a large number of objects on flat ground thought that maybe they were. Not sure whether you have a sleep system in your physics engine to remove computation of rigid bodies that have come to a complete rest and no longer need to be simulated but if not it will be an important part of your physics system.
I don't know if it's the iterative solver you are using but I noticed that a pile of objects never seemed to come to rest under any circumstances and it just got more unstable over time. I don't know if this is caused because the iterative solver has to keep iterating until it finds a stable position and doesn't or if gravity is being applied even to sleeping objects which causes them to wake and intersect with objects beneath them.
The book you mentioned while great is fairly old. I would consider looking at some newer physics implementations to see what kind of improvements have been made in the field in the last ~14 years. I don't know for sure though. Jolt Physics would probably be a great resource for you. Perhaps there are some solver optimizations for voxels that you could take advantage of.
Again these are just my opinions about what I would like to see long term. The engine is amazing so far. You've made incredible progress and gotten farther than a lot of commercial projects in making everyone's dream voxel engine. I hope you keep up the amazing work. I'm rooting for you!