Jump to content

[Early development, 0.24] Kopernicus Planetary System Modifier


Recommended Posts

In response to the license terms that are preventing community maintenance of the existing planet creator mod (discussed here), I've started working on a replacement mod for KSP. I am interested in community input about what people desire in such a mod.

Planned features:

- Free software (LGPL) license

- Well-documented code

- Create the system de novo, rather than be based on copying stock planets.

- Particular attention given to supporting the Sol system.

Not part of the scope of this project:

- Extensive new planets created by me. I might create some kind of example planetary system, but it will not be very sophisticated or detailed.

- Any in-game interface other than possibly selection of which system to use.

Thanks to aftokinito, for technical input, and metaphor, for suggesting the name "Kopernicus."

At this point, I haven't done much, although I do have code for a plugin now that executes just before the default (i.e. Kerbol) system is spawned, and should be able to insert its own planetary system instead and have KSP spawn that one through the same means it would normally use to spawn the default system. (Which is, I think, the essential proof of concept for aftokinito's plan described in the other thread.)

GitHub link, for the adventurous: https://github.com/BryceSchroeder/Kopernicus

Note that this mod is NOT COMPLETE, even in a beta state; it currently just adds one planet. The released version will allow essentially arbitrary planets to be added. See the readme file for details.

Edited by BryceSchroeder
Link to comment
Share on other sites

I've never used PF. Are you talking about procedural generation of planets?

No, although that is a really cool idea (and I will try not to do things that would preclude the use of this project as a basis for such a mod).

This is intended as an open-source replacement for PlanetFactory, with a specific emphasis on supporting the needs of realism mods that replace the Kerbol system with the Sol system. (I suppose that might include procedurally generated microterrain, but first things first.)

Link to comment
Share on other sites

Now this definitely has my interest :)

Do you have any specific requests or suggestions for supporting RealSolarSystem? I used to use RSS with a configuration file that also made use of the PlanetFactory planets, but what I'd really like to see, of course, is something with all major moons and dwarf planets supported, not just a small selection. I don't yet know how feasible that is, or if KSP necessarily loads all the planet data at once (in which case the answer is probably "not very feasible," at least without overcoming that first.)

Link to comment
Share on other sites

Will this also support StarSystems?

I don't see why it wouldn't support this in the basic sense of having multiple stars orbiting, say, a black hole, and each in turn orbited by a planetary system, but I have no specific plans to do the other things that would be properly necessary to support this (deal with solar panels correctly, for example.) That said, it will be open source, and I wouldn't refuse a high-quality contributed patch adding this functionality.

Thanks for your encouragement.

Link to comment
Share on other sites

This is a dawn of a new age in KSP modding community :), everyone now finally realize license is a two sides coin and the "evil" one can be really, really a curse !

So, you're plan looks great and I really hope you'll not fall into the same pit and clearly state people can do almost what they want just in case you left one day leaving a lot's of users stuck with a license terms which prevent them to improve or even just upload your work elsewhere (as spacesport was deleted, there is no insurance the curse website will last forever).

Your planned feature doesn't include a user-friendly UI, hope you'll make something a lot more better than mere text editing like PF CE :).

Link to comment
Share on other sites

everyone now finally realize license is a two sides coin and the "evil" one can be really, really a curse

Yeah, I think many people, especially people coming mainly from the Windows world, do not understand how forking works in practice and in particular how rare it is. As for me, well, I'm only doing this because I need a mod that does this... so I really have no problem with not having tight control. I'm quite interested in collaborators. I'll be setting up a repository for the source, either when it comes time to release or when someone seriously wants to collaborate.

Your planned feature doesn't include a user-friendly UI, hope you'll make something a lot more better than mere text editing like PF CE .

I have no plans to have anything other than text-editing as a UI, but as with stars mentioned above, I would be happy to accept a patch in the future which added that.

Basically, I'm very comfortable with editing text files, as are most current modders -- but there's a definite selection effect there; presumably some people don't create mods because of the text-file editing involved. So this would be a good feature - just not one I'm personally highly motivated to prioritize. Another way of doing this would be to make a cross-platform GUI program running external to KSP that can generate the requisite text configuration files for a planet mod (using this or some other planet replacer mod) based on the user's interaction with the program.

Link to comment
Share on other sites

As of now I have succeeded in creating a new PSystem object, however I have not yet meaningfully tested it. (I know it worked only because I replaced the Sun with Kerbin, a decidedly ironic test in light of the name of this plugin, and achieved interesting results such as asteroids orbiting Kerbin and perpetual darkness o'er the land.)

Link to comment
Share on other sites

So tell me, are you going to use the proper way I explained at http://forum.kerbalspaceprogram.com/threads/65401-WIP-PlanetFactory-CE?p=1294503&viewfull=1#post1294503 or are just going to instantiate like Krag, with all the problems that implies?

I'm already creating my own PSystem, but, presently lacking any infrastructure for creating or loading planets, I just rearranged the stock ones. I'm working on creating PSystemBody objects now and the goal is to create and arrange the celestial objects de novo from a configuration file, rather than duplicating and modifying stock planets.

In any case, the hook I am using is the one you suggested - Kopernicus replaces PSystemManager.systemPrefab before KSP uses PSystemManager.systemPrefab; KSP does all the spawning of planets. I agree that this seems like the best approach and seems less likely to be disturbed by changes to KSP. (By not having as much redundant code.)

Link to comment
Share on other sites

I'm already creating my own PSystem, but, presently lacking any infrastructure for creating or loading planets, I just rearranged the stock ones. I'm working on creating PSystemBody objects now and the goal is to create and arrange the celestial objects de novo from a configuration file, rather than duplicating and modifying stock planets.

In any case, the hook I am using is the one you suggested - Kopernicus replaces PSystemManager.systemPrefab before KSP uses PSystemManager.systemPrefab; KSP does all the spawning of planets. I agree that this seems like the best approach and seems less likely to be disturbed by changes to KSP. (By not having as much redundant code.)

In that case, you might want to work with OvenProofMars (http://forum.kerbalspaceprogram.com/threads/86999-0-24-StarSystems-v0-2/page30) as he was also going to use the method I explained.

Feel free to PM me if you need assitance with anything, I've been working with planets for almost a year but I refused to release anything by myself anymore after the community accused me of stealing Krag's code.

Link to comment
Share on other sites

Do you have any specific requests or suggestions for supporting RealSolarSystem? I used to use RSS with a configuration file that also made use of the PlanetFactory planets, but what I'd really like to see, of course, is something with all major moons and dwarf planets supported, not just a small selection. I don't yet know how feasible that is, or if KSP necessarily loads all the planet data at once (in which case the answer is probably "not very feasible," at least without overcoming that first.)

aftokinito would know more, I think, but my understanding is the planets themselves don't have much overhead. What actually matters, in adding new planets, is the greater texture memory usage, since KSP loads all textures at startup. Essentially, it would be worth adding a "Load on Demand" for planet textures as well as part textures, so placeholder 32x32 textures are used until you can actually see the planet.

Might do the same for meshes, but might not; even 32k faces is not a lot for a modern GPU to toss around.

What's expensive (in RAM and cycles) is PQS, but they do thankfully get disabled for all but the active body, now.

Edited by NathanKell
Link to comment
Share on other sites

Thanks for the info.

There is a git repository now:

https://github.com/BryceSchroeder/Kopernicus

NOTE: This currently does nothing useful for the non-developer user, I'm just pointing out the existence of the repository here for those who may be interested in following this as it progresses.

I have not extensively checked the source but the method seems to be correctly implemented.

Now all you have to do is create new PSystemBodys and add them to the PSystem using the PSystem.Add(PSystemBody body) method.

This is the hard part (well not hard but lengthy) and it is the reason why Squad does not add 3-4 planets each update.

Making planets from scratch takes time because you have to add all the PQSMods and components manually one by one instead of instantiating a similar object and just changing a few parameters and the textures.

Link to comment
Share on other sites

Impressive work. This should prove to be a powerful API for planet creation. Nice job on figuring out PSystem and its helper classes.

I will help in any way I can, for instance: providing some of my research, and hierarchy dumps. If you would like.

Feel free to use my code as utils. I wrote functions to create and load PQSMods from a file, that would save you time writing your own.

Link to comment
Share on other sites

you have to add all the PQSMods and components manually one by one instead of instantiating a similar object and just changing a few parameters and the textures.

I think the long term solution to that is something along the lines of letting the planet author define the broad strokes (mountains and oceans, biomes, etc) and then letting them specify parameters for procedurally generated local terrain features (i.e. features on the order of 100m and smaller.)

I wrote functions to create and load PQSMods from a file

Thanks; is it on github or some other place already?

Edited by BryceSchroeder
oh right
Link to comment
Share on other sites

What so far can this Planet mod accomplish, basic black sphere with no surface, Tracking station orbital path ect ect..

Hello! I'm the other guy working on this mod. We've only been working on this for a short time, and I only *just* got custom PSystemBody objects into the planetary system. And at that, its just a name, orbit, and a very broken scaledVersion. There is still a lot of research to be done until even a black sphere in space is possible. The tough part is understanding the hierarchy (aftokinito, KCreator?) to the point of being able to create the objects from scratch, even with the massive help KCreator's PQS data utilities will be. I imagine we will start with understanding how the simplest KSP objects are put together and go from there. I just want the custom PSystemBody to follow its darn orbit and not materialize out of the space center .... (yes I cloned Dres' PSystemBody.scaledVersion object for testing purposes)

Screenshot.2014.07_01.54.28.png

Screenshot.2014.07_01.57.00.png

Edit - Turns out kerbin is the thing that is moving, the custom planet is not moving relative to the sun at all. Huh...

- Nathaniel R. Lewis

Edited by Teknoman117
more info
Link to comment
Share on other sites

Haha. All it ended up taking was two lines of code to fix it. Orbit Driver doesn't automatically get set to update mode. This custom planet even works with stock HyperEdit. Although when you teleport a ship to it the game explodes ... I guess not having a surface defined with do that lol.

			
body.orbitDriver.updateMode = OrbitDriver.UpdateMode.UPDATE;
body.orbitDriver.UpdateOrbit ();

Screenshot.2014.07_02.36.46.png

- Nathaniel R. Lewis

Edited by Teknoman117
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...