I'm building a mod that makes it more realistic. is it possible to find all particle IDs stored in a location x, y? so I know I can get only one with pmap [x] [y] or photon [x] [y] (if it is energy), but it is possible that it has more than one particle in the same position in the game, since several parts[i] can have the same location x, y. example: I find all particle IDs belonging to the NEUT element in the x, y coordinate. (sorry bad english)
You could maybe add a next pointer (would be a particle ID, not an actual pointer) to particles and then the pmap update loop would just append all particles in the same position to a linked list whose first item would be the first particle there. This would increase the particle structure size from the usual 56 bytes to 64, but hey, it would be pretty easy to implement, backwards compatible, would not require tricky data structures, and the pmap update loop would still be O(n).
the method of the next id pointer at x, y coordinates worked very well! except that I did not define a new property for particles, because it is not necessary since it needs updating every tick (I used currentTick to check if x, y was updated or not), it was simply to create another pmap2[yres] [xres] [3] (currentTick (if it was updated or not), first particle and last of the x,y), and idpoint [npart] [2] (with currentTick first and id of next particle). (sorry bad english)