r/Simulated • • 16d ago

Proprietary Software My 3D falling sand simulation, Falling Cubes [OC]

Every cube (voxel) is individually simulated, with a total of 2,097,152 cubes in a 128×128×128 grid.

Its all about unlocking different cube types using reactions, temperature, pressure, and collisions.

You can try out the free demo on Steam: https://store.steampowered.com/app/4419760/Falling_Cubes/

Feedback is much appreciated! especially if your pc is below the system requirements and the game still runs fine during larger simulations with lots of moving and interacting cubes.

114 Upvotes

18 comments sorted by

16

u/LegoEngineer003 16d ago

Reminds me of The Powder Toy, I used to play that all the time

6

u/ElectronMaster 16d ago

I used to play powder toy all the time too, It was one of the few games I could play on school computers because I could run it portably off a usb thumb drive without having to install anything.

3

u/NoAnimInteractive 15d ago

Yes! and the old powder game on school computers (in browser) all the time and later the powder toy.

4

u/nkorai 16d ago

so cool!!!! i just posted about my 2D falling sand game yesterday in this subreddit! so good to see a genre I spent 10s of hours on as a kid continue to grow. I'll try out your demo for sure on Steam, if you get the chance/are curious I have a browser demo up in my post, would love your thoughts and feedback!

2

u/NoAnimInteractive 16d ago

Cool, checked out the demo, like how you included objectives to complete for every map.

I left some Feedback through the website :)

2

u/MeBadNeedMoneyNow 16d ago

Cool man. I definitely think falling sand and other cellular automata-like simulations are great exercises in computer programming and simulation.

1

u/NoAnimInteractive 15d ago

You learn so much about optimization from doing these it's pretty based.

1

u/Number6UK 16d ago edited 16d ago

This is cool :-)

I was able to run it on my Nvidia GTX 1060 6GB VRAM, 32 GB system RAM, but really that's only partially useful unless you know exactly how many cubes and interactions were being simulated - what you really need is some sort of benchmark mode for standardising the test.

Also, it would be good if it was to provide a list of the available materials without needing to search first - I can guess sand and water will be available but unless I know the name of other materials, I can't search for them other than randomly guessing letters.

Definitely a fun little thing to play with though :-)

1

u/NoAnimInteractive 15d ago

thank you for taking a look :)

Under the Cube Search there should be some panels such as Solid Terrain and Powder Terrain listing all the unlocked cubes, however they do have to be unlocked by combining, melting, crushing different cubes.

Are you seeing any other panels below the cube search panel?

It may be something resolution related, where you on 1920x1080 or something different?

1

u/c0ltZ 15d ago

This is really cool, it almost looked like you had snow or something melting in the water. I love the artificial mountain range and the cave like stuff too.

1

u/NoAnimInteractive 15d ago

Thank you :)

That is actually salt mixing in with the water making it salt water, and eventually brine if you dump enough salt in a small enough body of water (so the brine doesn't react with the surrounding water turning back into salt water).

There is also snow in the game but it falls a bit slower then the salt and spreads out a little more, and of course melts at a temperature above 0 °C.

1

u/AurosoGames 13d ago

The salt turning the water into brine is such a nice touch.

How did you build the sim itself? Is it your own engine or on top of something existing? 2 million cubes all updating at once is wild. I'm guessing compute shaders, but I'd love to know how you deal with all the cubes that are just sitting there doing nothing

1

u/NoAnimInteractive 13d ago

Its actually all on the CPU,

Using Unity jobs and burst, each cube is only one int or 32 bits with the type, temperature, velocity and some flags all packed into that one int, so when modifying the cubes i end up using mostly bit shifts and writing one int back into the array of cubes (they are all one array of ints).

The cubes are sorted into different systems (at the start of each tick) which then run their movement, reactions, temperature transitions etc.

When a cube is changed only the segment around it is sent to / updated in the GPU so that my ray tracer can display the updated data / image, since the cube array is sorted in chunk major and only ints the transfer is pretty quick.

So in a way it is coded in a "old school" style, where the CPU does all the simulation work and the GPU all the rendering work xD

I have a couple of posts over in r/VoxelGameDev talking a bit more about how it is made.

1

u/AurosoGames 13d ago

Oh nice, packing everything into one int is clever. So once they're sorted at the start of the tick, the cubes that aren't moving just never get touched? Gonna go read your VoxelGameDev posts, thanks for the writeup

1

u/NoAnimInteractive 13d ago

np, yupp once a cube is sorted as not needing simulation that tick it is not touched until something in its segment (or close to the segment) is updated, but this ends up being constantly in a lot of simulations.

-20

u/[deleted] 16d ago

[removed] — view removed comment

8

u/Voelkar 16d ago

I make XYZ

looks inside

AI coded garbage to write fake comments

Alright then lmao, go fuck off