An experiment in improving the quality of 2D collision detection using spatial partining and a 3-Dimensional array. This example features 1500 unique objects at once to be checked. This is acheived by only checking molecules against other objects in each cell. Check out the source at streetmackerel.github.io/Molecules to modify the values.
Although this method is much more efficient than brute force checking each object against all others each frame, it is still quite imperfect as objects colliding while being centered in different cells do not register. The next step in this process will be to implement a quad tree system which will check neighbouring cells for collisions as well.