Chemistry!

Project Introduction and current Progress:


Original Post

Sort of a re-post from the marketplace thread I started on the subject, though instead of constantly updating that, decided to move it down to the WIP. Long history short, one of the game’s I have going on is a Sci-Fi based on Reality game. As such, I am trying to put together a few “systems” that are based on real-world data. One of those systems is chemistry. There was a little bit of interest in the system, so I plan on releasing a blank project with the chemistry stuff (free of charge). Here is what is going on currently:

The two main parts in this system is the (Technical) Periodic Table data table, henceforth known as: Element Table. The element table has:

  • Element Name
  • Element Symbol
  • Top 3 common usage
  • Allotropes for the Element (if any)
  • Atomic number
  • Element Group
  • Element Block
  • Electron Shells / Period
  • Electron Configuration Per Shell
  • Atomic Mass
  • Atomic Radius
  • Covalent Radius
  • Van Der Waals Radius
  • Phase
  • Element Category
  • Category Description
  • Melting Point
  • Boiling Point
  • Density (Room Temperature)
  • Density (Melting Point)
  • Critical Point
  • Heat of Fusion
  • Heat of Vaporization
  • Molar Heat Capacity
  • Thermal Conductivity
  • Thermal Expansion
  • Valence
  • Electronegativity
  • Electron Affinity
  • Ionization Energies
  • Electrical Type
  • Electrical Conductivity
  • Electrical Resistivity
  • Superconducting Point

To go along with the Element Table, I am also including a Blueprint Function Library entitled ChemMathFunc. This function library combined with the data table makes up the heart of the system. The plan for ChemMathFunc is to include various chemical and physical laws / equations in which you can then use. Please note that I will most likely need a “scientific review” of the blueprint graphs. I can only hope that I am doing this right.. So far, Here is what I have now:

  • Temperature Conversions
    — Kelvin to Celsius
    — Celsius to Kelvin
    — Fahrenheit to Celsius
    — Celsius to Fahrenheit
    — Kelvin to Fahrenheit
    — Fahrenheit to Kelvin

  • General
    — Density Equation
    — Moles
    — Reaction Rate
    — de Broglie’s Equation
    — Planck Constant
    — Momentum
    — Coulomb’s Constant

  • Element Data
    — Get Element Data
    — Get Compound Data

  • Atomic Structure
    — Energy of Wave
    — Wave Relation
    — Coulomb’s Law

So, after 4 days of starting on this system, I currently have 28/103 elements stored in the Element Table, and the functions I listed completed. I also figured a way to use (double?) point precision floats in the engine by splitting the float into the Constant and the Exponent, so instead of 1.32 * 10^23, I use 2 floats:

C = 1.32
E = 23

Anyways, I’ll probably be making a generic Paper2D project with everything in it once it’s ready to be released (ie: has undergone scientific review to make sure everything is legit), at which point, I’ll check with the guys at Epic to see about putting it on the marketplace for free so I can keep (better) track of downloads for it.

Wow, that is quite impressive! I haven’t seen something like this before. Good job :slight_smile:

Been awhile for an update, so figured I’d post at least something.

I did a bit of “re-organization” which, while minor, should benefit in the long run, especially once this releases. Copied the system over to a blank project for easier load times as well as release stuff. Also thought about the implications of doing this (if this is successful, and does what I’m trying to push it to do). Decided to continue the project :wink: Since I’ve been playing “clean up”, removed the “category description” field as their is no need to have that, at least, in the data table. I also created a BPC as a “Dictionary” - that is where the category descriptions will go.

Looking at the direction this is taking me, it might be a bigger project than I thought, as it is also taking a turn towards atomic/quantum physics. Yay, strings.

Hey SaviorNT,

This is a very welcome asset. I thought about doing something similar, though got hung up with several other projects. It looks like what you’re working on here is gonna blow what I had planned out of the water! I also had plans to do a reusable system for electronics engineering… Your organization from the first post has given me some more inspiration for the direction of that. I look forward to tinkering with this.

Thanks again, and keep up the good work!

Edit: UE4 Integers are 11 digits long (just found out). So while this will work, I’ll need to create an array and break up the numbers into smaller parts (5 digits long), and then calculate those. If the end result is > 11 digits long, then I’ll have to parse it as a string. The same methodology below still applies, more or less though. Fun times! I’ll try to split (at the most) into 3 different integers (33 digits total)… however, I would like to get up to a googolplex in accuracy though (10^100). That shouldn’t be too hard though tbh, it’s only an array of 20 items that are 5 digits each. Or I can just call it a day and estimate to the 10^10 decimal places instead. /sigh.

