A flock of 10000 agents simulated in real-time with #GodotEngine! ๐Ÿคฉ Again using a compute shader, this time with the classic Boid algorithm!

They do tend to clump up a bit though ๐Ÿ˜…

#gamedev #indiedev

Well, Twitter's compression algorithm didn't like that ๐Ÿ˜…
Here are 500 agents. Now they have space to swim back and forth a bit more ๐Ÿค—
#GodotEngine #indiedev
@SanderVanhove That looks nice. Boids? What drives the color? They need a wrapping world so they can swim off the left side of the screen and onto the right.
@WereCoder thanks ๐Ÿ˜ yep it's indeed a boid simulation. I thought about that, but didn't want to bother with distance calculations in a wrapping world ๐Ÿ˜… it way easier to just make them "fear" the walls.
@WereCoder the color is dependent on the speed they are going.
@SanderVanhove This is mesmerizing? Did you follow a tutorial for this that I can check out

@realkotob not for this specifically no ๐Ÿ˜…
I just used the docs to use compute shaders: https://docs.godotengine.org/en/latest/tutorials/shaders/compute_shaders.html

And then implemented the boid algorithm from there: https://vanhunteradams.com/Pico/Animal_Movement/Boids-algorithm.html

Lastly gave the agents some color and glow depending on the speed at which they are traveling ๐Ÿ˜Š

It took a good evening of hacking and trail and error ๐Ÿ˜…

Using compute shaders

Think of compute shaders as blocks of code that are executed on the GPU for any purpose we want. Compute shaders are independent from the graphics pipeline and do not have much fixed-functionality....

Godot Engine documentation
@SanderVanhove Absolutely amazing Sander๐ŸŽ‰๐Ÿ‘๐Ÿป great work! This could definitely work as an animated wallpaper or main-menu background๐Ÿ˜
@flamelizard @SanderVanhove I feel like this wallpaper would drain your battery so fast.
@flamelizard thanks Patrick! ๐Ÿค— it would also be cool to have this as the main mechanic for a game ๐Ÿค” but indeed, this is gonna drain your battery as you need a decent GPU to render this amount of agents ๐Ÿ˜…
@SanderVanhove Gaming PC wallpaper then๐Ÿ˜๐Ÿ‘€
@SanderVanhove nice! is the source available anywhere? Iโ€™m new to compute shaders and Iโ€™d love to see the code.

@cowboyscott Yep, it's over here! Though it's pretty hacky and I'm not planning on cleaning it up ๐Ÿ˜…

https://github.com/SanderVanhove/godot-compute-shaders/tree/main/Boids

godot-compute-shaders/Boids at main ยท SanderVanhove/godot-compute-shaders

Contribute to SanderVanhove/godot-compute-shaders development by creating an account on GitHub.

GitHub
@SanderVanhove Clumping? Needs more separation force!
Sander Vanhove (@[email protected])

Attached: 1 image Here are 500 agents. Now they have space to swim back and forth a bit more ๐Ÿค— #GodotEngine #indiedev

Gamedev Mastodon