0
$\begingroup$

I'm a game developer and I need to write a solar system simulation. Unfortunately I'm not very good at math and most importantly I haven't got to differential equations in my maths classes at school yet. After some research I came to the conclusion the best method for me is the common Runge-Kutta. I've read a lot about it and from what I understand it's a method that divides a timestep into 3 parts, calculating the values of the function (in this case position and orbital velocity) at each of these parts and then doing something (I haven't really understood how is this any different than Euler with a smaller timestep). I really can't understand the explanations on wiki or other places because they all use formulas which don't say anything to me.

Now since I have to adapt it into code, I'd like to understand it fully, so I really need a live person to explain it to me. Bullet points would be perfect!

Thanks in advance, Lama

$\endgroup$
4
  • 2
    $\begingroup$ I'm a game developer and I need to write a solar system simulation. Unfortunately I'm not very good at math , that's really surprising to me :-) $\endgroup$
    – Abhijit
    Mar 18, 2013 at 17:47
  • $\begingroup$ Runge-Kutta basically computes integration numerically. Let's forget the solar system, do you know how to implement a two celestial body simulation? $\endgroup$
    – Shuhao Cao
    Mar 18, 2013 at 17:56
  • $\begingroup$ Related question on stackoverflow.com: Runge-Kutta (RK4) integration for game physics $\endgroup$
    – GEL
    Mar 18, 2013 at 18:17
  • $\begingroup$ Abhijit: Game development doesn't usually require a deep knowledge of math, I got by just by searching for solutions of other people, and most of the others do so as well. ShuhaoCao: There's little difference between simulating 2 or 5000 bodies if I don't know how to keep my orbits stable. lewellen: I saw that earlier, and it's the most understandable explanation I saw so far, but there are too many technical terms and everything is explained in a too generic way. $\endgroup$
    – Lama
    Mar 18, 2013 at 18:46

1 Answer 1

1
$\begingroup$

The Euler stepping is first order, which means it will be exact (up to roundoff) if the values are linear functions. The usual Runge-Kutta algorithm (there is a whole family) is fourth order, so is exact for fourth degree solutions. It also means that if you cut the stepsize in half, the error usually decreases by a factor 16.

It is much easier to use a library routine. They have worked hard on adaptive control of stepsize to give you the accuracy you want with as few steps as possible as well as eliminating numeric errors.

$\endgroup$
1
  • $\begingroup$ Do you know any of them written in Java? $\endgroup$
    – Lama
    Mar 18, 2013 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.