Great question. Galaxies are hard to do in a simulator. So we're doing our best to simulate it reasonably accurately, but also fast enough that you can integrate galaxies (and collisions of multiple galaxies) in real time. No easy task!
Yeah, the easiest way is to put all the mass at the center (like in a super massive black hole) and allow the particles to have a simple orbit around that. This is easy, but not realistic. The rotation speed of galaxies is one of the strongest pieces of evidence we have for the existence of dark matter. If you look at the mass that we can see (regular matter), and then compute the orbits, then they should be rotating slower when you get further from the center (just like how the outer planets orbit more slowly than the inner planets). But the rotation speed actually stays 'flat' with radial distance - meaning it's about the same value even if you get further away. The best explanation for this is some mass that we can't see: dark matter. (
http://en.wikipedia.org/wiki/Galaxy_rotation_curve)
To simulate dark matter, we just plunk down some red particles with a bunch of mass. And yeah, they don't collide with anything. Just like real dark matter, we only see its influence through gravity. In real life, there would be a very smooth distribution. But we are limited to the number of particles we can use. More particles is more realistic.
To compute the orbital speeds, we can't just put down a Keplerian orbit around a single, massive object. So I compute the total mass that is internal to the orbit of the galaxy particle, and orbit it around that.
And you can safely ignore the dark matter particles external to that radius.
Basically, I use this principle:
http://en.wikipedia.org/wiki/Shell_theoremYeah, density waves. So right now Universe Sandbox 2 only uses gravity. In real life, there are lots of other physics that happen. The spiral arms are indeed density waves. So the arms are not the same stars throughout time.
We don't simulate that. So you'll notice that our arms don't stick around for very long. In order to simulate that properly, you need to include more physics. Essentially, we will do that through SPH (
http://en.wikipedia.org/wiki/Smoothed-particle_hydrodynamics). SPH is difficult to do in many cases, but it allows us to include a lot of fluid physics, which is necessary to get real stable arms.
Thomas is working on SPH, and hopefully one day we'll be able to apply it to galaxies. But it's very difficult to do this fast enough to be able to compute and render in real time. Lots of professional astronomers are doing incredibly high fidelity galaxy simulations using the same techniques. They just run them on supercomputers for months, with lots and lots of detailed physics. We're trying to make this work on your laptop.