-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A couple (new) questions on how you accomplish the Box2D rigidbodies in the falling sand simulation. #4
Comments
This is still something I'm working on, as I only recently started working on this problem (my rigidbodies were just images and the individual pixels were not simulated until recently), and it's kind of been on hold until I release the initial code. What I have now is this: The main problem for me is that I would like there to be minimal "duplication", so just filling in the remaining gaps by copying nearby pixels would not be ideal for me. This is probably the first thing I'm going to work on after going open source, and I'll add an update to this issue once I make more progress.
|
Ah ok thanks for the explanation. Yeah I tried some method of having pixels belonging to rigidbodies occupy the holes adjacent to them, which mostly worked but was extremely resource intensive and wouldn't work as a long term solution. I'll watch this project to see if you are able to find a solution and will reach out here again if I am able to get one working. I may try to reach out to the Noita devs to see if they will divulge their proprietary secrets. Thank you for the resources regarding the algorithms! |
Nice work! Seems like a solid approach and that demo looks great. What language are you using to rewrite the simulation? |
Rust; one of the main problems with this version is that I didn't know how to write good c++ at the start so 95% of it uses raw pointers. Also the build system for this version just breaks over time on its own apparently and is a mega hassle to get working. These problems made it pretty hard to debug random crashes or memory leaks, and Rust solves both of these problems for me by having much safer memory management and a far better build system (compared to what I was doing) while still having roughly equal performance. (I also just really like Rust as a language) |
Hi, I am also trying to create something similar but I am not sure if I understand you correctly so please correct me if I am wrong. |
Amazing answer, thank you! |
Hello, I stumbled upon your repo here where I was surprised to find another David M attempting to accomplish something similar.
I do not have a background in GameDev and have been working on creating a falling sand simulation and integrating Box2D. (Inspired by Noita also). I am not attempting to create an entire engine as that is beyond my current abilities and so am using LIBGDX as a pretty bare bones engine to handle most of the update logic myself.
My Repo: https://github.com/DavidMcLaughlin208/FallingSandJava
DevLog Video around integrating Box2D: https://youtu.be/_xFluvZCSaM?t=74
I have a couple questions not covered by the Noita dev tech talk or your answer in another issue where you talk about Box2D.
Issue: #3
I am assuming you are using a 2D array at the core of your falling sand simulation. Lets say you have a box which is 3x3 and exists in the falling sand simulation. When the box rotates 45 degrees it will no longer easily fit into the 2D array. There will be 'holes' in the box where it does not easily fit into the 2D array. Here is an image of what I mean:
I can think of ways to be able to draw the object without the holes. But the falling sand simulation cannot account for these holes in the rectangle and you can see some sand has fallen into the box.
In my implementation I used a custom Moore Neighbor tracing algorithm for finding the perimeter of polygons (although this doesnt account for holes in polygons) and a custom Visvalingam line simplification algorithm but I am running into issues with it. Is there a library you are using or is there source material you referenced?
I see you are close to releasing your code on Github. I will be glad to read through it (although I don't know C++) and get some understanding from the code itself. But would be interested in hearing how you solved these problems yourself.
The text was updated successfully, but these errors were encountered: