Jump to content
  • Advertisement
  • entries
  • comments
  • views

SCIENCE (biatch!) for Big Games! (part 3)

Sign in to follow this  
Embassy of Time


(other entries in the series: 1 2 3 4 5 )

You know what's really neat to have? A universe. It gives you a place to put your stuff, and you can look at it whenever the boss isn't breathing down your neck. I really like having a universe, and I don't even mind sharing it with other people. That's just the kind of guy I am.

What you see in the above image is my latest venture into galaxy design. I updated the entire method of generating galaxies, to make it both more scientifically literate and a bit more user-friendly for future changes. It's still far, far too blurry and stars are much to close together, but I'll go back and work on that some time in the future. Which leads us conveniently into a talk about...


The way galaxies form is not entirely mapped out by the Smart People, but when it comes to Big Stuff in the universe, there is one thing we always go back to: Gravity. After our last venture, we ended up with a universe filled with big exploding stars and the heavy atoms their, well, corpses spat out and scattered. Everything that is not hydrogen and helium was made from that. But how did that proces get from A to B?

The deal with the four fundamental forces described in the last entry (gravity, SI, WI, and EM) is that they vary mainly in two ways: Strength and reach. SI (Strong Interaction) is immensely powerful, able to bind things together in ways that may never be undone. But its reach is so tiny that it can't even touch anything outside its own atom, so you're not going to suddenly find atoms around you attaching themselves to your nice clothes. Or, essentially, compressing you into a dense lump of particles no bigger than a speck of dust (most of an atom's content is just emptiness, so compressing ti together would, well...). WI isn't much better, and while EM is pretty powerful, it doesn't have an insane reach. SI and WI are impossible to see with the naked eye, but if you want to understand how gravity and EM measure up in strength and reach, it's laughably easy: Put a small piece of iron on the floor and stand up, holding a magnet in your hand. Slowly lower the magnet towards the metal. At some point, it gets close enough that the metal gets sucked up. Congratulations, you just used the EM from the magnet (remember, EM means ElectroMagnetism because it makes magnets work) to defy gravity! Gravity is pretty weak; even the gravity of the entire Earth couldn't pull the metal away from your comparatively sad little magnet. But the magnet had to get real close to do it, while the Earth can hold onto the Moon like it wasn't even no thing (I'm very white, I apologize in advance for all my attempts at cool-speak).

Out amongst the stars, back when the universe was young, that made gravity the king of the hill. True, hills didn't exist yet, but gravity helped create the asrtonomical equivalent of hills: Nebulae. A nebula is basically a big cloud of gas and dust, with the original hydrogen and helium (there was, and is, still plenty of that left out there) mixed with the stuff made in supernovae. Gravity slowly draws the stuff together into clouds, and bigger clouds draw more powerfully on gas and dust out around them, increasing the effect. Some nebulae are also called star nurseries, because stars are born in there and spend a good part of their early life there. Our Sun likely did, too. In fact, projects have recently started appearing to track the bloodlines of stars. Not Hollywood stars, but real stars in space! Stars born in the same nebula have very similar stuff inside them, and astronomers can measure the contents of stars. How? Well, remember how light is just electrons releasing energy when they move closer to an atom's nucleus? And how each kind of atom has its own set of colors of light it emits? Astronomers use a prism to split up the light from a star and then check out the colors contained in it to see what's inside the star. The more two stars match up, the more likely they came from the same star nursery!

It would make sense to think that stars would just get sucked farther into their respective nebulae and collide, forming bigger and bigger masses inside. But gravity isn't that simple, and much of astrophysics is just a big puzzle to figure out how gravity affects things. Once stars form, they basically hold a lot of the nebula's gravity in one spot. That causes other stars to get pulled around weirdly, causing them to circle each other or whip around, or, yes, get sucked together and collide into bigger things. When things get crazy enough, one or more stars get whipped right out of the nebula, like losing your grip on that baby you were swinging around (shame on you). So stars fly out of their nebulae here and there, all the time. Again, our Sun likely did, too!

As noted, some stars get flung out along with their brethren. Some stars may also attract other stars later, as they pass by close enough. Binary systems are what we call stars that are close enough to hold onto each other and spin around one another (they orbit each other). The word 'binary' means 'made of two', but in reality, we use the term to refer to stars that orbit each other in packs of three, four, five or even more, as well. At some point, though, there are so many stars, orbiting each other at such a distance, that it seems less like a few close friends and relatives, and a bit more like a house party. Thousands of stars can mutually attract each other, every star adding more gravity to the whole group. They have enough distance between them to not collide; in fact, any star in the group might be barely even visible from any other! But the gravity keeps them together.

This is the point where that swung baby becomes important. Let's talk about centripetal force.

People often talk about centrifugal forces, and this annoys physicists to no end. The idea is, that when you spin something around, it starts pushing outwards. You can check that out with any small object tied on a string. But fact is, if you let go of that baby you've been swinging around, the baby will not fly straight away from you! There is nothing 'pushing the baby outward'. What is really going on is that at any point, the baby is going in a straight line. Except you keep pulling on it. That's why it feels like it would fly outward; you're pulling inward! You are keeping the baby form flying in a straight line in the direction it's already going. You are the centripetal, not centrifugal, force! If you let go (DON'T!!), the baby won't fly straight away from you, it will simply continue in the direction it was going. If you draw the whole thing seen from above, the baby would go in a circle, but then suddenly just continue in a straight line. It will never change direction on its own and just go straight away from you. It just continues the line you're drawing when making the circle, in a straight line.

This is how stars orbit one another. Gravity is the centripetal force that holds them together. Anything moving too fast will start moving out of the group, because the centripetal force isn't strong enough. Anything moving too slow will sink inwards towards the group center. And because gravity is stronger the closer to its source you are (or everything would be pulled together in the entire universe; most stuff is too far apart to pull hard on each other, luckily!), anything closer to the center of gravity that the entire group essentially orbits (the barycenter). Remember 'bary'? It means 'heavy'? The center of heavy stuff, get it?) will have to move much faster than stars out on the edge of the group. Such a group, by the way, is called a cluster. In this case, a star cluster. And as some star clusters continue to grow, stars pull on each other, making the cluster change shape. There are many shapes that it can become, but one of the more familiar is when stars pull their orbits together bit by bit, until they sync up nicely. That leaves the cluster in the shape of a disc, the shape most of us associate with a galaxy. Incidentally, the word 'galaxy' comes from the name of our own galaxy, the Milky Way. When we look up at our galaxy from our place inside it, we see the disc edge-on, making the billions of stars in it look like a long streak of white on the night sky (if you're in a place where you can even see it clearly; that was easier before artificial light made stars harder to see). That white looked like milk, so millenia ago, that gave the galaxy its name. 'Milk' in ancient Greek is 'galaxias', so...

But this is just the beginning. Inside galaxies, stars still found themselves gathering into clusters here and there. But just as in clusters, stars near the center of a galaxy must move faster, or they fall into the center. So a cluster in a galaxy might see the stars closer to the center go faster than those farther out, stretching the cluster out along the paths of the stars. Had that path been a straight line, the cluster would have just been stretched out. But star orbits are round. So the stretched out cluster got wrapped around the center of the galaxy, forming a spiral. Our own Milky Way is one such spiral galaxy, with huge spiral arms, made from millions or billions of stars. Our Sun is in the arm called Orion, from the Greek myth.

And of course, all of this also ended up happening on a smaller scale. Smaller than galaxies, that is; we're still talking huge stuff, here! New stars would gather gas and dust from inside galaxies, or even drag gas and dust along from their star nursery as they traveled through the universe. Gas and dust that moved too fast got away, and gas and dust moving too slow fell into the star. But a small amount of it struck the right speed and path to start orbiting the star as a disc of gas and dust. This is called an accretion disc, which means a disc that stuff is gathered (accreted) in or from. And within that disc, just like amongst the stars in the galaxy, things clump together. Gravity is not strong enough in specks of gas and dust to pull it together when it's going around a star like that, but remember how positive particles attract negative particles? Yeah, they don't care what atoms those particles are part of. An electron around one atomic nucleus will still be attracted to the protons in another, nearby atomic nucleus, too. There is no honor amongst thieves, here! So the subatomic particles of various atoms will pull the entire batch of atoms together, until it gets big and dense enough for gravity to start taking over. Clumps of atoms get mashed more and more together, and pull in more and more new atoms, until you get small rocks. Those rocks pull in other rocks, growing and growing, occassinally smashing together and strewing debris of rock around them, while the rest clumps together to form a new and likely bigger rock. Given time, they will become planetoids, which in turn may even merge together to become planets. And those planets may have their own, much smaller accretion discs, which form moons. Or they just happen to grab one of the smaller rocks floating about and get it into a nice orbit and call it a moon.

So where does that leave us? It brought us from the scattered gas and dust after the first stars exploded, and formed our galaxies, and star systems like our very own Solar system (the proper name for the Sun is Sol, hence 'solar' this and that). Mainly through gravity, a featureless universe became what we know and love. In what we can therefore live. But that part about living is for another time.


Look... science is not always an exact science. Subjects overlap, like, a lot. But to put it in very crude terms (forgive me, any scientific academics reading), astrophysics is about how things behave out in space, while astronomy is about seeing what's out there and describing those things. It's a bit like describing a TV show or movie: Astrophysics is the plot, astronomy is the characters involved. Kind of.

Fact is, things do not just progress nicely from hydrogen and helium to stars and planets. It's a mess out there. A mess with weird stuff that can kill you in an instant. We are very sheltered here on Earth, for reasons we'll look at later, but out there, in space... It's a freaking horror show.

Most people already know how a supernova doesn't just leave gas and dust behind. Supernovae are so violent and fast that anything deep inside the dying star cannot possibly get out in time. So it gets smashed together, as the star collapses and everything comes pounding down on the core. When the gas and dust clears (which can actually look really pretty), the core is left as... somethng else. If the star is big enough to go supernova, but not insanely big, the core is left behind as a big lump of neutronium. This is a kind of matter created when atoms are compacted so hard that electrons merge with protons to form neutrons. Neutrons usually die quickly (they split into protons and electrons), but when compacted enough, they form a hideously dense object with so much gravity that they simply cannot fall apart, a bit like sitting on an overstuffed suitcase to keep it from popping open. And because neutrons don't repel each other, they all essentially form one big atom, an atom the size of a planet. It has insane gravity, because there is just so much inside of it. We call this neutronium lump a neutron star. And because iron is th elast thing a star produces before going supernova, this ball of neutronium is covered in it. So when the neutron star spins, it's like having electricity run in circles, which, as stated, creates a magnet. A magnet the size of a planet, weighing as much as a star! Because light is electromagnetism (it's all about the photons, baby), a neutron star can sometimes bend light so that it only truly shines out where the big magnet has its north and south poles, creating two powerful beams of light. If the neutron star wobbles, the beam spins around like a lighthouse light, and if the beam hits you, it seems to pulsate, hitting you in steady blips. You now have a pulsating star, also called a pulsar. If it's the magnetic effect that starts bothering you, you have a magnetar. And if the neutron star is heavy enough, it doesn't even ebcome a neutron star! It just keeps compacting itself, with gravity getting stronger and stronger as the star gets denser and denser, until it sucks in even light, and you have a black hole. Black holes do not have 'stronger gravity' than anything else; if the Earth was compacted enough, it would become a black hole, with the same gravity as always. But the black hole is so small that all gravity is in a single point, and when you get close enough to the point (closer than the size the black hole was as a star, called the Schwarzchild Radius), you get to the event horizon. We cannot see anything deeper inside than that, because the black hole eats everything, even light, inside that horizon. But anyway, you'd get ripped apart if you got that close to it.

All of that is pretty nice on its own. But match it up with some of the other things we talked about, and things get insane. Black holes suck stuff in, you say? Well, how about black holes constantly eating other black holes and nearby stars until they grow millions of times more massive than any star? That would be a supermassive black hole, and most galaxies have one at its center; that's where the slow stars go when they 'fall in'! It also helps keep the galaxy together. Yes, the effect of the Milky Way's own supermassive black hole reaches us, we just move too fast to fall in. You're welcome.

Or you're proud of your pretty pretty pulsar, you say? Well, how about having that spin make a magnetic field to concentrate light from an entire freaking galaxy? Say hello to your friendly neighbourhood quasar, some of the (if not the) brightest objects in the universe. Then again, you don't need a galaxy to impress. That whole spinning thing has a funny effect, you see: When things get pulled in by gravity, they still move just as fast, even if the circle they are making is much smaller. That's why figure skaters pull in their arms, it makes the arms go the same speed in a smaller circle, thus going around the skater faster, and pulling the rest of the skater along, making him or her spin much faster. Remember how a supernova is a star that collapses after dying? As in, 'things moving around it drop down to move just as fast, but in a smaller circle'? So all that stuff inside a supernova spins around like crazy, and if it spins fast enough, you get the same effect as with a pulsar. Except the energy is the energy of an entire supernova, concentrated into two freaking beams! Yes, this is worth shouting, because it's basically like me pulling a gun on you that fires half a supernova straight in your face (the other half goes the opposite way). It's called a hypernova, and it earns its name, every time it happens!

Then again, we can go a bit more mellow. Stars that are too small to go supernova either just collapse into a tiny star, which has no internal fusion but still has enough of its old heat to shine for millions of years, called a white dwarf. Or they first puff up, because as they collapse, some of the hydrogen near their surface falls in near the core and starts more fusion, but because it's near the core and not in the core, the hot matter swells up like steam from boiling water. It becomes a red giant. Once the star burns through this second round of fusion, it, too, shrinks into a white dwarf. The universe is not old enough for any white dwarfs to have lost all their energy yet, but when they do, they become black dwarfs, just dead, cold stars in the void of space. Except... what if a white dwarf is part of a binary system? If it orbits close enough to its partner, and that partner has plenty of hydrogen at the surface, the white dwarf can suck new fuel from the partner. And when it gets enough new fuel, it can re-ignite as a new star! This is what we call a regular nova. It shows up as a new (ironically, an old reborn) star in the sky, but without all the messy supernova exploding. Unless the white dwarf sucks too hard (stop giggling) and becomes too big too fast. Then its new rebirth runs amok and it burns through all the new fuel at once. This is called a supernova, too, but a special kind, called a 1a supernova.

And there are plenty more weird objects out there, even without talking about distant planets. Astronomers usually classify objects with snazzy names; an O9 Blue Hypergiant is a huuuge star that shines brightly with a touch of blue (stars never have any clearly distinct color other than white, because so much light gets mixed inside them). Smaller stars have smaller number, going from 9 down to 0. Below that, the letter changes and the numbers go from 9 to 0 again. The letters, from hottest to coolest star, are O, B, A, F, G, K, and M, or "Oh, Be A Fine Girl/Guy, Kiss Me!". Colors go blue, white, yellow, orange and red, and sizes go hypergiant, supergiant, giant, subgiant, and dwarf. Our Sun is about a G7 yellow dwarf. But as noted, stars change throughout life, and one day, our Sun will run out of fuel, become a red giant and swallow the innermost planets (or at least boil away anything on them as it swells), before dying as a white dwarf. So while big stars tend to be blue hotties and small stars red and cool (for a star, anyway), there are red supergiants and maybe even a blue dwarf here and there.


The game is, in part, about having a whole universe as your playground, and what you do with that. It's perfectly possible to jusy place stars at random, or according to a fractal pattern that has little variations from place to place. But for it to be really impressive, it seems only logical to try to incorporate how stuff in the universe actually forms. Instead of just having a template galaxy and some variations on it, algorithms can simulate how stars are brought together and may form a nice disc, maybe with spiral arms. Or maybe the galaxy has been twisted around into a strange form by gravitational effects, like the pull from other galaxies or not having a very big supermassive black hole. Different stars can just be made from a random list of templates, too, like different sizes and colors, and the weird ones added for flavor. But there are so many strange effects that cannot possibly be entered into a list without spending decades. I never even listed a favorite of mine, a binary system of a big star with a small star orbiting so close the small star is basically rolling on the big star's surface, like the big star has a huge bump zipping around on it!

For serious procedural generation, we need to start out with some basic "gas and dust scattered" universe, likely generated from a map of the original hydrogen and helium clouds, then the first stars formed, and then how they scattered heavier matter throughout the universe. This is not as insane as it sounds; it's just mapmaking in space. The key is to simulate how gravity pulls things together, and what happens to them. That part is basically a regular physics engine, tracking where things go bouncing around in space. Except that everything is pulling on everything else, too. And when you have that, each star can be run through a simulation based mainly on how heavy it is, to get its life path. It's a lot of back and forth, seeing how things affect each other, but the end product is a universe of strangeness that might rival a whole 1% of the crazy stuff in our own! To me, that sounds a lot better than "this star is small and red and has five planets".

And as for the planets... What makes a planet? We'll go into some details next time, but in essence, it's about the kind of atoms it's made of, and how it moves relative to its star. The Earth goes around our Sun once a year (hence the length of a year), and spins once around itself once per day (hence the length of a day). Easy enough, right? But hwat if days were longer or shorter? Things get cold at night. Even a warm planet could turn into a frozen wasteland each night, if it had long day/night cycles. Or what if it moved around its star faster or slower. That's what seasons are made of, after all; the Earth is tilted, so half the year the northern part gets more light, the other half the southern part does. What if the tilt was different? The Earth is tilted about 23.4 degrees. Uranus is about 82.2, which means it's almost on its side! The seasons must be insane. But they change slowly, because Uranus is far from the Sun and thus moves around it slowly (it takes 84 years for one Uranus-year). And that distance also means everything is colder in general. All those things affect a planet greatly, deciding what is solid, liquid or gas, and when, for example. And when we go into details, it affects how landmasses form, volcanic activity, weather, and more. And that's not even counting what it all means for life on a planet, be it native or visitors from space.

In essence, astrophysics shape a universe, and its results affect planets in it, making otherwise similar worlds possibly widely different. Variation is the spice of life. And the spice must flow..!

Sign in to follow this  


Recommended Comments

I had made a procedural model of solar system in 3DSMax using it's scripts all with sun, planets, cloud cover atmosphere, satellites, their orbits, asteroid belt and 1 - 2 dedicated cameras per object. The script provided interface to build rendering clips and post process them to some extent. It was back in version 3 of 3DSMax.

Share this comment

Link to comment

I had made a procedural model of solar system in 3DSMax using it's scripts all with sun, planets, cloud cover atmosphere, satellites, their orbits, asteroid belt and 1 - 2 dedicated cameras per object. The script provided interface to build rendering clips and post process them to some extent. It was back in version 3 of 3DSMax.

Wow, I would love to get my hands on that script for some solid ideas! Do you remember how/where you got it?

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!