Saturday, August 12, 2017

Snowfall Simulator (1997)

During the Christmas holiday break from 1997 to 1998, between IB high school and diploma, I was inspired by the weather to write a little snowfall simulator. 1500 particles fall against a pre-authored background, and they collide against it where the background isn't black.

One quirk of the algorithm is that when a particle spawns, if it spawns where the background is already covered, it will keep trying new spawn points until if finds a free pixel. Thus, as the screen fills up and the number of free locations at the top of the screen drops, the program slows down as it hunts longer and longer for particle spawn points. Hence, the snow also concentrates in the areas not already covered, and these areas fill up faster.


No comments:

Post a Comment