I posted this question on the physics page but decided it might be best if I post it here instead as it may be a more astronomy related question. I also haven't received any answers over there so far so I might as well give it a try here!

I have recently been playing a lot of a game called “Space Engine” and found a planet of interest. The planet is in a binary star system and it raised a few questions in my mind:

How could one calculate eclipses on a planet like this one, Where the planet has one moon, and orbits two stars?

More Info:

Every so often--roughly every 5 years--the moon (this planet has a single moon) is in a position to cause a partial eclipse on the planet (ie blocking only one star). If you’re lucky, you may even witness a total eclipse where both stars are blocked. A full Synodic period for this planet is almost 11 years. Sadly, I have yet to find a method to find out when such anomalies will occur next which is why I am here.

As of now, I know that eclipses occur roughly every 5 years. I do not know the month or the day or if there will be a total eclipse where both stars are blocked in a given year.

So far, I used this page To find the Saros period. Unfortunately, my calculations were off (can this page even be used for a double star system?). These sets of equations are also geared towards a moon that is on the same orbital plane as our moon which is not the case at all with this fictional moon and system.

A picture is worth 1,000 words so I will provide one here rather than further describe the star orbit:

Star orbit

SO, after all that, I will repeat my questions so there is no confusion:

1: Is there a way to calculate when eclipses will happen in this star system?

2: Is there a way to calculate if it will be a total eclipse (given the positions of the stars, center of mass etc.)?

Any help would be greatly appreciated :)

I can provide any more information that is needed. The game is quite advanced; orbits are simulated and so is gravity. From what I can tell this is “as close as it gets” for a video game. Information regarding the orbits, masses, gravity, velocity and everything in between can be found within the game and provided here.

Nonetheless, I want to know how to do this just for fun even if it can’t be predicted within the game

Here is the wiki pages for the game:

*https://en.wikipedia.org/wiki/SpaceEngine (wiki page)

https://se-database.fandom.com/wiki/Space_Engine_Database (planetary database)

http://spaceengine.org/ (main website)*

Once again thank you in advance :))

As a side note: I am referring to a solar eclipse that can be seen on the surface of this planet where one or both stars are blocked by the moon that orbits


The planet orbits both stars. As do the other planets

Here is some more information regarding the system and the planets. There is a rather large Neptune like planet nearby which could be affecting the planet if this is something that needs to be taken into consideration. Below are some more images/gif animations to show the system in more detail. I will also provide some more details about the planet's inclination, diameter, mass, distances, etc. I will also provide the same details for the moon in question and the nearby Neptune like planet. The moon also appears to be affecting the orbit of the planet! Because of this, the planet has a slight wobble which is also shown below

Planet Orbit (Planet orbit is highlighted in pink; the nearby Neptune planet is the next orbit):

Planet Orbit:

Planet Wobble (most likely because of moon orbiting close by, its mass is is about half of the moon's but it is much closer at a distance of 83,799 km or 52,070 mi):

enter image description here

Moon Orbit Showing Eclipse (as mentioned before, every 5 or 6 years the moon goes through a cycle of eclipses blocking each star roughly 5 times depending on their positions):

enter image description here

Planet Data (gathered from game):

Inclination: -1 degree

Orbital Period: 10.802 years

Pericenter/Apocenter: 8.7571 AU/10.0095 AU

Mass: 0.16163 M⊕

Moon Data:

Inclination: 0 degrees

Orbital Period: 7.205

Diameter: 2,556 km or 1,588 mi

Mass: 0.55884 Lunar Mass or 0.00687 M⊕

Distance to Planet: 83,799 km or 52,070 mi

Neptune Planet Data:

Inclination: 0 degrees

Orbital Period: 7.205

Mass: 13.569 M⊕

Diameter: 361,859 km or 224,849 mi

Orbital Period: 15.481 years

Pericenter/Apocenter:11.0257 AU/12.8287 AU

Distance to Planet: 15.37 AU

Hill/Sphere of Influence: 0.14 AU/0.10 AU

This is just to give an idea of what this system is like. There are many planets in it but the closest is the Neptune like planet. Who knows if this problem is even solvable....

We can also say that the game uses Keplerian orbits for simplicity; although this page (http://spaceengine.org/news/blog180817/) has a quote that confuses me slightly:

Previously, SpaceEngine used Kepler orbits – they are a good approximation of the motion of a planet around the Sun (or of a moon around a planet) without any perturbations. But the real Solar system is not so simple, we have multiple planets and moons which pull each other with their gravity.

I think this can be ignored for simplicity sake because it is more talking about our solar system not this procedurally generated one. Additionally, I am not sure that the engine is advanced enough to simulate exact orbits

  • 3
    $\begingroup$ Wow, this game is a charm! Anyway, from the picture I can't understand whether the planet is orbiting just one star, or is orbiting both of them. I think that a general method to calculate eclipses in a binary system could be very complicated. Maybe you could describe better the configuration of the planets and the stars, to narrow down the problem $\endgroup$
    – Prallax
    Aug 5, 2021 at 18:08
  • 1
    $\begingroup$ Nice things to know would be if the orbit of the planet is inclined with respect to the stars orbit; if the moon is big enough to have a non-negligible gravitational influence on the motion of the planet; if the orbit of the moon is inclined as well; if there are other planets that could influence the system (like a very close jupiter)... any additional information would be helpful $\endgroup$
    – Prallax
    Aug 5, 2021 at 18:12
  • 2
    $\begingroup$ Thinking about it some more, I came to the conclusion that probably there is no nice formula to calculate the eclipses on a binary system. I'd love to be proven wrong, though. Normally I'd try and do a simulation, to resolve the issue, at least numerically. But since spaceengine is already a simulation, it would be rather pointless in this case. $\endgroup$
    – Prallax
    Aug 5, 2021 at 19:12
  • 1
    $\begingroup$ @Parallax, this is what I feared. Regardless, I have updated the post to include some more information about the system if anyone has a slightest clue about where to begin. Thank you for your comment :) $\endgroup$
    – Linus
    Aug 5, 2021 at 20:12
  • 1
    $\begingroup$ @linus Is the planet supposed to be habitable? I find it hard to believe that the circumsteller habitable zone of two stars (low mas enough to have a habtable planet) could extend that far out. I note you didn't describe the characteristis of the stars from the game. Their diameters will determine whether the moon with its diameter and distance will be able to fully eclipse them. $\endgroup$ Aug 7, 2021 at 19:34

2 Answers 2


There isn't a general closed form solution for the n-body problem for n>2, so a general solution to this problem can't be given without additional constraints on the problem. Does the planet orbit both stars in a close binary system from far away? Or does the planet orbit only one of the stars in a wide binary system? Can we consider the orbits to be Keplerian for a good enough approximation?

If we have an engine that gives us the positions of the bodies at any time, we can perform a numerical solution as follows. Given the positions $\vec{p}_s$ of a star, an observer $\vec{p}_p$, and a moon $\vec{p}_m$ at any particular time $t$,

enter image description here

the apparent angular radius of the moon in the sky as observed from the planet is $$\theta_m = \sin^{-1}\biggl(\dfrac{r_m}{|\vec{p}_m-\vec{p}_p|}\biggr)$$ where $r_m$ is the radius of the moon. Similarly, the apparent angular radius of a star as observed from the planet is $$\theta_s = \sin^{-1}\biggl(\dfrac{r_s}{|\vec{p}_s-\vec{p}_p|}\biggr)$$ where $r_s$ is the radius of the star.

It should be clear that the only way a total stellar eclipse is possible is if $\theta_m \geq \theta_s$.

To obtain the angular separation $\alpha$ between the center of the star and the center of the moon in the sky as observed from the planet, we start with the definition of the vector dot product: $A \cdot B = |A||B|\cos(\alpha)$, and solve for $\alpha$ to get $$\alpha = \cos^{-1}\biggl(\frac{A \cdot B}{|A||B|}\biggr) $$

Here, $A = \vec{p}_m-\vec{p}_p$, and $B = \vec{p}_s-\vec{p}_p$ are vectors to the star and moon from the observer rather than the reference system origin.

If $\theta_m+\theta_s \geq \alpha$, then an eclipse is occurring at time $t$. In addition, if $\theta_m \geq \theta_s+\alpha$ a total eclipse is occurring.


  1. This is a solution for only a single star for simplicity. For additional stars the same above equations can be used.

  2. How do you choose the right value of $t$ to correspond to the time of eclipses when you don't know when the eclipse will occur? Try many values of $t$ in a loop with small increments. Where values of $\alpha$ are small, try even smaller increments of $t$ over smaller intervals.

  • $\begingroup$ Thank you for your detailed response! The planet does in fact orbit both stars and I have updated the post to include more information regarding the system if this gives you further insights. For now, this is the closest answer I have so thank you! $\endgroup$
    – Linus
    Aug 5, 2021 at 20:12

I agree with @ConnorGarcia's answer that numerical solutions are the only practical way to go here.

Further evidence can be found in the following paragraph from the site's webpage which was noted in the question.

In fact, noticing this bit and pointing it out was a great call; it's really the gateway to understanding what's going on here!

Over the past month I have worked on planet ephemerides1. They are data tables and pieces of code, which provide the precise positions and velocities of the Solar system’s planets and moons at a given moment in time. Previously, SpaceEngine used Kepler orbits – they are a good approximation of the motion of a planet around the Sun (or of a moon around a planet) without any perturbations. But the real Solar system is not so simple, we have multiple planets and moons which pull each other with their gravity. This perturbs their orbits, making the Keplerian solution inaccurate. The most significant perturbations are applied to the moons, as you can see on the video below – their orbits precess and wobble.

I'm pretty sure this means that the author got a numerical integrator (a library function or bit of standard code), put some starting positions, velocities and directions (state vectors) into it and let it run for a few hundred "years" or "centuries".

What does "data tables and pieces of code" mean?

They produced an ephemeris (one or more) which is a data table of positions (and sometimes other parameters) at a large number of points in time. They also provided interpolators or "pieces of code" that you would give a series of time points to, and it would look up the closest time values in the ephemeris and interpolate between the fixed points of the table.

Many astronomical ephemerides contain the positions and interpolation coefficients to make the interpolation more accurate. NASA Jet Propulsion Laboratory's Development Ephemerides are a wonderful and well-known example. It's not important here, but they use a custom-defined implementation of Chebychev polynomials that even out the residual interpolation error along the trajectory.

In order to obtain eclipses, one would simply apply some kind of "potential eclipse detector" or generalized event detector to the problem.

You would scan the ephemeris table and look for regions where the Sun-planet-moon angle is small. This is shown in @ConnorGarcia's answer.

But.. HOW???

If you can't get the ephemeris that's used inside the game/model, then try to make one for yourself.

Run the game for a century or millennium and output x, y, z positions for the stars, planet and moon, or if that's not possible, output the star-planet-moon angle for each star.

Then calculate those vectors and look for local minima. Easiest way is to caclulate the changes in angle from one time point to the next. You've found a minimum or at least inflection point if you multiply two adjacent changes together and the product is either zero or negative.

In Python, that would be:

d_theta = theta[1:] - theta[:-1]
dd_theta = d_theta[1:] * d_theta[:-1]
inflections_and_minima = dd__theta <= 0

It's tempting to use < instead of <= but there's an extremely tiny chance that two points could straddle a minimum leading to an accidental 0.

1How to pronounce “Ephemerides”? hint: it's not eee-FEM-er-IDES.

  • $\begingroup$ Thank you! Currently I’m working out an answer with what was suggest by you and other comments as well as papers regarding orbits!! Unfortunately, there is not easy way to gather x, y, z coordinates from space engine. The cfg files show coordinates relative to the barycenter but I can’t figure out what units they are in. When comparing my calculations of star positions my numbers seem wildly off from what is seen in the files. In game, RA/Dec/Dist is used which is rather annoying…as of now I’ve emailed the developer to get some answers regarding the x, y, z coordinates $\endgroup$
    – Linus
    Aug 8, 2021 at 20:15
  • $\begingroup$ It’s also my understanding that Kepler mechanics are used for systems procedurally generated $\endgroup$
    – Linus
    Aug 8, 2021 at 20:24
  • 1
    $\begingroup$ I will probably post another question here soon regarding calculating positions of binary stars in their relative orbits. I can't find good information on how to calculate this and I want to be sure my calculations are correct before going any further. A link to my code so far can be found here: (github.com/Libnus/Orbit_Calculations) if you are interested (the positions of the stars are being calculated but are off because it's a two body problem thus the calculations are wrong :/) $\endgroup$
    – Linus
    Aug 10, 2021 at 18:30
  • 1
    $\begingroup$ Thank you for your continued help and advise, I just made the changes you suggested (a_in_meters was supposed to be written obviously) :) I see that numpy is an extremely powerful tool, still only just learning python so thank you! I have also done the calculations on paper with simpler systems but when I do calculations for the binary star system my values are still off. I am not exactly sure what is going on here. The code also works for these simpler systems. I used calculations for our solar system and another procedurally generated one from Space engine and it was correct... $\endgroup$
    – Linus
    Aug 11, 2021 at 16:08
  • 1
    $\begingroup$ One thought related to @uhoh and the importance of reduced units, as this is an ugly n-body problem that you forced to do a step-wise MD type simulation to find the positions, is that if your units you're using result in wildly different values (say one unit is very large, say 5.5^15, but another is very small, 5.5^-15, using floats to do the calculations, is that you will absolutely get huge roundoff errors. Using reduced units, so that all the variables in your calculation have similiar order of magnitude will avoid that. $\endgroup$
    – Richard
    Nov 10, 2021 at 18:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .