130 comments

[ 3.1 ms ] story [ 175 ms ] thread
Nice. Unfortunately my solar system was stable for about 40 years and then descended into a nightmarish world of Earth bouncing around the solar system in what would have been a horrific experience for the citizens of the planet. On the plus side the visuals from the multiple planets veering close to destroying it would have been a sight to remember. Well, remember for the short while that remained before the atmosphere either froze, was burned away by the sun or stripped by the gravitational field of a giant planet.
I put a dwarf star in the middle of the Sun (it placed it right next to it), and while it does destabilize the sun a bit, the rapid rotation of the dwarf star stabilizes it overall. The planet doesn't rotate in an uniform way around the two stars either, but it also seems stable overall, thus breaking the 500 year limit, at least:

http://postimg.org/image/jepystvbz/

I am usually quite resistant to games - even 2048 bounced off of me with little affect - but something about the idea of creating solar systems and playing around with nature's laws is deeply appealing and I just spent 15 minutes figuring out how to construct a system which can get as many points as possible without imploding. (hint: large multipliers. Here's an initial attempt that I intend to refine once I'm done with work; http://www.stefanom.org/spc/?view=2823906 )
(comment deleted)
... is your Planet 2 something that's even possible in real life? I'd think a large body so close to a star would get destroyed by tidal effects and converted into a ring.
That link doesn't seem to work for me; I only see one planet.
It's a recording of his session. You can speed it up the using the controls on the left to see stuff happen faster.
Got you beat[0] just barely, with only the addition of a dwarf star. The speed multiplier is certainly the key. It also seems your initial planet placement is random, so it's getting something that allows use of the dwarf star.

[0] - http://www.stefanom.org/spc/?view=2974678

How about two dwarf stars?

I ended up at 190M (I also had a big crowdedness factor), but I can't find the "share" link.

At least one dwarf star, plus everything you can fit in the habitable zone, seems to be the way to run it. The main trick is keeping the initial planet from ejecting itself when you add these things.
What you have to do is drop them at just the right distance to evenly space 9 of them while only placing one at the same orbital alignment of the two central stars so they all follow the same orbit.
Wait, does speed actually multiply your score? I thought it was just displaying the current speed setting next to the multipliers.
It does not, no. realized this some time after commenting as well. Habitability (planets in habitability ring, I would assume) and crowdedness give multipliers.
If you like playing around with planets and solar systems and such, try "Universe Sandbox":

http://universesandbox.com/

I've heard good reviews (I've never played it myself though). It's also on Steam.

Thank you!

I should add that the entirety of the code will be published on GitHub, like my other projects (http://github.com/stefano-meschiari/), so people should feel free to fork, make pull requests, etc.

If anyone likes what I do, I will be available soon for freelancing. I have a small portfolio of applications I built here: http://www.stefanom.org/devel/

Thank you so much for this! Awesome little sim/game. Beyond my coding skills, but it would be lovely to also show some of the Lagrange points for the orbits. I've noticed (I believe) that I can get objects stable around L4/L5 (but not L3) But I may also be imagining things :-) Very cool!
If you don't want to kill your site, you should make it possible to start a new game without reloading the whole page.
Good catch. I did not expect the game to become this popular, so I took what I considered to be an easy shortcut.
What sort of initialization are you doing that requires a full-page refresh?
It seems that running on the fastest possible setting helps to avoid (skip) most collisions by making them near-collisions.

P.S. Got to 430 years.

Hm, I got to ~100 years with twelve small-ish bodies and it looks as if integrating in shorter steps helps avoid the buildup of instabilities?
Different playback speeds can even make planets spin out while replaying high-scoring systems. Bit disappointing!
You should email the author directly (stefano.meschiari@gmail.com, according to the site) if you have a reproduceable case. The simulation timestep isn't supposed to change, only the display timestep.
looking at the high scores they all seem to be just exploiting the rules or a bug. Can those types of attempts be filtered?
Seems like you need to create a binary and then fire a bunch of earths into the habitable zone. I've done this but can't seem to get the crowdedness bonus up to the levels of winning systems.
What do you call exploiting?
Hi Shivetya,

Admittedly, the point system could have been better designed. However, for this first attempt, I could not come up with a better alternative. "Exploiting" the point system within the game is not that easy, so the people that achieved the high-scores must have played tens, if not hundreds or more, of games before finding the right timing and initial condition.

Those are all imaginary internet points anyway :)

does this imply that most solar system arrangements are unstable and we are lucky in ours?
Off the top of my head, I would assume that it's because in nature solar systems form by dust gradually accumulating into planets. This is different to just plonking a brown dwarf right into the fully formed system.

I also think that the solar system isn't entirely stable. The orbits of the planets do influence one another in a way that isn't in equilibrium. It just happens very slowly.

Well no - this shows a lack of understanding of emergent properties. There are clearly billions upon billions of "solar systems" that get created but not surviving for over 500 years never really get considered to be "solar systems", certainly don't have a chance to develop life in that time and don't have inhabitants to say "aren't we unlucky we live on an unstable system?".
> does this imply that most solar system arrangements are unstable and we are lucky in ours?

No, not really.

Even without knowing the masses of the planets and the sun here, the scale of this game is tiny compared to the real solar system. In realistic scales, it is a lot easier to come up with stable configurations.

Planetary systems form slowly from a gas and dust disk surrounding a new born star. The early protoplanets will collide with each other and form bigger bodies and the system will slowly reach a stable configuration. Planets may be thrown out of the system or flung into the star too.

The best current understanding of exoplanet systems is that there are planetary systems orbiting the majority of stars out there. Our solar system is neither an extremely lucky coincidence or a rarity among other stars.

This explanation is the value I see in games like this, even though they are contrived situations: it causes people to ask, what is the real science behind this? If this game is not how it actually happens, how does it happen?
> The best current understanding of exoplanet systems is that there are planetary systems orbiting the majority of stars out there. Our solar system is neither an extremely lucky coincidence or a rarity among other stars.

All the exoplanet systems were discovered only recently (span of a few decades). So we don't really know if those systems are stable in the long run, and hence we don't really know if our solar system is "lucky" or not.

> All the exoplanet systems were discovered only recently (span of a few decades). So we don't really know if those systems are stable in the long run, and hence we don't really know if our solar system is "lucky" or not.

Yes, all exoplanet systems have been discovered recently but the best theories explaining the birth of planetary systems predict that the planets form very soon after the formation of the central star. And we have good estimates about ages of stars, which are several orders of magnitude (as in 10^8 vs. 10) older than observations about exoplanet systems.

Statistically that means that we were not "lucky" and neither were any of the other exoplanet systems.

Given that the science behind exploring exoplanet systems is so young, this theory is not necessarily correct but it is the best understanding that the scientific community currently has.

Unstable arrangements naturally collapse into stable ones. Eventually everything gets stable.

We are lucky that our stable arrangement happens to have a planet with surviving water within the habitable zone and with a few elements in the system that make collisions less likely. (Both the Jupiter and the Moon "sweep" space so that collisions with earth are much less common than they would be without them.)

Of course, the anthropic principle is in full force. The earth had to be lucky for you to stand on it wondering about how lucky it was -- so, if it hadn't been lucky, you would not do so and maybe some green-skinned alien halfway accross the galaxy would spend time wondering how lucky his planet was.

> green-skinned alien

Come and get me, copper.

> Of course, the anthropic principle is in full force.

Exactly. For instance, there was a time when Earth didn't have a Moon, which would make collisions more likely. At least one of these collisions seems to have created the Moon. We of course are familiar with the version of Earth that has a Moon; it is unlikely that we would have evolved without that Moon such that we were left thinking "Gee, it would be nice to have a moon.."

