Sign in to follow this  
English Mobster

[0.25] Kerbal Warp Drive! Procedural systems from a seed you choose! v1.1.0, 16 Nov.

Recommended Posts

Latest release: 1.1.0

Release date: 16 November 2014

A few days ago on the KSP subreddit, /u/SuperSeniorComicGuy made a post wishing for a "Hyperdrive" part to procedurally generate star systems from a seed, a la Minecraft.

I've done what I can to make that dream a reality. What this is, basically, is a mod which gives a "Warp Drive" part in the Utility section of the editor.

p2dY0xa.jpg

Take the warp drive into solar orbit and right-click on it to access the warp drive menu.

HhnpB9u.jpg

This will prompt you to enter hyperspace coordinates -- you can type anything in here and it will get converted to a random seed.

YMCbscD.jpg

This seed will be used to randomize the solar system. To return to Kerbol, simply type "0" (without quotes) as a seed or use the new right-click action which pops up when you leave the Kerbol system.

This seed will generate the same solar system every time (unless I break compatibility with an update, which may happen). You can fly around this new solar system and explore something entirely new.

Here's a list of what is randomized at present:

Atmospheres:

  • Atmosphere (does a body have one?)
  • Oxygen (does a body have it?)
  • Atmosphere Height
  • Atmosphere Color
  • Atmosphere Pressure

General Planet Stuff:

  • Gravity
  • Temperature
  • Names

Orbits:


  • Reference Bodies (former moons may now orbit the sun, and former planets may orbit other planets)
  • Semi-Major Axis
  • Eccentricity
  • Inclination
  • Longitude Ascending Node
  • Rotation (how long a day is)
  • Period (how long a year is)
  • Sphere of Influence (presently unrelated to the size of the body -- this may change)

Ideally, I would like for terrain randomization based off of a noise function, but that is for a later date. Right now, even old planets feel brand-new. No longer can you rely on a 70 KM-high atmosphere for Kerbin (or any atmosphere at all!). Minmus can now be orbiting the sun, and Kerbin can be found in orbit around Eve.

Any craft you put into orbit around one system will still be there even if you leave and come back! Each system gets its own dedicated persistence file, so you can establish extra-solar colonies around distant exoplanets while still maintaining your main operations around Kerbol.

Right now, the star of a system is renamed based on a random name generator. The closest planet to that star is renamed <star> b, the second-closest <star> c, etc. Any moons in orbit around a planet get roman numerals added to them to tell them apart.

In the next major update, likely, I will give the user the ability to rename any body you orbit around. This means you can rename the star right away, but each celestial body will have its astronomical name until you enter its sphere of influence.

zKF4OJ4.png

Pvh7yNG.png

YRzDnog.png

.

Binary planet systems this close together have been made significantly less likely in the newest version (sorry!) due to issues involving SOI transfers, but it is still possible to have one.

Here's a (totally not cheat-y) album of images from a launch on the release version, using seed "123". Remember that the seed is generated based on what characters you enter -- they need not be just numbers!

Feel free to contribute on Github! Everything is released under the GNU license.

If you encounter any other issues, file a ticket here so that I'm able to track it properly and resolve it.

Changelog:


[B]1.1.0[/B]
[B]Features[/B]
Added craft persistence between solar systems.
Updated cost and science requirement for Hyperdrive part.
Automatically return to Kerbol when "Return to Space Center" is clicked, leaving your craft in orbit around the other system.

[B]Tweaks[/B]
Changed some randomization features to use a normal distribution.
Improved performance of RNG (thanks, paul23!)

[B]1.0.0[/B]
Initial release.

Here's a wishlist of features I'd like to add eventually, (roughly) in order of priority:

  • Name your own planets
  • Custom contracts for different systems
  • Custom model/Science requirement for Warp Drive
  • Procedurally-generated terrain for planets
  • View a "starmap" that allows you to warp to nearby stars without needing to remember a seed.

Enjoy!

If you want to donate, please take the money you would spend on a donation to me and give it to Child's Play or my local children's hosptial. I have a steady job working at Disneyland, and although the pay isn't the best, I get by. Those charities could use donations a lot more than I do.

Edited by English Mobster
1.1.0 release!

