
❚Godot❙Millions of Bullets❰Working Collisions❙GLES3❙GPU❱❚
The framework I'm making for any potential bullet hell games I may make in GLES3 shaders with Godot (C# is used for some things as well). I have successfully been able to get up to 2-4 million bullets with the right conditions at 60 FPS.
► SUBSCRIBE: http://bitly.com/2OtMG9b
► Godot Playlist: https://bit.ly/2RT910T
🌟-------------------------------------------------------------------------------------------🌟
► Twitch Channel: https://bit.ly/2OqIioK
► Clear List: https://bit.ly/37mDeuc
🌟-------------------------------------------------------------------------------------------🌟
🌟-------------------------------------------------------------------------------------------------------------------------------------------------🌟
Just something I want to mention, ignore the occasional stutters in the video, it's because I set the recording bitrate way too high in an attempt to make it look as good as possible, which backfired a bit.
Much has changed since my previous C# framework here: https://www.youtube.com/watch?v=GZB21J4d75Q
Compared to before, using the GPU, I can now get far, far more bullets. Performance wise the bullets will never be an issue as any real gameplay scenario will have nowhere near millions of bullets. I have also used shaders for more than just the bullets, the background is actually a fairly resource intensive shader at the moment, this was mostly just a test to showcase what is possible, so I would probably optimize the background shader. The magic circles are also shaders, and so is The Kid's cape animation (yes, I used The Kid from IWBTG).
Another benefit this time around, although not directly as a result of shaders, is that I've improved my code significantly, by using a lot more math. Most bullet parameters are a line or two of code now.
I've also added some new parameters, such as bullets spawning a certain distance from the origin point in a circle or ellipse, gravity, tangential acceleration, aimed attacks (as demonstrated by the pattern that slowly goes inwards towards the center from the sides), orbiting behaviour and rotation of the bullets around the origin point while keeping their distance and forward velocity.
Regarding collision, for CPU to GPU, I just send the player position as a uniform to the shader. For GPU to CPU, it's a bit more complicated.
Basically what I do is I make a 2x2 pixel texture on a custom viewport (making a texture out of the entire screen every frame is simply not good for performance). Read from that texture and use get pixel. That texture moves with the center of the player. It's the hitbox. I then read the color to see if a bullet passed over the player. That way I use almost no CPU or GPU power checking for collisions. I can easily define the hitbox size using different colors and if statements.
The art is all done by me this time (except the Kid), although a lot of it is done through shaders anyway. The music is public domain and I will put a link to it below.
🌟-------------------------------------------------------------------------------------------------------------------------------------------------🌟
🌟-------------------------------------------------------------------------------------------🌟
Assets used:
Music: https://opengameart.org/content/hyperflight-racing
Everything else is by me.
🌟-------------------------------------------------------------------------------------------🌟
#Ythundyth