I asked a similar question on physics.stackexchange, being ignorant about this website.
I am basically looking for an efficient way to implement gravitational fields.
I have a huge 2D space, with thousands of objects in it. I then need to simulate how these objects are effected by each other's gravity.
I thought it'd be possible to sort the objects into collections, and check every object outside that collection against that collection, and not every individual object inside of it. I soon came to the realization that this simply wasn't possible. The gravitational field of multiple objects cannot represented as one uniform field, calculated with only one mass and distance.
Every object inside the simulation can be considered a sphere. I am fine with approximations, as long as it looks reasonably realistic.