Ok, so I have a bit of documentation to share, in regards to the float variables and how to work with HUGE numbers accurately. If this is off, PLEASE PLEASE PLEASE let me know. I am sort of hacking this together :slight_smile: I haven’t yet looked at how large the Integer variable type can go, however, here is the start:

Let’s look at the famous E = MC^2. Now, would the class like to let me know the energy output of our sun is? Let’s break it down:

All numbers must be in this format: X.YYYY * 10^Z
X = Integer
Y = Decimal
Z = Exponent

Take for example c; the speed of light, which is 2.99792458 * 10^8 m/s. This would be broken up to:

SpeedOfLightInteger: 2
SpeedOfLightDecimal: 99792458
SpeedOfLightExponent: 8

In order to do math with the speed of light, let’s calculate the total energy output of the sun by using Einstein’s e=mc^2

Mass of the sun: 1.989 * 10^30 kg

The normal equation for this would be:

e = (1.989 * 10^30 kg)*((2.99792458 * 10^8 m/s)^2)

First, we need to break down each number to it’s basic forms:

EnergyInteger = x
EnergyDecimal = y
EnergyExponent = z

SunMassInteger = 1
SunMassDecimal = 989
SunMassExponent = 30

SpeedOfLightInteger: 2
SpeedOfLightDecimal: 99792458
SpeedOfLightExponent: 8

After this is done, it’s time to do some math. First up is c^2, which, in normal form, is 8.9875517873681764 * 10^16

First, let’s get the simple thing out of the way:

SpeedOfLightExponent = SpeedOfLightExponent + SpeedOfLightExponent

This gives us 10^16

Now, what we need to do is to combine the SpeedOfLightInteger with the SpeedOfLightDecimal:

SpeedOfLightTemp = 299792458

Once we have that integer, we then then multiply that by itself (TempInteger^2):

SpeedOfLightTempInteger = SpeedOfLightTempInteger * SpeedOfLightTempInteger
SpeedOfLightLightTempInteger = 299792458 * 299792458
SpeedOfLightLightTempInteger = 89875517873681764

After this is done, we then need to take the first number from the left, and set our SpeedOfLightInteger to that number.

SpeedOfLightInteger = 8

After that, we then set the SpeedOfLightDecimal to the remaining numbers:

SpeedOfLightDecimal = 9875517873681764

If we then perform an combine all the integers, and create a string from it:

SpeedOfLightInteger + “.” + SpeedOfLightDecimal + " x 10^" + “SpeedOfLightExponent” we will get:

SpeedOfLightString = 8.9875517873681764 * 10^16

So, this calculates c^2, what about multiplying that number by m? Same process applies!

Take our exponents and add them together:

EnergyExponent = SpeedOfLightExponent + SunMassExponent
EnergyExponent = 16 + 30
EnergyExponent = 46

And then, we combine the xInteger with the xDecimal for both values and then multiply together:

SpeedOfLightTempInteger = 89875517873681764
MassOfSunTempInteger = 1989
EnergyTempInteger = 178762405050753028596

EnergyInteger = 1
EnergyDecimal = 78762405050753028596
EnergyExponent = 46
EnergyString = 1.78762405050753028596 x 10^46


So the plan here is to create separate math functions, Add, Subtract, Multiply, Divide with 6 different Integer inputs, and output 3 integers and a string variable using the same type of process as described above. I will also need to modify the Data Table’s Struct to account for everything being in integers, as well as re-do the functions so the float values can be converted to the integer format instead. Also, it will be nice to get the naming normalized (as above, that’s what I’m going with… <name>Integer, <name>Decimal, <name>Exponent, <name>String.

Edit 2: Justification :wink:

I’m pretty !@#% OCD when it comes to being accurate. Not sure why, but I just am. If you do a search on my answer for the energy output of the Sun, and cross reference to what is found on the web, you’ll see that my answer is far different than say… NASA’s answer!… the reason why is that they are calculating the numbers as approximates, not exacts.

How he/she got this radically different number? By calculating c as 300,000,000 m/s (it is in fact, 299,792,458 m/s), the mass of the sun as 2 * 10^30kg (it is 1.989 * 10^30 kg). Hopefully you guys can see why accuracy is so important to me. And we’re going to let these guys fly us to Mars…

edit 3:

Exponential math functions are done.

2 Likes

Another day, some progress.

Decided to end up keeping floats rather than using integers due to the length limits of them, even if floats can be inaccurate to a fault. Up to the 5th period in the elements, hopefully tomorrow I get to the 7th. Got a bit bored of the periodic table, so created an actor component blueprint named definitions. This will hold the definitions for each subject matter in a series of events named Get (subject) Definitions", which then lead to a collapsed graph with those terms/definitions. The terms are all enumerated, switched, and then the definition variable is set.

Worked a bit on the UMG side of things, and this might raise some eyebrows (in a good way, I hope!)

Main Menu:

Learning Album:

PS: Who do I message to change the thread title… since this is expanding from strictly chemistry, may as well name it as Science!

Created an introduction video, posted in the original post.

I believe the reason for the different results is that the quoted values are the power of the sun (energy per second) while you calculated the overall energy of the sun.
The error introduced by approximating speed of light and sun mass is about 1%. ((1.989 * 10^30 kg))/(2 * 10^30 kg)).

Also, to make your life simpler, you generally don’t need ‘safe’ work-arounds for multiplication and division operations of floats. Both operations are ‘immune’ to rounding errors. In these cases float point precision only affects the number of significant digits of your result which is usually not a problem. You will rarely have input with greater precision anyway and your results can never be more precise than you starting values. This means that the true result of your computation is 1.787 x 10^46 which is well within the precision of single precision floats. The additional digits are not significant.

I hope this doesn’t sound too negative. I think its a cool project. :slight_smile:

No, not at all :slight_smile: I’m not exactly a physics major or anything :stuck_out_tongue:

Also, I’m getting close to being able to generate an atom using the values from my data table, yay!

I’m getting more and more stoked about this, with each each update. I am also obsessed with accuracy- to a fault!

4 days… 4 days I have been searching for a (quick) and (modular) way to create the electron shells, until it finally dawned on me while I was cooking some Ramen. Instead of trying to generate all of the torus’ using the spline and spline mesh components, why not just make a !@#% torus in Max, and then just scale it up/down + rotation. So in four days, here is what I managed to get done (This is just the Shell Generation function, there are also functions for: GetAtomicInfo, BuildNucleusShell, and BuildNucleus).

Also!! I have something else to share :slight_smile: Here is the first look at what a Carbon atom looks like… or at least, my rendition of it :slight_smile:

This is actually a pretty good milestone in the project, as while it is (hugely) simple, it shows that the enums, structs, data tables, and blueprints work. I just need to create a sphere volume that is the same size as the inner shell, and then randomly re-locate the protons and neutrons inside of it. After that, I can look at proton/neutron movement inside of the nucleus, and add material effects to “make it look pretty”.

Just a little technical explanation as well; there are 3 meshes being used, and I could reduce that down to 2… everything is being spawned as HISMs, which are, from what I have heard, less expensive than using ISMs. Also there are 1 material, and 5 material instances. (The protons and neutrons cannot be seen, they’re all stacked on each other in the center - but they are there, I promise :slight_smile: )

Edit: I just wanted to add, before I hit the sack this evening, now that everything is at scale ( 1:100 ), I looked at what a single molecule of H20 looks like… and wonders never cease to amaze. How the !@#% did the universe decide that these two elements could combine together? If I could compare… perhaps, it would be like a normal sized car, towing a matchbox car, and that matchbox car is towing another full size car behind it. Double ya tee eff.

Started looking into purification, namely for water (curiosity - how to build a “still-suit” from dune? Get a wicking material as the skin->material as the base, then use a charcoal lining on top, then a waterproof material. Line the inside with tubes to capture the water, feed it into a reverse osmosis + electrodialysis pack, and then feed the water to one container, the waste to another)… anyways, was looking into constants (faraday’s constant), and came across another good site:

The entire site looks like it could be pretty useful.

Doesn’t need a new post, but if anyone is following the thread:

Bit of an update, and alot of work as been done on the project :slight_smile:

FunctionLibrary

  1. Normalized all Input/Output pins so that they have consistent terminology
  2. Created a simple BuildConstantString which takes the NumberIn, ExponentIn, and returns NumberOut, ExponentOut, and String (It builds a human readable string for the number and exponent, ex: 1.214586789 * 10^46). Any function that returns a number and exponent uses this function to also return a string.
  3. Added the following constant classes from Physics and Math Constants Library List:
  • Universal Constants

  • Electromagnetic Constants

  • Electromagnetic Radiation Constants

  • Electron and Atomic Physics Constants

  • Physico-Chemical Constants

