Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Super Planet Crash (stefanom.org)
349 points by CarolineW on April 15, 2014 | hide | past | favorite | 126 comments

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!

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.

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:


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.

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.

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 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:


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.

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 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.

The biggest improvement - let you specify the initial velocity when you add a planet.

"click anywhere" is misleading.

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 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 )

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!

Thanks for the game, man, it's fantastic.

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


Same thing, but I scored higher, unsure why.

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.

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.

... 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.

If you like playing around with planets and solar systems and such, try "Universe Sandbox":


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

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.

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?

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:


I'm surprised I made it to 500 years ^^


Is there any way to delete the first planet? It seems like there's a motivation to keep refreshing until it spawns somewhere convenient.

Start with an accreation disk, it will evolve into a stable system in a few My.

does this imply that most solar system arrangements are unstable and we are lucky in ours?

> 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.

> 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.."


> green-skinned alien

Come and get me, copper.

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?".

In the long run, the system would stabilise by itself I think

So I used this to answer the obvious question: life would suck on Tatooine, with an earth-sized planet shooting in and out of the habitable zone. Then I found this: http://www.newscientist.com/article/dn23051-only-the-toughes....

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.

According to Kepler's law of planetary motion, the orbit of a planet is an ellipse with the Sun at one of the two foci. Although circles are ellipses, having the planets start with a circular motion makes the system simpler but somewhat unrealistic.

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.

3 bodies, 94.9 million, 500 years:


Surprisingly stable, given the Earth-sized planet's erratic orbit.

Looks kinda like you reached a 3:1 resonance between the small planet and the mini star. I wonder if it's actually dynamically stable, in that the mini-star is actually pushing the earth-sized planet towards that stable orbit.

5 bodies, anyone have more? http://www.stefanom.org/spc/?view=2825038

Twelve. seems pretty easy if you only use earth-sized objects...


just placing them all in the same orbit works ;)

Congrats! You reached 500 years without going unstable! 120,047 points over 500.1 years!

137,479 points over 500.2 years by just clicking out 12 earths randomly in the habitable zone and then set speed to max. Not sure I understand this.

Use the other planetary bodies for more points. 100k in 500 years is nothing!

Ok, just meant that it was very easy to get to 500 years.

Yeah, simple configurations are just stable and will last indefinitely.

The high score was over 390 million when I checked earlier this morning.

I was able to get 65 million fairly easily but have not been able to beat it yet.

yea, my score of 286,394,094 is about to be pushed off the board by hackers :(

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.

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.

Looks cool. How does the program keep errors from numerical approximations to the inverse square gravity law from blowing up?

I found a bug: http://puu.sh/8arsr.png

The very first planet started on the absolute edge, then when I added a Dwarf Star pretty close to the Sun, it altered the orbit such that the planet went out of bounds but it didn't kill me.

It doesn't work for me with the latest FireFox. The interface won't let me do anything. Maybe the server is simply overloaded, because it's almost unresponsive and takes minutes to load the "high scores." It seems to work under Internet Explorer though.

I put 11 Earths in a row in very similar orbits. For some strange reason, some of them went out after ~100 years and made new, stable orbits. http://www.stefanom.org/spc/?view=2980198

This needs a few "overflow-x/y: hidden", but other than that it's a great game.

This is great, but I'd suggest having an instructional module as soon as a user signs on with more details about the different planet sizes, what they mean, and what the "actual" distance would be between the center and the 2AU barrier.

I am applying for funding to develop a more comprehensive educational application. Hopefully the success of the game will give my application some extra clout.

Just wondering, wouldn't anything create a solar system?

Just throw dust everywhere. planets will absorb materials, will become bigger. Some smaller planets could crash against others (bigger ones) and could create a mini planet orbiting the other (moon-earth).

I get NaNs when I put a Dwarf star as close as I can to the parent star. Perhaps a black hole is generated? :) http://www.stefanom.org/spc/?view=3069947

Or it got eaten by a big "Bug"

Not sure how much of an achievement this is, but I was a little proud of my co-orbital pair, introduced at around 37 years:


I wonder if there is a way to perpetuate the "Star-Switching" feature of this one


I've managed to do that with a system that I was trying to create to break it: http://www.stefanom.org/spc/?view=2830379

137 million fake points, 500 years, 1 addictive game. http://www.stefanom.org/spc/?view=3032407

A very simple and elegant idea. Well done.

Interesting, rerunning your simulation you lose a planet at 140.9 years (44m score). I wonder if there have been some subtle code changes that affected the results.

I have found that starting a new game takes a significant amount of time due to load. One way to remedy this is by enabling Work Offline on your browser and simply refreshing the cached version.

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.

Apparently these systems (dwarf-n-habitables) are hard to record correctly: http://www.stefanom.org/2000000-systems-played

I just observed the same result (89m 336y).

LOVE THIS. still trying to do 2 dwarf stars. is it even possible?

I did, but it only lasted like 50 yrs.

What physics model is being used for this? I can't seem to get tidal acceleration to work properly (it seems to for the first orbit, then it doesn't change.)

Got to 1.2 billion 500 years, but it took forever. Next challenge: fastest possible completion with the highest score possible.

Link? The high scores on the page top out around 400m.

looking at the high scores they all seem to be just exploiting the rules or a bug. Can those types of attempts be filtered?

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 :)

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?

Got 7 bodies and 500 points... =)


I always get carried away, and disrupt the equilibrium of earth like planets in the habitable zone with a brown dwarf :(

Has someone created a mirror of the site yet which works? It's not opening up for me as usual, the HN effect.

I tried it.

Create 12 planets as fast as you can, watch the sun in the middle.

After some time watching and focusing, change tabs...

"Real life image burn" :)

dumping a bunch of super-earths into the same orbit around a dwarf star seems to work well. 125.8 years


Yea, but 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.


Looks like something that would translate over to ipad/iphone really well.

Omg this is so awesome, and framestyle style website with retro coloring <3

Thank you! The palette is the awesome base16 by Chris Kempson.

This is great, fantastic work stefanom! I'm already addicted to it.

Doesn't seem to be working on any of the browsers on my mac

Can't load but the mere chance it's anything like either the ancient coin-op arcade game, 'Mad Planets', or the recent Flappy Bird variant, 'Flappy Space Program', makes me like it already.

and we broke it

Applications are open for YC Winter 2022

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact