Three demo projects that display how it work, everything with source.
1. Minimal example on fragment-shader
logic of collision in bufC, shadertoy link
2. Port of this logic to GPU-instanced-particles
live web demo, source https://github.com/danilw/godot-utils-and-other draw 100k particles with collision max (this is bad unoprimized example, only as mminimal copy of logic to GPU-particles)
3. More complex rules for collision by object type
Objects(particles) has more unique data per object - each object has own timer, own HP, damage and action on collision wiht other objects
200k active objects in real time.
This game-demo very optimized, it draw only that number of particles that visible on curent Screen, and max 12k GPU-particles(base on zoom), when full map of collision is 1280x720 framebuffer (that means almost million of active particles total).
web(live) version https://danilw.itch.io/flat-maze-web
source code https://github.com/danilw/flat-maze
Small description:
What is it - collisioon of thousands unique particles, where each particle has own index.
Logic use framebuffer texture, and each pixel of framebuffer can be active particle, so that means for example 640x360 framebuffer(in demo 2 this size used) has 230400 active particles (max), in game-demo used 1280x720 fbo, that 900k+ active particles (maze has only 200k other is free space)
And using this index its possible to control each particle data, this allow to each particle have own unique type, timer or HP or DMG or Mass or any other data that you want
Also collision detection work for each particle, each particle know with what object it collide in real time, and can execute action base on it
in game demo this logic used for Fireball, it collide only once and change state of object that it collide, action is - set tree on fire, or kill zombi(zombi become ghost), or kill ghost (two types on ghosts, one of it is immune to dmg)
Godot used only to draw instanced-particles, full logic (and full game logic) are on GPU, nan of Godot API or features are used
this logic will work anywhere that has GLES3 suport (include mobile)