Skip to content

A basic falling sand game implementation for Godot in C#

License

Notifications You must be signed in to change notification settings

MathExpert/GodotSand

Repository files navigation

GodotSand

A basic falling sand game implementation for Godot in C#

This could be used as a template for anyone who wants to implement something similar in their own Godot game.

Current version is very simple, supports only sand, water and wall pixel types, and no special optimizations. I am not planning to develop this further, as this was just a tiny test project to understand how this type of games is implemented.

The implementation is using a single Sprite, for which a reference to its Image is stored. The painting is done using set_pixel method on the Image. I've tried using GDScript (Godot 3.2), but the performance was very poor for some reason, even in an extremely simple example. For this reason I am using C# here, which results in a much better performance. That being said, I don't have much experience with C#, so the code may have some obvious common C# practices/style violations.

Some obvious next steps in further development could be:

  • optimize the code by working with a ByteArray directly instead (I haven't tested if it boosts performance though)
  • add dirty boxing (see the Noita talk in the References)
  • use a 2D grid of Sprites, and process them in multiple threads, again, as in the Noita talk

References

About

A basic falling sand game implementation for Godot in C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages