I need to figure out how to calculate the orbit of an object around one or more bodies for a game that I am making (built on Cocos2D-Swift). The game is in two dimensions, so it's a two-dimensional orbit I am calculating. I currently have it set up so that, in the update loop, it calculates the force of each of the bodies on the object, the acceleration due to that force, and the change in velocity due to that acceleration. This would probably work fine if I were going through the update loop a thousand times per second, but on the iPhone 6+ simulator, I'm going through it approximately thirty times per second, which is a discretization so wide that it makes the orbit of the object very unstable.
As a result, I am looking for an equation that tells me the position of the orbiting object as a function of time; therefore, the force, acceleration, and velocity are not discretized, so the simulation is accurate. An example of what I am looking for is how Kerbal Space Program calculates the orbital paths ahead of time. Any thoughts? Thanks.