Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

B Where to start -- make a physics based game to teach my progeny about the universe

  1. Jun 10, 2017 #1

    I'm trying to make a physics based game to teach my progeny about the universe. My first step will be to show how bodies gravitate around other bodies, and then model a solar system, a galaxy... simple things.
    I could do it using Newton's laws, but I want to include things like black holes, and do it right, so I've been reading about Special and General Relativity, two-body problems, Riemannian and Lorentzian geometry... and seriously, I'm so lost I don't know where I am. But, even if it's only a game for children, I want to create the most accurate model possible for a real time application, like a framework for future upgrades.

    Said that, I'm good with logic, and a very good software developer, but it's been a long time since I did something interesting using physics, and even my math is, well, not as good as it should.

    So, I come here to ask you two questions:
    1. Is it worth using General Relativity?
    2. If it is: Where should I start to learn how to do this from scratch?

    I know this is a very broad question, and you may think I'm just a dreamer... I don't expect it to be easy, but I've been a self learner for a very long time, so I just need a start point, a fulcrum if you want, to start moving in the right direction.

    Thanks in advance.
  2. jcsd
  3. Jun 10, 2017 #2


    User Avatar
    Staff Emeritus
    Science Advisor

    Forget even attempting to use GR for anything. It is ENORMOUSLY complicated to try to use GR's equations to model anything and without years and years of study you won't be anywhere close to being able to do so. I don't think you can even solve the equations fast enough to run your model in real-time, let alone fast enough to create a useable game that runs on the average PC and is able to potentially model hundreds if not thousands of objects at a time.

    Your first step should be to use Newton's laws to develop a basic simulation. Once you have this down, you can implement improvements in the coding and math and then worry about trying model black holes accurately.

    Try looking through the following blog from the developers of Universe Sandbox. I don't know if it will be of any help, but it looks promising: http://universesandbox.com/blog/2016/02/n-body-problem/
  4. Jun 10, 2017 #3


    User Avatar

    Staff: Mentor

    What is this game supposed to do?
  5. Jun 11, 2017 #4
    Thanks for your answers.

    #2 My idea is not to process all the universe all the time. Using an influence radius for each body and computing only bodies influenced by those near the observer (the screen/camera) should optimize it enough for a RT simulation (at the cost of real accuracy, of course). If tests show that's not enough I could use CUDA to compute the model using the graphics card power, although I'd prefer not to do that right now.
    If the result is going to be the same I could go back to Newton's. This doesn't seem to be the case for Mercury and other bodies, but I may be completely wrong about that, and I don't know how important is the difference and/or if it's relevant in my case scenario. That's why I ask if it's worth it.
    Anyway, my little child is only a week old right now, so I have some years to re-learn math, physics and everything needed.
    Sometimes I plan too far ahead for my own sake, I know, but while doing this I was hoping to learn other "useful" stuff. So, if it is worth it, I'm prepared to do it, step by step, no hurries. If it's not, I'll go back to Newton's. In any case I'll do it as accurate as possible.
    Thanks for the universal sandbox link. The whole project looks very interesting.

    #3 The base idea is a 2D celestial simulation (bodies orbiting and colliding with other bodies and/or exploding/breaking/joining). The next step would be to add sun birth-death cicles, and go on from there.
    2D should simplify calculus, and helps understanding what you see in the screen, but I could do it in 3D if that makes the calculus easier (using a perfect Z axis alignment (like a traditional top-down view)).
    [EDIT: I thought about using 2D because I saw (not sure where right now) that GR works with any amount of physical dimensions, and Newton's laws are easily applied to 2D scenarios, but I'm still not sure about accuracy in 2D].
    The game part is:
    1. In sandbox mode you will be able to create and move/throw bodies (a sun, a planet, a moon...). You could cause a mass destruction event just by adding a black hole or pushing a body (my 8yrs old nephew thinks that would be a very fun thing to do), or make your own universe from scratch.
    2. In puzzle mode you will solve tests like "put this planet somewhere to make it orbit this binary system for at least 100yrs", "throw this 'rock', from point A to point B, passing near this 3 planets" or "build a solar system using these bodies (suns, planets, etc.)".
    That would show how gravity works, how the solar system works, what is a supernova... and, if I can use a general object for every celestial body (a moon and a planet are 'mostly' the same thing in different circumstances, and share at least some properties with suns, black holes...) it could show how the universe works (at least at the most basic level).
    In both modes I'll add 'play', 'pause', 'restart', 'create snapshot' and 'load snapshot' options to help setting things right and go over possible scenarios many times.

    If you [EDIT: meaning, people who knows about this stuff] think it's better to use Newton's laws and then migrate to General Relativity, or not to use GR at all, I could do that by isolating the physics engine from the rest of the game (although for GR I'm guessing the render engine would need to be different).
    Using Newton's laws would be easier, but right now my knowledge is too small to know if I should stick to that or not.
    Also, maybe using Newton's will help me recover my math and physics skills, and that may even give me some insights about how to proceed if I end up learning about GR, so both options could be ok, but that could also give me wrong ideas (I've seen some questions and answers about mistakes made because some assumptions are not valid when using GR).

    Again, thanks for your time and help. I really appreciate it.
    Last edited: Jun 11, 2017
  6. Jun 11, 2017 #5
    @gradev, I wondered about GR simulation too and after reading about it in various places I concluded that it's far beyond what an amateur could take on. It seems this is an area of active research in astrophysics involving many PhDs, big expensive supercomputers and certainly much $$$. Just Google "computational general relativity" or "numerical general relativity".

    To get an idea of the difficulty you can try something similar in nature but "much simpler", like simulating charged particle interactions. Keep in mind that such particles do not really interact with each other by inverse square law, they actually interact with the local EM field, which, by the way, will be a dynamic EM field not just an electrostatic field. The challenge of the simulation is to correctly evolve this EM field over time and space.

    For your specific need, yes, stick to Newtonian gravity.
  7. Jun 11, 2017 #6
    Thanks @Vitro . Seems like you and @Drakkith are right, so I'm going to take the Newtonian approach, although I still don't know exactly how big is the Newton's "error", so I feel like I'm taking the easy path but not necessarily the right path.
    Anyway, every engine part (gfx, physics, etc.) could be upgraded independently, so I'm not going to close the door to more complex options (sooner or later I'll go there).
    Now I just need to get the sim right, so I'll be around re-learning everything.
    Thanks all.
  8. Jun 11, 2017 #7


    User Avatar
    Science Advisor
    Gold Member

    For solar system simulations at the precision used by professional astronomers (including perihelion precessions), you only need first level of correction to Newtonian gravity. This won't help with any ambitious goals like black holes. The following describes this first order correction sheme:


    This will still be challenging, but it is much more plausible than a general GR simulator (which has never been achieved).
  9. Jun 11, 2017 #8
    Wow, I did not imagine something like that. Being something so important I thought it was already simulated many times.
    Thanks for the link @PAllen. I think I'm beginning to understand my own ignorance.
  10. Jun 11, 2017 #9


    Staff: Mentor

    Also remember newtonian methods predict all planetary motion to a very high degree. The exception was the orbit of Mercury which was finally explained by GR.

    However when you start factoring in black holes and neutron stars GR effects will be more noticeable.

    Heres a game kit to bring in special relativity


    There may also be libraries for GR but i have yet to find them.
  11. Jun 11, 2017 #10


    User Avatar
    Science Advisor
    Gold Member

    For nontrivial situations, especially for high precision, each case numerically solved is a research project leading to a paper suitable for publication in a peer reviewed journal.
  12. Jun 11, 2017 #11


    User Avatar
    Science Advisor
    Gold Member

  13. Jun 11, 2017 #12


    User Avatar
    Gold Member

    Well, NASA planned all of it's manned space trips just using Newton. I'm not sure about the farther out unmanned missions.
  14. Jun 11, 2017 #13


    Staff: Mentor

  15. Jun 11, 2017 #14


    User Avatar
    Science Advisor
    Gold Member

    The user guide states almost all work with these codes will require access to a supercomputer. The most common one used is the is the Queen Bee supercomputer, with over 5000 cores as of a few years ago.
  16. Jun 11, 2017 #15


    User Avatar
    Staff Emeritus
    Science Advisor

    I'd certainly agree that General Relativity (henceforth GR) is probably not needed for a game for kids. But it's worth mentioning that the JPL Orbital Ephermerides, DE405, used for instance in "The Astronomical Almanac", does incorporate corrections due to GR - and quite a few other things.

    see for instance 8.3 of ftp://ssd.jpl.nasa.gov/pub/eph/planets/ioms/ExplSupplChap8.pdf

    I'd cut and paste the interesting section from the above link, but cutting and pasting yields horribly formatted results, and it's too long to type out manually.

    As far as how to teach kids - I'm not sure how to go about it. Fighting math phobia, and minimizing social pressures against science, and finally teaching kids critical thinking, all strikes me as much needed goals. The last seems especially needed, nowadays, and I gather some efforts are underway to teach that at some level.
  17. Jun 11, 2017 #16


    User Avatar
    Science Advisor
    Gold Member

    And if you look at the main equation in that section, you find that it is exactly equivalent to the Einstein Infeld Hoffman equation I posted a link to earlier (except for a simplified special treatment for asteroids).

    But also note that that what Phinds said is historically true.
  18. Jun 12, 2017 #17
    Good time to mention Kerbal Space Program : https://kerbalspaceprogram.com/en/
  19. Jun 12, 2017 #18
    I have even read/seen that the Apollo missions where flown with the same one body simplification (spheres of influence) used in Kerbal Space Program
  20. Jun 12, 2017 #19
    Well, that settles my doubts about Newton :)
    I'll take a look. At the very least that could be an interesting reading.
    As far as I know, kids need something fun/interesting/weird to catch their attention. Forcing knowledge IMHO is a huge mistake, but if they find stimuli around (a piano, hand painting, a math game where numbers are like pets...) they'll try some things and learn by playing. Also, by studying their behavior parents/tutors can learn what they like, so they can increase the kid's stimuli in the "right" direction. And, since the kids are making choices, their minds will tend to analyze their options, improving their critital thinking.
    Well, that's still theoretical for me, so do not take my word for it. I'm new to parenting.
    Hmm, interesting game ^_^
  21. Jun 12, 2017 #20


    Staff: Mentor

    Also checkout processing.org and its IDE. It's geared toward non-programmers, beginning programmers and graphic artists who want to make interactive art. It comes with a lot of examples, modes and libraries.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted

Similar Discussions: Where to start -- make a physics based game to teach my progeny about the universe
  1. Where is my error? (Replies: 4)