(http://en.wikipedia.org/wiki/Giant_impact_hypothesis)

In the long run, the system would stabilise by itself I think
I always get carried away, and disrupt the equilibrium of earth like planets in the habitable zone with a brown dwarf :(
Start with an accreation disk, it will evolve into a stable system in a few My.
My best after a few attempts is:

500 Years, Score: 33,445,876, 7/12 bodies

See http://www.stefanom.org/spc/?view=2850139

Weird, I replayed your simulation and you lose a planet at 336 years (89m score). I wonder if the game was subtly tweaked since you played it, or maybe your browser produced slightly different results than mine.
I always wanted to know how it's possible to have a dual star system with planets in between the stars. It's easier than I thought[1]. I guess the heavier the second star, the further it must be from the inner planets.

[1] http://www.stefanom.org/spc/?view=2843935

IIRC, those are now believed to be extremely common--one primary with nearby planets, a secondary so far out that it's barely brighter than the background stars.

Of course "far out" is the key there. I'm pretty a real planet stuck between two stars with <2AU separation would be deeply, deeply fucked. o.O

Well, as my link shows, if the second star is a dwarf of any sort and the planet is close to the 'main' star, it should be fine. Of course, habitability is another question entirely.
(comment deleted)
Is there any way to delete the first planet? It seems like there's a motivation to keep refreshing until it spawns somewhere convenient.
This needs a few "overflow-x/y: hidden", but other than that it's a great game.
So in "Super Planet Crash" the planets can't actually collide? I pumped 11 super-Earths into essentially the same orbit (in the habitable zone), and they seemed to just overlap and do just fine. When I lose, it's always because a planet flies off.
I am the developer of the game (StefanoM). I'm glad people are enjoying the game, and I'm sorry for the downtime -- I did not expect it to become this popular.

If you have any improvements or suggestions (especially on the programming side!), please email me directly.

Update: As an astronomer (and not a professional programmer), being on HN makes me super proud. Thank you!

You should probably stop reloading the page for new games. Seems like it should be possible to run the game and restart it client-side only?
I definitely took a shortcut there. I'm not a professional programmer, and any time I dedicate to this I tend to consider as "stealing" my attention from my actual job as an astrophysicist...

I'll do a bit of testing and see what I can come up with.

Have you considered open sourcing the code? Some people might want to fix problems they see :-)
I have. It will be posted on GitHub as soon as I have a bit of free time. I want to make sure the code is well commented & readable.
I could use some astronomy tips. It is fun, but sadly I am not learning anything with this.

For example, someone here commented about two stars systems, and if the planets are between them, they should closer to the center one as possible. This kind of thing I can test, see how it works and learn a little.

So a few tips as why another star in the center transform a planet's path from circular to an elliptic one, could help.

Soneca, there are a few links on the sidebar. My hope is that people will look for answers among the many excellent resources that are already available online. I also hope to develop the game further to make the physics that drives the planetary dynamics a little more clear.
A new game always comes with a planet at a random orbit - would be good to get rid of that, although I can see it makes understanding things easier, initially.

Also, the speed shouldn't affect the results - perhaps the simulation could always be done at the same resolution, separate from the animations.

The simulation is always done with the same time resolution (time step). What the speed factor does is just change how many integration steps are taken between frames, so speed should indeed not affect the evolution.

If you have a reproducible case, let me know.

How about half of the high scores? When watching their replays I can't seem to get a reproducible result. Sometimes their 400MM score is crashing out as early as 10y.
I wrote about this issue a bit here:

http://www.stefanom.org/2000000-systems-played/

It's a combination of (a) people straight up exploiting the fact that the server trusts that the data sent from the client is correct, (b) some truncation error that happens when the system is saved for replay may lead to a different final outcome when replayed (the systems may be highly chaotic), or (c) a bug that I haven't been able to reproduce yet.

(a) is something I struggle with coming up with a good solution. People can just enter the Javascript console and mess with the internals (change points, multipliers, etc.). When the data is sent to the server, the server cannot re-run the entire integration, it is too computationally expensive (almost 4,000,000 games played!). So what I do is do some basic checks on the server, loop over & reject systems that are clearly fake, ban IPs that are obviously trying to exploit the high score table, and call it a day since I cannot be monitoring the high-score table all the time. As I wrote in another comment, they are all fake internet points anyway, so I'm not too concerned. If anyone has a better idea, my email is stefano.meschiari@gmail.com -- drop me a line.

(b) is a feature inherent to the N-body problem, so not much can be done on that front.

(c) I still haven't come across a system that I created on my testing environment (that I save with some extra debug information), that behaves differently when replayed.

Hey stefanom, fantastic game. I see your website is having some trouble keeping up. You should sign up for the free version of Cloudflare and put your website behind it - then you'll not have nearly the trouble with the traffic load.

(I'm not affiliated with them in any way)

Thanks for the tip, Matt. I believe I have it set up now.
An API that would output the positions on a per-tick basis would allow it to be hooked up to a simple rendering engine an generate eclipse scapes, which I think would be very educational.

Meantime, I have wanted something like this ever since I was a kid and ran into the three body problem while trying to devise a sci-fi game. Finally I can build the solar system of my dreams!

What kind of integrator is this system using? Is it symplectic?
It is a simple leapfrog integrator (which is indeed symplectic). I found that, at least in a test implementation, higher order methods were too computationally expensive to run the simulation at a good frame rate.
what equations did you use? the mufti-body problem does not have closed for solutions for more than two bodies so I'm curious
There is no analytical solution for multi-body problem. But one can still use numerical solution to simulate. Though the error will become bigger and bigger and not reflect the real world scenario.
I bit the bullet, and wrote a bit of extra javascript to restart the game server-side.

By the by, if you like what I've done, I will soon be available to freelance. A few other projects of mine are here:

http://www.stefanom.org/devel/

"click anywhere" is misleading.
The biggest improvement - let you specify the initial velocity when you add a planet.
2 suggestion. 1) Make the new game not a full page refresh. 2) Remove the first planet.
I'll see what I can do over the next couple weeks.