So I decided to program a Solar System simulator
TL;DR here is a direct link to the simulation http://mgvez.github.io/jsorrery/
Last spring, I visited Kennedy Space Center. My previous visit dated from the late 80's when I was still a kid, and though I have always been interested by spaceflight, as an adult it truly amazed me. Back at the hotel one night during our trip, we were talking about our lives with the friends we were travelling with. In the course of the conversation, I came to realize that I was losing too much time in my life doing meaningless crap. I was spending countless hours at night browsing the vacuous recesses of the internet.
You know, the internet can be a major life-sucking activity, up to the point where you don't even get any satisfaction from the time you spend there. Not that I wished to quit the internet, it's my job after all, but I wanted to do something in my free time that at least gave me the impression that I was doing something instead of being a passive observer. I wanted to regain satisfaction from that time, I wanted to kick myself in the ass and start the personnal project I always said to myself that I would do.
I have always been the kind of person who calculates the return on investment of time and energy that I spend, for example I will choose to read a book in which I will learn a new language instead of a novel. I seldom allow myself to have fun when I decide to do something (ok, this is an overstatement, but still). Now you will say that this statement contradicts the fact that I was losing my time on the interwebz, but that explains precisely what was my problem : I always want to get a benefit when I do something, but when I don't do anything I don't bother about the benefits of, well, doing nothing.
It's always easier to do the things that don't require any effort or planning, especially at night when you're tired of your work day. And with two kids, let me tell you that energy is sometimes scarce. Even playing a video game requires too much energy compared to looking at gifs of cats riding Roombas. I was feeling that if I had to invest energy in something, it better be for a good reason. The paradoxical effect is that by asking too much ROI on my time, I ended up having none.
What was keeping me from starting a project was that I wanted too much from it. I was waiting for the idea that would get me as rich as Donald Trump, or I wanted to create the new framework that would kick backbone's balls, or I wanted to do that thing that nobody ever thought of. You know, I was influenced by that startup atmosphere that looms over every web developper these days.
My vacation back in April made me decide that I would do a project whose main purpose was to entertain me. Hell, I had better chances of reaping some benefits by doing that than by dying on my couch. I did not care if there was no use to anybody, I did not care if a thousand programmers had done it before, I did not care if it was the lamest idea in the universe. I did not want to do something better, faster, more beautiful, more anything... I just wanted to have fun.
One of the many things that caught my interest at KSC is the physics involved in spaceflight. I knew what an orbit was, but I did not understand very well the mechanics behind it. In particular, I was fascinated by the counterintuitive nature of space rendez-vous and navigation. It is difficult to imagine that in space, you cannot merely go from point A to point B like when you ride your car. You don't push the gas pedal of your spacecraft and steer until you get to your destination. Gravity is the force that drives all space travel, and I wanted to know how.
A while back when I was learning Flash, I had programmed a very simple 2D Solar System simulator, or orrery, to learn about vectors. It was basic and not very accurate, but still it could calculate the forces of gravity between celestial bodies. At that time, I did not get the project very far, even though it's a subject that has always appealed to me. Like many things I undertake, it had come to a point where I lost motivation, and I just switched my attention elsewehere before it got interesting.
In the end it took me more than the two months I planned, because summer, but I kept my interest alive nonetheless and I ended up with a Solar System visualisation that is way better than what I had hoped to get in the first place.
If you are interested in knowing how I did it, I wrote the description of the steps I took to get there.
As the project itself, you can see it live at http://mgvez.github.io/jsorrery/