Friday, 6 March 2015

Model of the Universe

Full disclosure; the data structure for this is wholly inspired by the source code of Orteil's nested. It is really cool and well worth checking out: Nested

Preamble, program at bottom of page

"Space is big. You just won't believe how vastly, hugely, mind- bogglingly big it is. I mean, you may think it's a long way down the road to the chemist's, but that's just peanuts to space."
Douglas Adams, The Hitchhiker's Guide to the Galaxy.

The tremendous scope and size of the Universe has always struck me as fascinating. Billions and billions of stars and galaxies on a mind bending scale of lightyears. It is so vast compared the the pale blue dot our lives occur in. There is a kind of existential joy in trying to appreciate the size of, well, everything. What wonders could be contained in such a vast space?

The numbers involved are larger than those encountered in human day-to-day experience and are very difficult to visualize. Ten I am reasonably sure I can mentally picture, one hundred I could approximate, anything past a thousand just becomes this unpicturable "lots". It is quite concerning hearing billions and trillions being discussed in media when they are orders of magnitude bigger than what my mind can imagine.

The best way to come to terms with large numbers is, like many other complex tasks, to break it down into manageable numbers. Ten is easier to handle so why not deal with the scale of the universe in powers of ten?  There is a classic video which does indeed explore the scale of the universe by using powers of ten: Powers of Ten (1977) where increasing sizes of 10^n m meters are traveled through.

This video and other Scale of the universe interactive programs were my inspiration for this project. My desire to better appreciate the size of the universe by traveling from our single world to the entire observable universe. Making a mock model of the Universe sounds like an impossible task, how can you deal with all of the stars in the universe, that will take Terabytes of storage! Its impossible to display an image with a billion objects in it.

So of course there is a trick to it :) Like Nested this program is based around a rather generic organization of the universe, the Universe contains galaxies, which contain stars, which have planets which have continents, all the way down to individual people. Using a robust concept of a 'thing' which can contain other 'things' all the groupings of matter from the entire Universe down to arbitrarily small units of matter can be described with a hierarchy, describing what contains what.

Trying to display a billion objects at once was actually happily avoided by the fact that computer screens have finite pixel counts. To take an example a screen with a resolution of 1600 by 900 has 1.44 million pixels. You would need about 700 of those screens to have a billion individual pixels!
So in this program I cheat and only display around one thousand objects which due to the decreasing size is approximately around the limit of single pixels.

Rather than length scale I was interested in numerical scale: 400 billion galaxies in the observable Universe, 400 billion stars in a galaxy. 7 billion people in the world. All these numbers are approximate and are passed through in powers of ten. The graphics are rudimentary but functional, I am really pleased with how the mouse functionality turned out.

I can't promise that this prototype will be much to look at but it does capture something of that journey I envisaged. Think it of as a challenge to see how deep the rabbit hole goes :P

All mouse controlled, left click on something to zoom onto it, click on the space between objects to zoom backwards.

I strongly recommend listening to this as accompaniment for the journey.

Scale (Numerical) Model of the Universe!

HTML5 canvas goes here

I have SO many things I want to add to this: variety in the hierarchy, procedural content, a length (and time) scale. 3D space! :D

(the human scale might not be the end of the journey.... when you finish why not go in reverse and see if you can keep track of where you have been?)


  1. I request version 2.0: Multiverse to planck length!

    Also the music fits perfectly.

  2. It'll be really boring going from atomic orbital to planck length... Perhaps if I think of something good to put down there :) Also faster zoom speed!