
Because there should never be a space between grains of sand, each array indice would simply contain how tall the pile is in that column. Rather than tracking a grind of every particle on screen you could also just use an array the size of the screen horizontally. That way you only have a few hundred active instances at any given time.

For example, you could have instances fall down and once they 'touch' the ground, the grain is drawn to the screen and the instance reused for another falling grain. Almost all programming is some form of trickery, what the player sees and what the computer does are two completely different operations. Yeah, in these cases you can even check old DOS games that have a similar style of 'piling up' effects.