New Additions

  1. Enum: Terms_Common - This enum is apart of the dictionary BP Component, it includes terms which are universal in any science field.
  2. Enum: Terms_Chemistry - This enum includes terms which are only seen in the chemistry science field the majority of the time.
  3. Struct: Struct_UserNotes - This struct is designed so that the “player” can create and save notes.
  4. Struct: Struct_ChemistryLaws - This struct designs the data table for the list of chemistry laws.
  5. Struct: Struct_FiltrationMethods - This struct designs the data table for the list of filtration methods and steps.
  6. DataTable: Data_ChemistryLaws - List of laws in the chemistry field. This table does not include any thermodynamic laws (they will go into Data_PhysicsLaws).
  7. DataTable: Data_FiltrationMethods - Methods and steps for the following filtration methods:
  • Gravity Filtration

  • Vacuum Filtration

  • Distillation

  • Crystallization

  • Electrolysis

What’s Next?

I am still (re-)learning all of my basic science fields, starting with chemistry. As I go along the books (Basic Chemistry/Highschool Level up to Advanced College levels), I am continuing to add definitions, formulas, constants, etc… that I find. I had attempted to create Schrodinger’s Equation within blueprints, but… umm… yea. I’m not quite there yet :slight_smile: I also have posted in the material part of the forums requesting help with creating a wave material that obeys wave dynamics with the expectation that I can use that to visualize the double-slit experiment within the quantum physics aspect of this project.

Books and Study Materials

I figured I would post the study materials that I am using to create this project, in case anyone would like to “follow along”

  1. Websites
  1. Books (Amazon Kindle for the win)
  • Astronomy Today

  • Campbell Biology - 10th Edition

  • Chemistry, The Central Science

  • Essentials of Geology - 11th Edition

  • Essentials of Oceanography - 10th Edition

  • Fundamentals of Physics Extended - 10th Edition

  • Physics - Principles with Applications

  • The Physics of Quantum Mechanics

Newest Screenshot - Template_Textbook

All of the “textbook” stuff will scale to whatever the current platform screen size is.

And that’s the update! I feel as if instead of being a “developer”, I am instead being just a data entry clerk :\ Ah well, it’s for the good of mankind, right?

Weekly update:

Started on the basic physics stuff, basically adding the various formulas into the function library, as well as some basic trig functions such as sphere/circle information, displacements (time, location), calculating “the sum of” with a set of numbers in an array, the quadratic equation, and the Pythagorean theorem in their basic forms.

With adding the various “laws”, I have started to wonder why all of the formulas are in one dimensional format where we live in a three dimensional space. Of course, it’s just vector math, but still… in school we always dealt with one dimensional spaces, not three dimensional space. Let’s take Force:

Positional Displacement = X2 - X1
Time Displacement = T2 - T2
Velocity = Positional Displacement / Time Displacement
Acceleration = Velocity / Time Displacement
Force = Mass * Acceleration

However, it is always taught that X sub 1 and X sub 2 (X1, X2) are individual floats, not vectors :\ Anyways, due to this, I’m adding one dimensional and three dimensional functions, which return either the float or vector. The above set of formulas return 1 dimensional figures, where as if you change the positional displacement to X1: (X1, Y1, Z1), X2: (X2, Y2, Z2), you can get the force in all three dimensions. I think :slight_smile:

In addition, to create a calculator with UMG, I also added a nifty function titled: “String: Set Array Elem With AutoIndex”. It would be nice if the compiler wouldn’t error when using wildcards, but yea. It does what the title says, it uses the input pins: Target Array (string array), Item (string), and Size to Fit (boolean), gets the length of the array, if the length is 0, then it sets the index to 0. If the length is more than 0, it increments the index (from 0), and then sets the array element. I also have an output pin with the Target Array Out so that the connections are a bit less spaghetti-fied.

Just an update on this. I have NOT stopped working on it, however, the project itself is kind of frozen as I’ll need to get consultants in various fields to help (gotta pay them) as well as time/funds to complete.

helle,u work is perfect

Dude,

Most impressive, well done.

Please give this project!!!

Hey so idk if you are still working on this project, but I would definitely appreciate the chance to talk as I am a Chem major that is trying to learn unreal engine and at the same time create the periodic table, with completely interactive elements, in VR as a research project. My advisor and I would be more than willing to talk chem in exchange for sharing some ideas about how to make a few things in UE4. HMU if you’re interested!