Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Tutorial: How to create a Binary Planet System using Planety

From Kerbal Space Program 2 Modding Wiki

Setting up a binary planet in KSP2 is relatively simple. This tutorial will teach you how to easily set up one using Planety and good ol' orbital physics.

Prerequisites

There are a few things you'll need before we begin. First, you'll need to install the Planety. If you have never worked with Planety before, it may be a good idea to also download its companion tutorial planet, Aktiko.

You will also need a heightmap and albedo map (color map) for each body in your binary system. You can easily make these yourself using a drawing program like GIMP. See the Aktiko tutorial mod for more info on how to do this.

Basics

To get started, create two terrestrial bodies (body A and body B) in your .planety file that have a similar radius and surface_gravity. They don't need to be exactly the same, but the larger the difference the more unrealistic your binary system will be. Next, create a third terrestrial body with a radius of 1 and a random large surface_gravity (for example 100,000), but do not assign a height- or albedo map to it. This body will serve as the barycenter of your binary system. Place the three bodies in whatever orbit you want, then save the file and copy your planet mod folder into C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program 2\Planety

Open KSP2, click 'Start a new campaign' and make sure the checkbox next to your mod's name is enabled in the Planety Settings. Once you're in the game, open the tracking station and go to your custom planets. In the Information Panel on the right, under 'Physical Characteristics', note the mass of each body.

We will now use a clever trick to find out what the surface_gravity of the barycenter should be. The value you input for its surface gravity should result in a mass equal to the sum of the masses of the two celestial bodies in your binary system. Since we already know the resulting mass using the random surface_gravity you assigned to the barycenter earlier, we can determine the actual value using a little math (be careful the masses are given in the same unit!)

surface_gravitybarycenter = [(massbody_A + massbody_B)/massrandom_barycenter] x surface_gravityrandom_barycenter

plug this value intosurface_gravity for the barycenter in the .planety file. You can now set the barycenter as the orbital parent (around:) for body A and body B. To set up their binary orbit, we'll have to assign some orbital parameters. Make sure both bodies have the exact same semi-major axis! Even a minor difference will cause the two bodies to drift over time. The semi-major axis can be whatever you want, just make sure it doesnt put the planets outside the SOI of the barycenter (you can check this under 'physical characteristics' for the barycenter in the tracking station ingame). The final step is giving one of the two bodies a mean_argument_at_epoch of pi (you can also just use 3.14). Leave all other orbital parameters set to 0 for now.

Save the .planety file again and copy the mod folder into the Planety folder in the game directory. You can now open the campaign you made earlier in KSP2, and you should hopefully be greeted by a perfect binary system in the tracking station!

Advanced

If you think a perfect circular binary orbit is boring, we can add some eccentricity to the orbit of the bodies to spice things up. This is rather easy to set up: you just need to assign each body an identical but opposite eccentricity value in the .planety file (for example, 0.4 and -0.4). This will result in the bodies speeding up when they're close to eachother and slowing down when further appart.

Tertiary Systems (and beyond)

If you're for some reason not satisfied with having just two bodies in the system, there are a few options to add more. you can choose or combine any of the options below:

Planets in orbit around binaries

This is the easiest method of adding more planets. Create a binary system like before, but add a third planet orbiting the barycenter. The farther out the planet orbits, the more realistic.

Binaries with Moons

Another option is to simply add a moon(s) to one or both of the binary bodies. This is not truly a Tertiary system, but is still makes for a neat effect. Be carefull when adding large moons however; to maintain some semblance of realism you'll have to make sure the total mass within the SOIs of the binary bodies stays balanced. Massbody_A = massbody_B + massbody_B_moon

Binaries with Binary Moons

If you want to take the Binaries with Moons option to the next level, you can turn one of the two bodies (or both) into a binary itself. You start by setting up a binary system as before, but set the barycenter of another binary system as one of its two bodies. As before, you will need to balance out the mass:

massbody_A = massbarycenter_B

Stable Triplets

It is technically possible to have 3 planets orbiting the barycenter at similar orbital height. To achieve this, give the first body an argument_of_periapsis of 0, the second an argument_of_periapsis of 120, and the third an argument_of_periapsis of 240. make sure each body has the same eccentricity and semi-major_axis. Leave all other orbital parameters at 0.

Chaotic Triplets

If you really want something crazy, you can attempt to set up three (or more, if you're really brave) bodies that interchangably orbit eachother. This requires two of the bodies to have a period that is the cubed root of the power of 2 of that of the third body's (derived from Keplers first law). Start by setting up a Stable Triplet, then multiply the semi-major axis of two of the bodies by 1.58740105. This will also increase the periapsis, which we dont want, so we'll need to change the eccentricity to make up for it. Periapsis height is given by a(e-1) with a the semi-major axis and e the eccentricity. To calculate the new eccentricity, use this formula:

enew = [aold x (eold - 1) / anew] + 1

plug this into the eccentricity for the two bodies. Finally, set the mean_anomaly_at_epoch value for one of the two to pi (3.14). In theory, you should be left with a chaotic but gravitationally bound dance of the 3 bodies. Warning: do not try in real life.

Limitations and Known Issues

Binary systems are all fun and games, but at the end of the day you're still trying to simulate N-body physics in KSP2's stock 2-body physics simulation. This results in some limitations of what you can and cant do, and ofcourse some bugs.

Issue 1: This method can only simulate identical-mass binary systems

In real life, the barycenter is a slightly more complex phenomenon than the one we set up in the game. The barycenter is esentially a point in space that represents the center of mass of the two bodies. Both bodies orbit this point at a distance determined by their mass relationship. This is possible because they each 'see' the barycenter as having a different mass: the larger body sees it as as having the mass of the smaller body, and the smaller body sees it as having the mass of the larger body. This allows them to have the same orbital period despite being at different distances from the barycenter. Since there is no option to set this up in KSP2, the fake barycenter method is only useful for bodies that have the exact same orbital period- or in other words, similar mass.

you could theoretically solve this by adding 2 barycenters instead of one and having each planet orbit its respective one, but that would come with a host of other challenges- if it doesn't just straight up crash the game.

Issue 2: Overlapping SOIs

In some binary systems you'll end up with (temporary) overlap between the SOIs of the two binary bodies. This is more common with bodies that orbit at a low distance from the barycenter or are highly eccentric. In real life this would cause all sorts of n-body interactions, but in KSP2 the game just keeps you in the SOI you entered first, thrus completely ignoring the effect of the other planet on your spacecraft.

Issue 3: Vessels become uncontrolable in the Barycenter's SOI

For some reason, vessels sometimes become completely uncontrollable by any means when entering the SOI of the barycenter from the SOI of one of the orbiting bodies. No input will register, including engine burns. This may be caused by the extremely small radius and subsequent stupidly high surface gravity of the barycenter, in which case it can possibly be solved by increasing the radius and decreasing the surface gravity, but this is untested. another potential fix is the abandonment of a radius altogether (resulting in a singularity), but this would require Planety to allow the direct input of mass rather than surface gravity. I'm not sure if the game can even handle this.