Community Challenge: Explosions! 💥

Suggestion for next community challenge: do something with compute shader :slight_smile:

4 Likes

Ok. I made something… interestingly @selimanac I was going to use compute shaders for this, since I think its more suited (I didnt, went the easy slow way :slight_smile: ). Anyway, video and source provided.


9 Likes

What a big bada boom :slight_smile: I’d love to compare the performance differences between this and a compute shader one.
I have no idea how to use compute shaders at all, but I’m planning to start learning the basics. This is why I suggested this subject. Also, this might encourage people to test the technical preview stuff.

4 Likes

Id expect a compute one to be substantially better. This has 20,000 go’s in it :slight_smile: … it would work even better with 20,000 meshes instead (ie, I was lazy :slight_smile: ). With compute (looking at it now) it looks like I could offload all the particle processing, and I think I could potentially use it for live mesh generation. Not sure. Will update if I get something going. Thanks for suggesting btw.

3 Likes

I’m planning to do an example or a tutorial on how to use compute for something like this, but maybe someone else gets there first :slight_smile:

6 Likes

Still, it is surprising to see how well Defold is crafted. it literally iterates over 20k items in a loop. Yes, the result is not suitable for production, but it’s good to know the limits.

4 Likes

If you can find some spare time, please do. Even a simple math example would be a good starting point for me.

3 Likes

I think I have a compute shader running. Need to get the texture into a render output now. Have a look in the above repo (defold-explosion) and look for assets/compute and the additions in main/default.render_script. Will hopefully render the particles with it tomorrow.

4 Likes

About time to announce the results! And a next challenge I hope! :sweat_smile:

1 Like

Yes, sorry about the delay. Vacation and some other things have come in the way of this. You can expect the results to be announced this week!

3 Likes

Thank you to everyone who participated in the challenge. I hope everyone enjoyed it and learned something new along the way! There were several great contributions but in the end we decided to award the following three contributions a Steam Gift Card:

Shooting Circles

by @Insality

Very nice looking explosions, and a very impressive game too!

Play: Shooting Circles 0.0.1
Source: https://github.com/Insality/shooting_circles
Post mortem: Shooting Circles - Defold ECS game example

Missile Commander

by @benjames171

Nice chunky retro style explosions w. debris. Baked into a nice little Missile Commander game to really show off the explosions.

Source: https://github.com/benjames-171/explosion-demo
Demo: https://6689244e4250ed862e5872f6--chipper-speculoos-2f9e45.netlify.app/

Explosions

by @NaakkaDev

Excellent remake of the original explosions. The demo also contains two other explosion styles.

Demo: community-challenges 1.0
Source: https://github.com/Temeez/defold-community-challenges


@Insality, @benjames171 and @NaakkaDev please ping me in a PM to arrange for transfer of your gift cards.

15 Likes

Yay, amazing! Thanks for the challenge and to every participant who joined in :tada:

6 Likes

Yes, it was very interesting to see what everyone came up with!

4 Likes

Wow. I just played shooting Circles and that thing feels great. Nice Job.

3 Likes

@jhonny.goransson - I updated and got a compute shader working and passed the output into a fullscreen render. Something does not feel right about it though. Will have a look later, thought you might be interested:

https://github.com/dlannan/defold-explosion

The texture is a data texture showing the pos and vel in that texture.

5 Likes

Nice! What doesn’t feel right? :thinking:

Perf. Seems off. This is 256x256 (maximum compute cores I can run I think) and so its only 65K particles. And quite a small texture (in real terms). I think it should be possible to do much more than this. Going to look at multi-dispatches and see if that helps. Not now, but prob in a few weeks time.

Maybe I can take a look at the performance and see if I can find anything. I’ll let you know

The low performance isn’t because of the compute shader, it’s because of this loop happening in your “particle” shader:

That shader takes up something like 99.9% of the performance when I profile it in xcode :slight_smile:

2 Likes

Yeah. I realized that would be an issue. Count = frag x image pixels.
However I have done many more than this in the past :slight_smile:
It is more of an arch issue I think. The compute prob should write particle ‘patches’ out to a number of textures with multiple dispatches (thats what I was referring to above). Then the patches are written directly rather than via the fullscreen shader.
Current version also could do with getting more ops in the compute shader too - ie each compute maybe handles the updates of a number of particles, and not just one :slight_smile:
Anyway… will look at later. Thanks for the response.

1 Like