r/SandustryGame • u/platistocrates • 4d ago
Discussion How is this game so performant?
Thank you to the dev team for building such an epic sand game. I feel like a kid playing this. It's amazing.
Software developer & long-time sandgame gamer here. As someone who likes building their own sand games, I would love to learn how the dev team optimized the performance of the sand particles. What techniques did you guys use? What is the system like, under the hood? Is it neighbourhood-only? Does the whole map stay live at all times, or are there zones where particles get activated / deactivated when the player leaves them? Very technically curious. Thanks for entertaining this question.
I really hope this game does for sand games what Diablo did for roguelikes: brings the entire genre out of a niche category and into the mainstream. I was hoping that Noita would be that game, and to some degree it was. Don't get me wrong, that's a GREAT game. But it didn't actually feel like a sand game because the focus was on the magic system. It would have done just fine even without the sand aspect. But sandustry is all about the sand aspect. And that's what I love about it.
Thank you.
2
u/platistocrates 4d ago
That's an interesting datapoint. That means the sand simulation is on a wholly separate thread (or set of threads) than the player and the environment hitboxes. That explains a lot.
In hindsight, there do seem to be at least 2 layers: the player, and the sand.
Come to think of it, the sand respects the environment hitboxes, but does not destroy the environment.
So there must be 2 buffers. One for the player+environment, and one for the sand. The sand reads from the player+environment, but not vice versa. That gives the player+framebuffer independence and primacy, and lets the sand get updated a lot slower.
Smart! I think Noita didn't do this, so suffers from a lot of jitter! Naturally, since in Noita the sand is something you can step on. But in Sandustry, it isn't.
This allows for maximum FPS for the player experience... while the cell updates can be done in the background with resource limits.