Share this post


Link to post
Share on other sites
This has potential.

My thoughts exactly! If this could be used with mods that add new planets I will play more KSP for way longer than I thought I would! Unlimited stuff to do!

Share this post


Link to post
Share on other sites

YES!

YES!

YES!

THIS IS THE BEST MOD I HAVE SEEN IN MONTHS!

I APPROVE SO HARD!

Alright, I'm a little excited. But, really, this is awesome. Like space engine...but KSP! :D

Share this post


Link to post
Share on other sites
What if this was combined with interstellar lite?? Just sayin'

The Interstellar devs would need to get in contact with me, or vice versa. Any integration would have to be on their end, since I just provide a PartModule for them to hook into. They would need to modify the part itself.

This has potential.

Is it possible to if you could combine this with Planet Factory?

That isn't being updated anymore, is it? I can try it. I did do a cursory glance at it when I first started out to see if they did something similar, but it looks like they have custom .cfg files that govern settings about planets.

Edited by English Mobster

Share this post


Link to post
Share on other sites

Looks just... wow.

One question, though: are these systems persistent? I.e. if vessel warped to system X, can I then return to Kerbol system, launch another vessel, warp it to system X and find my first vessel where I left it?

Share this post


Link to post
Share on other sites

THIS IS AWESOME!!!

Is there any way to do two things - 1) make it use a resource, 2) require a min or max distance from the sun? Maybe you have to go very close to a star or very far from it to use the drive.

Share this post


Link to post
Share on other sites

Procedural Generation of Planetary Surfaces would be more complex than just PQS. It would also mean having remade on-the-fly scaledspace meshes for planets.

Share this post


Link to post
Share on other sites
The Interstellar devs would need to get in contact with me, or vice versa. Any integration would have to be on their end, since I just provide a PartModule for them to hook into. They would need to modify the part itself.

That isn't being updated anymore, is it? I can try it. I did do a cursory glance at it when I first started out to see if they did something similar, but it looks like they have custom .cfg files that govern settings about planets.

My dream for this mod.

Once you're in Solar Orbit, you have to set seed on a Navigation Computer, then you have to point at a seed-based "randomly" generated maneuver node and activate the warp drive. Then you'd get a loading screen/Game freeze while the seed is being generated (or, perhaps it's while the ships scanners map the system :P). Textures, Terrain, and ScaledSpace meshes would probably be saved for only two or three systems at a time, so you could warp back and forth from two systems without regenerating the textures and terrain.

Edited by GregroxMun

Share this post


Link to post
Share on other sites

Bug report: Returning to Kerbol while orbiting Duna that is orbiting Kerbin.

5AfBpGS.png

The line for Duna's orbit is where it should be, but Duna continues to orbit Kerbin above it's SOI, until the spacecraft leaves the SOI of Duna and Duna snaps back to it's orbit. And the orbit of the spacecraft itself is pretty darn weird as well (perhaps just due to Floating Point errors, as I was on high timewarp when Duna snapped back, but perhaps not)

IIWDJxO.png

Also, a minor bug is that orbits can have apoapsises that are above the SOI of the planet. This is actually pretty cool though.

Share this post


Link to post
Share on other sites

Woah... This is going to be the Next Big Thing. I'm sure of it. In it's current state, I'm not sure how much use I'll get out of it (as there's still planets in the Kerbol system I haven't visited), but... Woah. I'm not much concerned with naming the planetary systems or seeing a colony module made by you (as a priority, that is), but I would love to see randomly generated terrain.

When I first saw this, I was reminded of Krag's Planet Creator and how it used a text-based system to generate the planets. I won't pretend I know remotely enough to make a legitimate suggestion, but it makes me wonder whether it's possible to combine a similar system with your mod here. Or, at the least, have a way for people to create planets and add them to a pool that contributes to the randomly generated systems.

Regardless of any criticism that you might read in the above paragraphs, and I assure you none is intended, I want to reassert the fact that this is FRIGGIN' AWESOME! I cannot wait to see where this project goes; stick with it!

Share this post


Link to post
Share on other sites

This looks like an amazing start! Would it be possible to change the appearance (at least color) of planets from orbit so it's not so clear they're duplicates of the Kerbol planets?

Share this post


Link to post
Share on other sites
Looks just... wow.

One question, though: are these systems persistent? I.e. if vessel warped to system X, can I then return to Kerbol system, launch another vessel, warp it to system X and find my first vessel where I left it?

At the moment, all that happens is the stuff in the Kerbol system is rearranged. All orbits are left intact -- if you have a station orbiting the Mun at 100,000 meters, that vessel will always be in orbit at that height, even in alternate systems.

In 1.1 or 1.2, I'll likely do something about the persistence file to make it system-specific. But right now, all vessels in a system will orbit whatever body you parked them at in every other system. Hopefully I explained that correctly.

As for the bug report, I'll take a look at it once I get home. At the moment, I'm on break at work, so I can't take that close of a look at it. I'm not happy at the moment with how SOIs are handled, but if I kept tweaking it I would never release.

Share this post


Link to post
Share on other sites

here we go...

First, everything hinges on planetary generation, using Perlin Noise or something. Good luck. If you accomplish that then....well....KSP explodes!

1. Distance Scalar: Add that to your seed. Lock out people (us) from modifying the system seed, and use Fibonacci sequence or something as the seed to generate your systems. Then, add a distance scalar to the different systems. Remove the seed input from your warp engines, instead enter coordinates for the system. If your warp drive can reach the system, you go there and Fibonacci(for example) generates the system for you.

This would make your mod, and KSP in general, into a Star Control type map. Would work online, since everyone would have the same seed generators. The distance scalar, to determine 'location', can be based off different things. You can use another procedural seed to populate the universe.

Polar coordinates for the system's location relative to each other, with Kerbol in the center, would be most realistic, but would have laaaaarge coordinates eventually, unless you capped the maximums initially. And you would have to make sure you can reach the different systems some how, and we don't hit dead ends and are unable to jump further.

An X-Y-Z coordinates would work, but would make the universe look like a giant rubic's cube, with Kerbol being in the center, and each system being a different cube radiating outward.

Or a vector system, with lines branching off from Kerbol SOI. Kinda like a starfish (Kerbol) with the lines radiating out to other starfishes(systems). Would work but overlap and the connection of nodes might be a problem with different systems that generate close to each other.

So...now we have a galaxy map! By just adding a distance scalar to your seed generation.

other things for flavor:

2. Different warp drives that can be unlocked for different distances.

3. Put the warp activation tied to a maneuver node, so an intrepid modder can add a 'black hole' effect for your ship to fly into lol.

4. Make activation of warp be outside the soi of the systems sun. For multiplayer

5. Make warp drives use a resource that is a pain to refine(He3 or whatever). But have a few systems that have it in abundance...which leads to supply routes and commerce.

6. Make the distance/connection information available in a raster form, to make maps.

7. Include a way to find out information about the systems we explore. For instance, you enter a new system, launch probes, and they give information(atmosphere/gravity/delta-v requirements/etc) on the different planets so you can decide which ones look interesting to explore...or exploit for resources.

8. Multiplayer. Man, if you could transfer funds for different resources, it would create a crazy thing. People would be heading out to different systems for 3 main reason: Explore, Exploit, or Exterminate. Craziness would commence!

Edited by bigbadben
added: seed, polar, rubics

Share this post


Link to post
Share on other sites

On the no 8.

It should be 4X: eXplore, eXpand, eXploit, and eXterminate

Share this post


Link to post
Share on other sites

I agree with previous posters, if this gets fully fleshed out you are talking about near infinite content in multiplayer. Which would carry this game into the realm of minecraft amounts of THINGS to do.

Share this post


Link to post
Share on other sites

Hey I'd like to help developing with this; as it has been on my mind for a long time. By any chance do you actually make sure sphere of influences do not collide (or even planetary bodies?)? I wonder what KSP will do when you let the sphere's collide, will the "body orbiting around" be based on the body you originate from, or will it look "which one is closer?". In the former case this would lead to buggy gaming: the "orbit" one follows, from the exact same position, time and speed can then be different for 2 objects.

Share this post


Link to post
Share on other sites

If he achieves what I think he might, this plus MKS and other assorted mods plus RPM and maybe Interstellar would be literally all I wanted from KSP and that would be amazing fantastical, please don't let this mod die! I will be severely disappointed if I don't get to play this in all of its fully realized glory. Possibly also consider making Binary/Triple/Quadruple/Quintuple/Sextuple/Septuple systems.

Share this post


Link to post
Share on other sites
If he achieves what I think he might, this plus MKS and other assorted mods plus RPM and maybe Interstellar would be literally all I wanted from KSP and that would be amazing fantastical, please don't let this mod die! I will be severely disappointed if I don't get to play this in all of its fully realized glory. Possibly also consider making Binary/Triple/Quadruple/Quintuple/Sextuple/Septuple systems.

I will do my best to continue supporting this mod until I am happy with the feature list. At the very least I'm going to continue working on it until all the items on my wishlist are finished. I may add a few more as I go along as well.

As for binary systems, they won't be "true" binary systems in that each star is orbiting the other. I'm going to try to duplicate the sun soon and see if I can make a binary system, but I have no guarantee that it will work.

Bug report: Returning to Kerbol while orbiting Duna that is orbiting Kerbin.

<snip>

The line for Duna's orbit is where it should be, but Duna continues to orbit Kerbin above it's SOI, until the spacecraft leaves the SOI of Duna and Duna snaps back to it's orbit. And the orbit of the spacecraft itself is pretty darn weird as well (perhaps just due to Floating Point errors, as I was on high timewarp when Duna snapped back, but perhaps not)

<snip>

Also, a minor bug is that orbits can have apoapsises that are above the SOI of the planet. This is actually pretty cool though.

Hmm. So from what I'm understanding is Duna's position in the map view moves away from the given line? That seems like a weird bug. Can you give me the seed you used so I can test it for myself and see if I can replicate it?

This looks like an amazing start! Would it be possible to change the appearance (at least color) of planets from orbit so it's not so clear they're duplicates of the Kerbol planets?

I can change the orbit color on the map view, and I think I can also change the color of a planet's surface. However, I would need to play around with planets a bit more first. I'm trying to resize planets and it is proving more difficult than I realized. I looked at what the Real Solar System mod uses and it seems to modify a PQS class attached to a body, but there is zero documentation I can find about what the PQS class does or how it affects a body. It's going to require some experimentation.

Hey I'd like to help developing with this; as it has been on my mind for a long time. By any chance do you actually make sure sphere of influences do not collide (or even planetary bodies?)? I wonder what KSP will do when you let the sphere's collide, will the "body orbiting around" be based on the body you originate from, or will it look "which one is closer?". In the former case this would lead to buggy gaming: the "orbit" one follows, from the exact same position, time and speed can then be different for 2 objects.

I'll be honest and say I'm not sure exactly how KSP's SOI works. My understanding is that moons are still within a planet's SOI, and KSP uses the "closer" body. That's why you don't enter solar orbit when trying to get to the Mun.

I don't presently have a check to make sure that a moon's SOI does not intersect with another planet due to this idea. However, I could be completely wrong, at which point I'll have to add a check.

I do, however, check to make sure planets don't collide. When a moon is put into orbit, I check to see if the radius of the moon would intersect the atmosphere of the planet. If it does, I move the semi-major axis of the moon out until that is no longer true. At that point, I check any other child bodies orbiting the same planet and make sure that none of the orbits intersect.

Share this post


Link to post
Share on other sites

It works as advertized, but I seem to be getting an awful lot of random atmospheres with an asl pressure of zero, a scale height of zero, and an asl temperature of zero.

Share this post


Link to post
Share on other sites

Very interesting proof of concept. Not developed enough yet for me to want to try integrating it into a serious save game but lots of potential. I'll definitely keep an eye on this for the future though.

I hope your able to get persistance going for different systems though. As it stands it would be bad if you had a station in a nice stable 50km orbit over mun and then jumped to a new system where mun had an atmosphere that goes up to 100km. It would also be bad if say an eve anolog was orbiting mun and its SOI swept up anything thats in orbit into its own SOI.

You might also consider a check beyond just makeing sure the orbiting planet does not impact the atmosphere of the parent but also so the SOI does not. otherwise low orbits are impossible around the parent

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this