spicylobstergames / astratomic

Survival game inspired by Noita and Starbound, fueled by Rust and Bevy.
Other
91 stars 6 forks source link

Add particles #35

Closed Zac8668 closed 5 months ago

Zac8668 commented 6 months ago

Particles are really helpful, and game changer for visuals.

erlend-sh commented 6 months ago

Particles can mean different things in a falling-sand game, so are we talking about (1) regular, shader-based particles with no mass, or (2) actual atoms with inherent light sources?

I suppose there might be a mix of both. Related:

For atom-less particles, there seems to be two reasonably mature options if we wanna go with a pre-made solution:

bevy_hanabi is a likely candidate. Its WASM support is still in progress, but it could just be toggled off in the browser until it works well: https://github.com/djeedai/bevy_hanabi/issues/41

The alternative is 2D-only and already WASM-friendly, which does seem promising: https://github.com/abnormalbrain/bevy_particle_systems

Zac8668 commented 6 months ago

Particles are for sure ambiguous. What I'm implementing right now is a simple entity that is visually equal to the normal atoms, it updates itself and when it collides with a normal atom it puts itself back on the normal atom simulation.

From what I'm testing bevy is dealing with them pretty well without a GPU approach, but we would probably want to speed that up in the future if that's possible.

We are probably gonna use them for water splashing, and it will be a game changer for the player tool, with them we can animate them getting into the tool, and some better throwing, without them clumping into each other.

Edit: Wow bevy_hanabi is pretty amazing! We are gonna for sure use it in another occasions tho, like when we add explosions.