Hacker News new | past | comments | ask | show | jobs | submit login

I did this about five years ago, but for a space game I was working on. I wanted to generate solar systems, but I wanted realistic ones. I went down this rabbit hole of learning how solar systems were generated and learned a lot about how statistically speaking solar system formation like ours should be fairly common given the distribution of elements.

Gave up on the game, but this part of the process stuck with me.




Would you be willing to write a blog post or do a code tour or... I dunno, something. This sounds fascinating.


It was years ago so I'd have to refresh myself and my code. I had to make a lot of opinionated decisions that astronomers would probably disagree with.

The approach I took to modeling was to assume relative volumes of each element in the solar system and then assume they would exist in certain frequencies at different distances from the star based on gravity attracting them into the sun and solar winds pushing them away. I used a poisson distribution with the lambda being the distance from the star with highest frequency.

I then ran a clustering algorithm to identify spikes of mass at different distances, and that's where planets would go. I effectively divided the space between two planets in half and gave the elements in each space to each planet. This is one hack I had planned to fix eventually. It should be based more on the mass of the space but I didn't have the energy to do the math on this. Plus, I felt like the clustering I did was a bit of a hack to begin with.

Finally, once I had the elemental composition of each planet, I'd make some big assumptions on how that planet would eventually evolve. I roughly clumped them into earth-like, dead rock, and big gassy thing. For my purposes that was sufficient.

It was doing the distributions that I learned that gas giants like Jupiter tend to be inevitable at about that distance in solar systems since that's about where most loose hydrogen converges to due to its weight.

Hope that's enough to satisfy curiosity. I promise the code is less interesting than this post :)


I'm glad I checked back in. Thank you!


Agreed!




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

Search: