🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

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

Published May 15, 2017
Advertisement

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

No picture today. I'm doing some heavy updating to the movement of objects on scales ranging from galaxy-wide to dirt-under-your-feet wide, and it's moving forward.... with significant resistance. It, too, will soon bow to me! But trudging through 0s and 1s to make things look not dumb is a tedious enough job to let my mind wander, and that is a great way to think over our next step in making a universe from SCIENCE. So... come on, lets get chemical, chemical, I wanna get chemical, chemical....

(my apologies to readers too young to understand that reference. I suffer from being not-young...)

CHEMISTRY

First off, I'm a teacher, and as a teacher, I would like to let you know that everything school tells you is lies!!! Hideous, meanspirited lies, dictated by dark creatures in secret bunkers, who loathe you. There. With that out of the way, here's a few raw facts about chemistry: It's not that difficult, you don't need math to understand it (but you do to use it properly), and you'll gain mental superpowers from it. Seriously, understanding even the basics of actual, well-described chemistry lets you see the world from weird perspectives. Sadly, schools prefer the "avalanche of useless factoids" approach to teaching it, so please allow me to undo what they have done so wrong to you. Forget everything about chemistry you learned in school, and just focus on what I now tell you:

Atoms. They have positive protons in the core (the nucleus). These protons repel each other but attract the negative electrons around them. Even if another atom is already holding on to an electron, another atom might grab it. And when atoms grab electrons, chemistry happens. That's basically it: All chemistry is just atoms fighting over electrons. When things heat up, it's usually because electrons are getting ripped from one atom to another, and anything in the way gets knocked about by the electron as it moves. Atoms that are excited (i.e. atoms that have been knocked about, yes, there are S&M implications in this part of science) are what we feel as 'heat'. More excited, more hot. Less excited, less hot.

The big deal about this is that different atoms have different strengths to pull on electrons with. See, if an atom gets a certain number of electrons around it, they clutter up the space there, and getting new ones becomes difficult (remember, these negative electrons also repel other negative electrons, so they don't fit neatly around the atom). In fact, we have SCIENCE to work out how many electrons that fit nicely around atoms. The strength of an atom drops sharply after it's 2nd, 10th, 18th and 36th electron, just to keep it simple. And after a drop, the next size in atom has a little strength, the next has more, and so on. So atom number 9 has a lot of strength to grab electrons with, but number 10 fills that level of clutter up and can't grab onto anything through it. 11 then has a tiny bit of strength again, 12 has more, 13 even more, and so on. This strength is called electro-negativity, and it's really the one thing you need to understand to easily get the rest of chemistry. Yeah, if you understand "different kinds of atoms try to grab electrons with different strength", you're basically golden. Congratulations: You are now a chemistritician*.

(* - there is no such thing as a 'chemistritician', do not use this made-up word on any job applications. Or, if you do, please let us know the results!)

Everything beyond that is the result of using this to some advantage. A battery is just two materials, where one has higher electronegativity than the other, so it keeps stealing electrons. Except it steals them through a long wire, making electrons flow through the wire from one material to the other. Those flowing electrons are electricity. Or how about them acids, eh? To make an acid, just take a bunch of hydrogen atoms and use a stronger atom to rip away their electrons. Then, the hydrogen ions (any ion is an atom that is missing electrons, or has too many because it stole some from others) go around trying to steal electrons from other atoms, which can damage whatever those other atoms are part of. A 'base' or 'alkali' (they're not the exact same thing, but close enough) is something that likes to attach to those hydrogen ions. Sadly, it also like to take normal hydrogen atoms from other stuff, which can damage the other stuff. Or how about explosions, huh?? Same deal. If something yanks enough electrons from something else fast enough, it makes a lot of heat as the electrons go from one to the other. A lot of heat fast, trapped inside something, explodes. Powerful explosives (except nuclear bombs, which do not use this) are about making something that can very quickly steal many electrons from something else. One school lab favorite is to drop 'sodium', a dull, soft metal, into water. Sodium is made entirely from sodium atoms, which are pretty weak. So weak, in fact, that atoms in the water would rather steal electrons from it than from each other. And when a sodium atom has lost an electron, it becomes an ion, in this case a positive ion (it lost an electron, so it lost some negative charge, leaving it more positive). Just like protons, positive ions repel each other, so the damaged sodium atoms push each other away, exposing fresh ones behind htem, and atoms in the water go to steal electrons from the fresh ones. This happens so fast that yes, sodium explodes in water!

Materials that are not made from just one kind of atom use the fact that many atoms cling to their electrons, even when other atoms steal them (or try to). Like two dogs fighting over a sandwich, they get stuck together. Unlike the dogs, many atoms can stick together in big groups, called molecules. Glass, plastic, gasoline, and many other materials are just made from certain molecules, all stuck together. That's why acid or electricity or even fire/explosions can change materials: They tamper with the atoms inside the material's molecules! Tamper with enough, and the material is affected as a whole. Chemists know how to use this to change materials in useful ways, of course. Even in ancient time, people knew how to make tiny bits of electricity (you can make a battery from a lemon, or a potato, and a few bits of metal. It is just a very crappy battery), and they figured out that using metals for this made one of the metals fall apart, and then the tiny bits (individual atoms, we now know) would stick to the other metal. So they made tiny bits of gold stick to other metals, making the other metals look like gold. We still do that today, with many metals; it's called electroplating. Or they could dissolve stuff with the right materials. Because water is made from molecules with 2 hydrogen and 1 oxygen atom (that's why they call it 'H2O', hydrogen 2, oxygen 1, but you don't mention just the number 1), and oxygen is much stronger than hydrogen, the oxygen atom tends to kind of hoard the electrons. The two hydrogen atoms still hold on, but just barely. So with electrons staying mostly around the oxygen atom, they make it seem negative, and the hydrogen atoms get a bit positive because the electrons don't stay there much. That's why water sticks together so well, that you can pour a full glass and get that little 'bubble-edge' on top, which you always think should start to run over. That's because the positive side of water molecules stick to the negative side, like tiny magnets. Molecules with positive and negative parts are called polar molecules. But they don't stick to molecules that are neither positive nor negative (non-polar molecules), and most fat and grease and oil is made from non-polar molecules, which is why water is bad at washing that stuff off. You use soap. Because soap contains bigger molecules, which actually have parts that are positive or negative, but other parts that are neither! So grease sticks to the non-polar parts and water sticks to the polar parts of the soap molecules, and thus the water can finally pull away the grease as it washes over it! Chemistry!!

THERMODYNAMICS

A quick aside, related to chemistry. Thermodynamics ('heat movement') is about how, basically, hot things expand and cold things contract, and how hot and cold things change each other's temperature. Materials that don't hold too hard onto their electrons can transfer heat quickly, because the heat (which is just movement in the atoms, remember?) jumps from electron to electron better. That's why metal that is the same temperature as everything around it can still feel cold: Your body heat can escape faster through it than, say, the air.

One reason thermodynamics are worth a notice is that things that get pressed together heat up. All the moving molecules inside it get mashed together and hammer on each other, unless they can hammer on something else and let some of that extra heat escape. If something expands, of course, it gets colder, because suddenly the molecules don't hit each other that much. So pressure can control temperature: Push something hard together quick, and it gets hot (if you go nuts on a bike pump, it heats up, and you can even get special little pumps that can use pressure to set flammable stuff like wool on fire!). And if you press soemthing together and let the heat escape, and then let it expand, it tries to suck that heat back in. That's how your fridge works; a compressor on its back compresses some material and lets the heat escape, then lets the material expand and steal heat from (i.e. cool) your food. Or just blow a balloon up and put it in the oven or fridge. In heat, the air inside expands and the balloon expands. In cold, the air contracts and the balloon shrivels up.

But even moreso, thermodynamics are important because materials usually get solid in low temperatures or high pressure. Cold makes molecules move less (heat is how much molecules move, remember!), so they fit better together like puzzle pieces. High pressure just forces them together, whether they want to or not. Or heat and pressure can make something liquid, or a gas. So whether you are walking on solid gasoline or sailing on a river of liquid aluminium (yes, that's the proper way to spell it, 'aluminum' was a discarded spelling that a newspaper once used by mistake) is in great part up to how heat from something like a planet's star gets to the world, and how heat moves around tht world. And to make things even weirder, if you have something filled with low-pressure air and high-pressure air outside, the dense high-pressure air (there are more molecules, because they are pressed more together) is heavier, so the low-pressure air can make whatever it's in float. On air. Scientists are seriously discussing the option of floating cities on Venus, because Venus has air 90 times as dense as on Earth.

Or you could, you know, melt and freeze stuff to make something.

AS FOR THE GAME...

Come oooon, don't make me say this.You already figured it out. okay, then... chemistry is basically crafting for materials. Figure out how to swap atoms around between molecules (like mixing the right things at the right pressure and temperature) lets you make new materials. Whatever is naturally there on a planet just got mixed by gravity and the star's heat and other things. Even in our Solar system, there are freaky things, like oceans of natural gas on one of Saturn's moons, or volcanoes that spew water and ice ('cryo-volcanoes') on many moons around both Jupiter and, again, Saturn. You can spend weeks creating a handful of new materials, or you can design a chemistry engine that will create thousands of materials for every new world, based on what is there and how the world is situated. And when you figure out how to use this to make things burn or explode, things get exciting!

That's seriously it. Some basic chemistry, a lot(!!!) of math, and a game can design a ton of materials, all on its own. It's chaotic, and it's messy, but it should be interesting...!

0 likes 8 comments

Comments

Awoken

you had mentioned that you're a math teacher, do you use your blog as a teaching tool? specifically for your students? if so that would be kinda cool.

May 16, 2017 03:07 PM
Embassy of Time

you had mentioned that you're a math teacher, do you use your blog as a teaching tool? specifically for your students? if so that would be kinda cool.

Thanks! I am currently on extended sick leave. If not, I might have done so, it seems like a good idea. Last I taught I actually used a scaled down version of the stuff I am posting here, up to the time of the dinosaurs (of course), and I hope to turn it into something for teaching some day! However, spreading the word on educational stuff is insanely hard, so I need to put something together that kicks ass. Hopefully, the game will help with that ;)

May 16, 2017 03:30 PM
Awoken

So you're basically creating the Universe. That's about a big as it can get, nice. I'm trying to envision what your game does: will it unfold over time, as in a player will watch in real-time events taking place; or will the science be used to generate the content which will then be interacted with?

May 16, 2017 05:15 PM
Embassy of Time
[quote name="Awoken" timestamp="1494954904"]So you're basically creating the Universe. That's about a big as it can get, nice. I'm trying to envision what your game does: will it unfold over time, as in a player will watch in real-time events taking place; or will the science be used to generate the content which will then be interacted with? [/quote] I am, for now, making A universe, and not quite as advanced as ours. But I should get many things kinda close. And you are pretty spot on with the secpnd option, the universe generates for the player to frolic in, or conquer! Except the longterm goal is a time travel strategy game, first person perspective. Be honest, does this comment make me look crazy ;p
May 17, 2017 11:48 AM
Awoken

... A universe, and not quite as advanced as ours.

What a gyp.

May 17, 2017 03:17 PM
Embassy of Time
[quote name="Awoken" timestamp="1495034260"][quote name="Embassy of Time" timestamp="1495021691"] ... [color=#1d2129][font='Helvetica Neue', Helvetica, Arial, sans-serif]A universe, [/font][/color]and not quite as advanced as ours. [/quote] What a gyp.[/quote] I know. I am a horrible person, and my work and life are failures that I am eternally ashamed of. I'll show myself out....
May 18, 2017 03:15 PM
Scouting Ninja

A interesting thing about chemistry like this is that you could already start with liquids and solids.

The problem here is with the maths, not that I am saying your math is wrong, what I am saying is that to have 1 universe in a computer you need 1 computer as powerful as a universe.

Although what you have is intresting on it's own, What you describe here reminds me of:

http://powdertoy.co.uk/

Maybe you could quantify the parts you have now and build a 3D powdertoy, to show people what can be achieved already.

May 20, 2017 07:13 PM
Embassy of Time

A interesting thing about chemistry like this is that you could already start with liquids and solids.

The problem here is with the maths, not that I am saying your math is wrong, what I am saying is that to have 1 universe in a computer you need 1 computer as powerful as a universe.

Although what you have is intresting on it's own, What you describe here reminds me of:

http://powdertoy.co.uk/

Maybe you could quantify the parts you have now and build a 3D powdertoy, to show people what can be achieved already.

I am on that Powder Toy! That looks really cool!!

The difference is that I don't simulate particles, I simulate varying levels of detail processes. For example, I already have a universe with septillions of stars, but unused parts are compressed and run on very compact simulations. Individual blades of grass or grains of sand are only simulated when they are individually meaningful. Otherwise, you would be right. Blunt force won't work, I have to be veeery sneaky!!!

For chemistry, I will likely need to let the engine simulate basic attributes to generate new materials, rather than bunches of particles. Again, blunt force simulation is not going to be an option, no :(

May 20, 2017 10:48 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement