This is cool, and I'm a sucker for gravity/space simulators (as my hours logged on Celestia would prove), but it should be noted that in terms of "galaxy" it's inaccurate. Specifically, this inaccuracy (the galaxy rotation problem) is the driving force behind the hypothesis of dark matter [0].<p>I don't mean to be pedantic or anything. I just think it's interesting.<p>[0] <a href="http://abyss.uoregon.edu/~js/cosmo/lectures/lec17.html" rel="nofollow">http://abyss.uoregon.edu/~js/cosmo/lectures/lec17.html</a>
I also wrote a 3D version in C++ using OpenGL
<a href="https://github.com/claassen/GalaxySim3D" rel="nofollow">https://github.com/claassen/GalaxySim3D</a>
Well done. Here's my HTML5 Version: <a href="https://news.ycombinator.com/item?id=8288434" rel="nofollow">https://news.ycombinator.com/item?id=8288434</a>
I can't help but notice there is a magical "Theta" parameter, with the description "Higher = faster, less accurate". I think here it's a threshold for ignoring children nodes' internal structure in an octree.<p>As a matter of good software engineering (and numerical analysis, and mathematics, too), your software shouldn't have magical parameters with mysterious consequences for the correctness of your software. (I know correctness is maybe not the point <i>here</i>, but still...) Also, note that there is no way for a user to check how accurate the simulation is for a given "Theta" parameter. The name is completely non-descriptive as well.<p>There are mathematically sound ways to determine the accuracy of the simulation. If they are expensive, tell that to the user explicitly, but default to the correct implementation, not the fast one.<p>Note that while the user has no clue what "Theta" is, the user might instead be able intuitively specify that they want the simulation to be accurate "to X digits for the first Y seconds of the simulation". I think that would be a better software design. As it is, "Theta" is an exposed quirk of the implementation.