Jump to content

3D KSP Solar System Scale Model [Major Update: 05/20/2017]


Recommended Posts

Nug0jup.gif

^Model is not actually 8-bit :P

After lots of research, lots more math, and lots more tinkering, I am proud to present this 3D model (version 2.0!) of the KSP solar system. This tool provides accurate visualization and measurement of KSP’s celestial bodies with respect to one another using GeoGebra, a free and open-source graphing software. Sure, it’s pretty to look at, but its real strength is that you, the user, can use it to model and/or measure just about anything in-game.

All planets and moons are represented accurately in terms of scale, eccentricity, orientation, inclination... all of it. The base state of the model has all bodies located where they would be in-game at UT=0, and can be run forward from there to 1000 in-game years (and beyond if you really need). Scale is in megameters (1Mm = 1,000km = 1,000,000m).

9uVJif4.png

^Applet screenshot

All stock planets and moons are represented accurately on their orbits. Semimajor axis, eccentricity, inclination, longitude of ascending node, argument of periapsis, orbital period, phase angle, body size (including atmosphere), and sphere of influence are all modeled. All bodies start exactly where they would at the beginning of a game (UT=0), and can be run forward from there to 500 in-game years (and beyond if you really need).

Scale is in megameters (1Mm = 1,000km = 1,000,000m).

Some of the data have been extracted directly from KSP (v1.2). Everything else is calculated within the model using that raw data. See below for the code used for the extraction.

To use:

This project was very much an adventure for me, so I would not be surprised if there are (still) things I've missed, inaccuracies, etc. Please don't hesitate to bring them to my attention, along with suggestions for how to fix them, if available. I'm also open to ideas about additional features.

Licensing: Because I've published the model on geogebra.org, it is subject to the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license. Keep in mind that Geogebra is something altogether different. I have had no part in developing it, and it is subject to its own licensing, terms, and conditions.

Updates:

  • 05/20/2017: Major update with updated/streamlined calculations, fixed mathematical errors, improved accuracy (thanks to a script for the direct extraction of data from the game), new basic/customizable versions, and a wiki!
  • 04/08/2017: Addressed crowding of AN/DNs & Pe/Aps by replacing the checkbox for each with a drop-down menu, allowing users finer control over what is shown/hidden. Added hide-able stats pane for body in focus, displaying orbital/physical parameters and time to AN and Pe. Changed auto-zoom levels to depend on body in focus.
  • Original 2D model updated/converted to 3D.

Known Issues:

  • Body in "Focus View" drop-down often needs to be selected twice in order to display the target body at intended zoom level. Suggestions welcome.
  • When focusing view, viewVector should orient camera to particular angle. It does not. Commented out for now.
  • Discrepancy between JS syntax accepted by the web app and desktop versions causing error in customizable version's web app at launch. Not sure of reason, no "proper fix" at this time. Works fine in desktop version. Simple workaround is here.

qkDF9Pc.gif

^Joolian system

Edited by Syntax
captions, typos, updates, major update, known issues
Link to comment
Share on other sites

NIIIIIIIIIIIIIIIIICEEEEEEEEE

Dunno when I will have the time but will def be dissecting this at some point.

For me, using the webapp via the link I was able to target bodies which just a single selection from the drop-down.

The only real usability issue I came across in my brief foray was that selecting bodies brought me way too close and I had to zoom out.... actually as I just typed that I realized that's probably the bug you're talking about :P

Great work

Link to comment
Share on other sites

1 minute ago, Drew Kerman said:

NIIIIIIIIIIIIIIIIICEEEEEEEEE

Dunno when I will have the time but will def be dissecting this at some point.

For me, using the webapp via the link I was able to target bodies which just a single selection from the drop-down.

The only real usability issue I came across in my brief foray was that selecting bodies brought me way too close and I had to zoom out.... actually as I just typed that I realized that's probably the bug you're talking about :P

Great work

Thanks!

And yep, that's the bug. Just select again and problem solved.

Link to comment
Share on other sites

Wonderful thing you made @Syntax. Now I'll have to learn about this online applet (never used, though I reckon is programmed same way as the installed version).

Got the "double-click" bug when selecting a body, also the webapp crashed double-clicking again. Seems to be a Geogebra bug, not yours. What I may suggest, as couldn't find, is a fast way to focus back on the whole Kerbol system (another entry in the dropdown perhaps?). Oh, BTW, Kerbol isn't officially recognized as name for the star, Squad (and most users) call it just "Sun".

Suggestions.

In my opinion, selecting AN/DN shows too many points at once, perhaps do for only the body in focus?

Also, could come useful to show data about the focused body, e.g. the orbital parameters (SMA, ECC, INC, LAN, LEP, MNA); or even TTA/TTP (time to apo/peri) or time to AN/DN.

If bodies and their orbital parameters could be editable, this tool could become a must for users of planetary add-ons. Even better if Geogebra allowed to read such parameters from an external file, but isn't a thing I know how to do.

Link to comment
Share on other sites

42 minutes ago, diomedea said:

Wonderful thing you made @Syntax. Now I'll have to learn about this online applet (never used, though I reckon is programmed same way as the installed version).Got the "double-click" bug when selecting a body, also the webapp crashed double-clicking again. Seems to be a Geogebra bug, not yours. What I may suggest, as couldn't find, is a fast way to focus back on the whole Kerbol system (another entry in the dropdown perhaps?). 

Oh, BTW, Kerbol isn't officially recognized as name for the star, Squad (and most users) call it just "Sun".

Thanks for the feedback, diomedea! The first item in the "Focus View" dropdown is Kerbol (though perhaps it should be "Sun"). Select that, and the focus moves to the origin point (0,0,0). Select again, and the zoom level adjusts way out to display the whole system. It's not a "double click," but a repeated action; speed is not a factor. Again, though, I'd like to find a way to do it in one click.

42 minutes ago, diomedea said:

Suggestions.

In my opinion, selecting AN/DN shows too many points at once, perhaps do for only the body in focus?

Also, could come useful to show data about the focused body, e.g. the orbital parameters (SMA, ECC, INC, LAN, LEP, MNA); or even TTA/TTP (time to apo/peri) or time to AN/DN.

If bodies and their orbital parameters could be editable, this tool could become a must for users of planetary add-ons. Even better if Geogebra allowed to read such parameters from an external file, but isn't a thing I know how to do.

I feel your pain about the crowding. A little scripting could likely go a long way to help this. I will look into it!

In terms of editability, I wanted the released version to be as simple as possible, so there is actually a lot of functionality hidden away but easily uncovered. If a user wants to edit, it can be done by downloading the Geogebra desktop app and model source file. From there, open up the spreadsheet view and all the parameters I used to create the model are laid out. Most points on the model are actually tied directly to values in the spreadsheet, so changes in the spreadsheet yield immediate changes in the model itself, assuming valid input is given. This is all accessible on the web version too, but it's way more cumbersome and changes aren't saved.

An info window for the focused body is a really cool idea though! I'll add that to the update list :)

Edited by Syntax
Clarity
Link to comment
Share on other sites

On 4/7/2017 at 6:23 AM, Syntax said:

Most points on the model are actually tied directly to values in the spreadsheet, so changes in the spreadsheet yield immediate changes in the model itself, assuming valid input is given.

Further to this, items like conics and a few variables defined for calculation and UI purposes were input directly, and so can be accessed in the algebra view. Users wanting to edit the model are encouraged to explore and experiment, but I'm happy to field questions and offer advice/insight.

Edited by Syntax
Link to comment
Share on other sites

This is now top priority for my Flight Tracker since the KerbalMaps revival is still stalled out. Running behind in my daily KSA ops however so it will be a few days or a week or two before I dig into this. I'm hoping I can interface with it using Javascript to still keep my cool planetary info tooltips when you mouseover the bodies

Link to comment
Share on other sites

Hey @diomedea, made a couple changes per your suggestions. I addressed the crowding of AN/DNs & Pe/Aps by replacing the checkbox for each with a drop-down menu, allowing users finer control over what is shown/hidden. I also added an optional stats pane for the body in focus, displaying orbital and basic physical parameters, as well as time to AN and time to Pe. Time to DN and Ap can be easily calculated by the user by adding or subtracting half the orbital period, depending on the planet's current position in its orbit. I considered incorporating this in the stats pane but, given its simplicity, opted to leave it to the user to avoid crowding the view too much.

Link to comment
Share on other sites

  • 4 weeks later...

Finally took a look at this and am excited that it has an API to interface with JavaScript as I thought it did. The Spreadsheet seems to be where I need to add the data and then just have to create the Algebra objects to use it. @Syntax I would be very grateful if you could walk through the steps to adding a body. Otherwise I'll just stumble through at some point and post questions here as I go about it. Still a ways off from actively working on it so no rush! Also noticed something funky about the OPM body data I get from KSPTOT that I have to ask Arrowstar about:

Not a huge deal I don't think. If I can't get Epoch 0 values for the OPM bodies I can just adjust the starting epoch to 1953406.3297 seconds, which is the latest OPM Epoch. I don't think people will mind missing a few days in the beginning for OPM bodies way out there :P

Edited by Drew Kerman
Link to comment
Share on other sites

8 hours ago, Drew Kerman said:

Finally took a look at this and am excited that it has an API to interface with JavaScript as I thought it did. The Spreadsheet seems to be where I need to add the data and then just have to create the Algebra objects to use it. @Syntax I would be very grateful if you could walk through the steps to adding a body. Otherwise I'll just stumble through at some point and post questions here as I go about it. Still a ways off from actively working on it so no rush!

I've actually been working away on further refining and optimizing the model in light of a small but compounding mathematical error which arose shortly after initial release. It's been challenging because in order to fix it, I've had to pretty much rebuild the model from the ground up, changing the way everything is calculated. I'm getting close though!

What that means is that shortly (in a week or so, maybe), I will provide an updated, streamlined model. The backend (spreadsheet and algebra) will look rather different from the original. But I plan on providing lots of in-depth information on using and customizing the tool, so I'll definitely include the info you're asking for at that time :)

And just to let you know, the algebra is not really separate from the spreadsheet. It displays every object of every type in the open GeoGebra file. So the spreadsheet actually creates algebra objects as you input data into it; you don't need to do everything twice. For example, if you input the definition for a point (say, a planet's location on its orbit) into cell C37, GeoGebra creates an algebra object (in this case, a point) with that definition, named "C37". I only use the algebra pane for formatting and customizing objects (colour, transparency, label, scripting events, etc.), as well as for defining values not contained in the spreadsheet, like the in-game time (UT) and the objects that make up the user interface.

One thing to note: GeoGebra often classifies the algebra objects it creates from the spreadsheet as "auxiliary objects." These are not visible in the algebra pane by default, so if something seems like it's missing, that's probably why. Depending on whether you're using a web or desktop GeoGebra app, there are a few different ways to display auxiliary objects. I'll explain all this (and more) in greater depth when I post the updated model. In the meantime, though, don't hesitate to shoot any questions my way!

Link to comment
Share on other sites

  • 3 weeks later...
4 hours ago, Drew Kerman said:

please allow me to buy you a drink or two

also I keep getting an error from the webapp when loading the Geogebra website link

Strange. What works on the desktop version doesn't work in the web app... or at least not the same way. I've never liked that web app.

Did you try downloading the file anyway, installing GeoGebra, and opening the model there?

Link to comment
Share on other sites

Just now, Syntax said:

Did you try downloading the file anyway, installing GeoGebra, and opening the model there?

Nope, wanted to see what you said about the web app first, given that's how I'll be presenting things to people. I can try the desktop version later on & report back

Link to comment
Share on other sites

6 hours ago, Drew Kerman said:

a few mins playing around with the GGB file waiting for KSP to load didn't come up with any issues

As suspected.

Will look into the web app issue and report back.

Edit: this is the same error you're getting?

B3tZMLm.png

 

@Drew Kerman: Seems there is some discrepancy between the JS syntax accepted by the web app and desktop versions. I'm far from expert in JS, so I can't begin to imagine why that might be. Good news is, it's easily solved dealt with.

Since you're going to be using the web app, you'll need to make your own copy so your changes will be saved (you might need to make a free GeoGebra account for that). In the top right corner menu of the web app's webpage, you can "copy worksheet."

In your copy, head to the Object Properties for chNameTags (the checkbox labelled "Body Names") and chNodeTags (the checkbox labelled "Point & Node Labels"). Under the Scripting tab for each, change

var arr = arrStr.substr(1,arrStr.length()-2).split(", ");

to 

var arr = arrStr.substr(1,arrStr.length-2).split(", ");

//(brackets after arrStr.length removed)

An annoying inconsistency... If anyone has suggestions to keep the web app and desktop scripts consistent with each other I'm all ears :)

Edited by Syntax
image, fix
Link to comment
Share on other sites

8 hours ago, Syntax said:

An annoying inconsistency... If anyone has suggestions to keep the web app and desktop scripts consistent with each other I'm all ears

ok so yea length in JS is a property not a function so that web error makes sense. No idea why the GeoGebra app would treat it as a function tho, possibly some limitation in how they handle JS code within the app. Thanks for looking into it. I have launch coverage to wrap up this weekend but after that I'm diving in and seeing what I can get working on my Flight Tracker. Stay tuned! Outstanding job on the Wiki, BTW

Link to comment
Share on other sites

1 hour ago, Drew Kerman said:

ok so yea length in JS is a property not a function so that web error makes sense. No idea why the GeoGebra app would treat it as a function tho, possibly some limitation in how they handle JS code within the app.

I found it very odd as well that the JS in the desktop application only worked when treating length as a function. But there it is.

Looking forward to seeing how you fare with the model! Keep me posted.

Link to comment
Share on other sites

Since my last post sounded like I was going to have something by now, just updating that this remains at the very top on my daily list of things I want to do, but sadly all week I've been unable to get through my daily list of things I have to do. Doesn't look like that'll change soon, but hopefully next month will be better

Link to comment
Share on other sites

  • 1 month later...

well it took longer than I would have liked but finally started working on this over the last few days!

@Syntax major props for getting this assembled, after spending time with the desktop app I have to question how you are still sane. Will I lose my sanity? Ugh it perplexes me to no end. Some questions/issues for you:

  • why is Pol's Foci colored red?

  • why is sun's SOI radius colored red?

  • I added a gray background to the last row of cells since the white text didn't show and at first I thought they were all empty!

  • Some of the column A "header" cells that defined the sections of values were off by one vertical cell

  • For some reason Vall and Bop or alternately just Vall have reference plane equations (no harm noted, just weird)

  • I can't create new columns. I try to right-click the column header and select (Insert Right) but nothing happens. I found that selecting a cell and choosing the "Record to Spreadsheet" option will create a new cell, I just delete the recording. Have you found any easier way?

  • in the wiki, on adding new bodies, "row 28, 30" should be "row 28, 32"

  • Not sure what you mean by "adapt text in <angle></angle>"

  • Adding a new number to the list for the body selection caused it to disappear - took me a while to figure out it had switched off its visibility flag for some reason. Same happens to the phase angle selection boxes

So I have this working via JS load, which means I can do away entirely with the 2D graphics and controls from the embedded version and control it directly with my own website controls (click the 1st button and names will appear). I plan to modify the system to show only the planets, then when a user clicks on a planet an info box will appear with details (like the tooltips that show up now) and a link to view the planet, which will load another page with a dynamic figure of the planet and its moons, if any. Then users can drill down further to just see the moon (although single-body view will only be available in the event spacecraft are in orbit around it).

Edited by Drew Kerman
Link to comment
Share on other sites

7 hours ago, Drew Kerman said:

well it took longer than I would have liked but finally started working on this over the last few days!

@Syntax major props for getting this assembled, after spending time with the desktop app I have to question how you are still sane. Will I lose my sanity? Ugh it perplexes me to no end. Some questions/issues for you:

[snip]

So pleased to see someone will get some use out of it other than me! Even I've fallen away from the game for the foreseeable future. Right now, it is late, and it's been a while since I've looked at my work. I will revisit this at some point this weekend and get back to you :)

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...