Whether you're talking about Magrathea, Tattooine or Gallifrey, Earth's favourite alien life-forms frequently come from planets with two suns. But the likelihood is that those planets actually ended up orbiting two stars after being made somewhere else entirely.

Boffins have often wondered just how planets can be formed in orbit around two stars since the gravitational pull from the suns should tear the worlds apart or grind them down in destructive collisions with other bits of space debris.

A new study from the University of Bristol suggests that so-called circumbinary planets actually form far away from these extreme environments and then migrate through space to their eventual orbits.

The astroboffins used computer simulations of early planet formation to figure out the effects of gravity and collisions on the material needed to build new worlds. The simulations showed that most existing circumbinary planets, like Kepler-34(AB)b, couldn't have been made where they are now.

"Our simulations show that the circumbinary disk is a hostile environment even for large, gravitationally strong objects. Taking into account data on collisions as well as the physical growth rate of planets, we found that Kepler 34(AB)b would have struggled to grow where we find it now," said Dr Zoe Leinhardt in a statement.

The only known planet that might have been formed around its two suns is Kepler-47(AB)c, which is further from its binary stars than any other observed two-sun worlds.

"Circumbinary planets have captured the imagination of many science-fiction writers and film-makers - our research shows just how remarkable such planets are," said lead author Stefan Lines.

"Understanding more about where they form will assist future exoplanet discovery missions in the hunt for Earth-like planets in binary star systems."

The full study, "Forming circumbinary planets: N-body simulations of Kepler-34", was published in Astrophysical Journal Letters.