Interaction of Shader and NPCs

Godot Version

4.3

Question

Hello, I want to make a game similar to Gnorp Apologue. Meaning: I want to have a shit ton of particles flying around and what not. To handle the amount, I decided to use computed shaders.

So imagine you have some thing that spews out particles that fall down to the floor: https://i.imgur.com/KwMv51n.mp4

Once they are at the floor some minion like NPC comes and picks them up. Imagine that we keep spawning more particles and they start piling up but the the NPCs come and pick up some and it shrinks.

Or as in Gnorp Apologue you might be able to click on it and then it jumps forward until you pushed it into the stash.

The point is: I generate some graphic with a computed shader and now want my NPCs or player to interact with it.

I have an array that holds all the position of these particles so I can code around that, make the npcs pick it up, make the user click on these coordinates and all those actions just change the “state” of the compute shader.

So my question is rather general: How would one implement that? Having performance as a top priority. Really just keeping track of everything in one big array (the buffer of the shader basically) and just map clicks etc on the positions or is there something else one can do?

I hope my question is clear. :slight_smile:

Thanks in advance!