Li0n

[Released][1.3.1] Antenna Helper [v0.90] (27 Feb 2018)

Recommended Posts

CLOSED

See release thread :

 

Hi Kerbonauts around the world

 

Ever wonder what all the antennas you put on your craft, because they look so cool, actually do ? How far can you go with them ? How many science you'll be able to send back when you get there ?

It's easy ! Just multiply the power of your strongest antenna with the result of the division of the sum of all your antenna's power by the power of the strongest antenna raised by their average weighted combinability exponent. This will give you the antenna power of your spacecraft, now calculate the root square of this number multiplied by the DSN power, it will give you your maximum range. So simple.

OR

You could use Antenna Helper to do all that, and more, for you.

 

Looking for translators :

If you like to help translate Antenna Helper please send me a message, either here or on GitHub.

Translation remaining :

*those language should be added to KSP 1.4.

 

 

Ok, but what does it do ?

It will show you the antenna capability of your active vessel in flight, in the editor and of all vessels in the tracking station.


In flight ?

Only in the Map View (for now). Click the Antenna Helper icon on the app launcher : icon_off.png?raw=true
And you should see something close to that :

map_view_active.png?raw=true


Those color circles represent the maximum range between your vessel and its relay/DSN, it also indicate how much signal strength you get. While your ship is in the green circle its signal strength will be clamped between 100 and 75%, in the yellow circle between 75 and 50%, in the orange circle between 50 and 25%, in the red circle between 25 and 0%. And if you're outside the red circle you don't have any connection.


Apart from the color circles, you'll see a small window next to Antenna Helper icon on the app launcher :

map_view_window.png?raw=true


The four button will show you your range, and signal strength, from different sources (relay or DSN).

  • ACTIVE (by default) show your range for the active connection, which can be from a relay or DSN.

map_view_active.png?raw=true

 

  • DSN show the maximum range between your vessel and the DSN

map_view_dsn.png?raw=true

 

  • RELAY show the maximum range between your vessel and all the in-flight relay

map_view_relay.png?raw=true

 

  • DSN and RELAY combine the two above, showing you all the possible connection, with their range

map_view_dsn_and_relay.png?raw=true

 

You mentioned the editor ?

Yep. That's nice to see "on live" where you can go with your space probe but it's even better to know before launch how far you can travel.

In the VAB (or SPH) click the Antenna Helper icon on the app launcher : icon_off.png?raw=true
It brings this window :

editor_main_window_direct.png?raw=true


Lots of infos here, let's go through them from top to bottom :

  • Selected type : which antennas are taking into account to compute the vessel antenna power. Direct (by default) will use all antennas, Relay will use only the antenna with relay capability.
  • Current target : the range of your ship's antenna is determined by the antenna power of its target, which can be the DSN or a relay. By default the selected target is the DSN. You can change the target by clicking on Pick A Target. (more about it below)
  • Status : a quick explanation about which antenna on your craft will actually be used in flight.
  • Power : the antenna power of your vessel.
  • Max Range : the maximum distance between your vessel and the target after which you'll lose the connection. Depend on the power of your vessel and the power of the target.
  • Max Distance At 100% : the distance between your vessel and the target after which your signal strength will start to decay.
  • Color bar : it works with the Max Distance At 100% and the Max Range distance. The number aligned with the black bars separating the colors indicate the distance at which the signal decay. Example from the pic above : between 2 050 205 945m and 51 662 800 363m, your signal strength will vary from 100% to 75%.


So the target is important ?

Of course, one antenna on its own don't do anything. It must be connected to another antenna, can't compute maximum range or signal strength with only one antenna.
Two type of target :

  • the DSN (Deep Space Network) : it's the (very) big antenna on Kerbin. It has three levels with different power, you upgrade from one to another by upgrading the Tracking Station.
  • relay(s) : those are vessels you build yourself, two condition need to be meet : having at least one antenna with relay capability and setting the vessel type to "Relay".

You can simulate all those connection directly from the editor : Click the Pick A Target button :

editor_target_dsn_window.png?raw=true


From here you can select a different DSN level, your current level is in bold and is selected by default. For simulating against in-flight relay hit the In-Flight Ships button :

editor_target_flight_window.png?raw=true


In this window you should see one button per flying vessel with its name and its antenna relay power, important distinction, when your connection is going through a relay only the relay antenna of this relay will be used. Sound obvious but... So if your building a relay make sure your selected type, in the main window, is set to RELAY.

Speaking of building relays, you may want to simulate the antenna range of a relay before you launch it. To do so you need to add your ship/relay to the Antenna Helper Editor Ship List. Just open your vessel in the editor and click on Add Ship to the Target List in the main window. After which you can click on Editor Ships in the Pick A Target window :

editor_target_editor_window.png?raw=true


It works the same way as the in-flight relay list, the number between parenthesis is still the antenna relay power.

 

But what all those numbers really mean ?

They are, mostly, just distance. At a solar system scale. So big distance, like space-travel distance (we're playing a space program game, are we not ?).
Anyway, to help figuring out what does numbers represent you'll find this window, by clicking on Signal Strength / Distance in the main window :

editor_signal_distance_window.png?raw=tr


In it you'll see what signal strength to expect for a distance equal to the minimum and maximum distance between the home body (Kerbin), its moon(s) and all the others planet on the solar system. Keep in mind that those distance are approximate, specially for celestial body with an highly inclined orbit.
You can check the distance used by hovering your mouse on the celestial body name.
In the same window you can check the signal strength to expect at any given distance, write it in the input box at the bottom of the window and click the Math ! button.


Still don't get a clear representation of what those space-travel distance mean ?
Save your ship in the Antenna Helper Editor Ship List, click the Add Ship to the Target List button in the main window. Quit the editor and open up the Tracking Station.

 

Tracking Station ? Yummy !

Yes it's good. Fire Antenna Helper : icon_off.png?raw=true

From there if you select a vessel in the Tracking Station list you'll see its range circles just like in flight. You can check the range for the active connection, the DSN connection and for all relay in flight by selecting it in the GUI.
To check the range of a vessel saved in the Editor click the Editor Ship List button.

tracking_station_editor_ship_list_window


Now you can see the range and the signal strength of your future vessel for the different connection type.
The number between parenthesis is the total antenna power of your vessel, as opposed to the Ship List in the Editor that show the relay power.

tracking_station_editor_ship.png?raw=tru

 

 


About the mod

This is still a work in progress, you can use it safely, it won't break any thing in your game but the value may be off. If you find a bug or have any suggestion please post it on this thread or create an issue on GitHub.

Know issues :

  • the circle of the map view jitter at high time-wrap. Almost fixed.
  • the orientation of the map view circle, relative to the camera, is, most of the time, sub-optimal. Fixed when orbiting the DSN's planet
  • transparency of the circle are not good, specially when they overlap.
  • in-flight, antennas of the active ship are all considered extended.
  • in-flight math are done only once on loading. It need to be re-done when the ship stage, dock, etc...
  • DSN and range modifier may not be correctly set when loading a new game (after an "exit to main menu")
  • range modifier are off when using RSS, see this thread should be fixed by v0.13, waiting confirmation
  • circles in the Tracking Station disappear when zoomed far away
  • Tracking Station window should be clamped to the button. Not sure actually

Future plans :

  • showing the range circle in the tracking station. Done
  • + show range circle for ship not already launched. Done
  • Window with NUMBERS in flight.
  • in the editor, a window showing a list of antenna with their characteristics.
  • in the editor, add all the in-flight relay to the list of target. Done
  • in the editor, add relay antennas (part) to the list of target. Done
  • re-work the GUI, possibly with the new GUI system instead of on OnGUI.
  • map view window should be clamped to the toolbar button. Done
  • Have a way to simulate an antenna at an arbitrary location, see this post
  • show the occlusion of signal on the circle, see this post
  •     + move the dsn circle to the antenna position, see this post
  • show the possible connection range along the relay orbit, see this post


Credits

The idea for an in-game calculator is from this thread by @Tyko.

Thanks to @Poodmund for his google docs's calculator, and for the help he provide to this mod, and for writing the CommNet section of the KSP wiki.

Thanks to @Skalou for his help with the math :wink:

Antenna Helper icon/logo made by myself with assets from FlatIcon by Freepik.

 

 

Download Antenna Helper from GitHub.

You NEED Toolbar Controller too (v0.1.4.7 or higher)

SpaceDock and CKAN will come once it reach a more mature state.

Last version for KSP 1.2.2 / 1.3.0

Source are on Github.

License is MIT.

 

Please share your thought, suggestion, bug(s) report, 2 (or more) cents, etc...

And enjoy building your craft with the exact number of antennas needed :wink:

 

Edited by Li0n
v0.90

Share this post


Link to post
Share on other sites
Just now, Kombat engineer said:

Nice idea how about antennas with adjustable range that make the most use out of this.

Never heard of antennas with adjustable range. (yep I'm kinda new to this game mechanic) Could you point me to the one you're thinking about ?

Share this post


Link to post
Share on other sites

It just came into my head while i was reading this.So my thought was that stock antennas were boring and that it would be nice if there were ones that could expand the dish to gain there max range with the extra dish sliding out the middle. their design would be based on the Squarial.

 

Edited by Kombat engineer
Made it simple.

Share this post


Link to post
Share on other sites
1 minute ago, Kombat engineer said:

It just came into my head while i was reading this.So my thought was that stock antennas were boring and that it would be nice if there were ones that could expand the dish to gain there max range with the extra dish sliding out the middle. their design would be based of this.

That's a nice idea, but this thread is about calculating the power of antennas etc. If one day a mod do what you suggest I'll try to support it in Antenna Helper but it's as far as I will be involved.

Share this post


Link to post
Share on other sites

Great stuff, if you have any specific or general questions, please feel free to ask either here or via a direct message. :D 

Share this post


Link to post
Share on other sites
13 hours ago, Poodmund said:

Great stuff, if you have any specific or general questions, please feel free to ask either here or via a direct message. :D 

Thanks. For starter :

19 hours ago, Li0n said:
  • I'm new to this communication thingy, I'd really like input from experienced player of the CommNet system on what value should also be displayed
  • For now the target list only has DSN, I'd also like to have all the vessel with relay capacity there. Those already in flight and those under construction. I've tried to access "HighLogic.CurrentGame.flightState.protovessels" but it doesn't seem to exist when in the editor or the space center. And I have no idea on how to get those that only exist as .craft files. Any input on this will be really appreciated.

I also like to display the max range between two antennas at a given signal strength. Here is the formula that gives the signal strength for a given distance :

Quote

signalStrength = (3 - 2 * (1 - (distance / maxRange))) * (1 - (distance / maxRange))

Where "signalStrength" is clamp between 0 and 1.

Basically I need to "reverse" it to "distance = mathStuff". Can you help me with that ?

Share this post


Link to post
Share on other sites
3 hours ago, Li0n said:

Basically I need to "reverse" it to "distance = mathStuff". Can you help me with that ?

Great, probably an other must have mod!

I think you will have to solve this kind of stuff: f(x)=ax3+bx2+cx+d=0 ( for example:  -2x³ + 3x²-0.75=0 to know x (= Distance away from 'Link Point' / Max Range of Antenna Link)  at witch the Signal Strength is 75%?)
It's called 3rd degree equation, cubic equation, ... there is probably things already done in programming to solve this. ( so i can't help you more)

http://www.1728.org/cubic.htm (with A=-2 ; B= 3 ; C=0 ; D= -0.75 in the example above, then check and grab the solution x between 0 and 1, there should be one and only one respecting this among the 3 real values in all case with wathever D= - Signal Strength)

Edited by Skalou

Share this post


Link to post
Share on other sites

Idea:  In addition to the distance in meters it should list the planets in Red (can't reach at all), Yellow (can reach some of the time--look at the whole SOI) and Green (can always reach.)  (Retain the meters for missions to places other than planets.)

Share this post


Link to post
Share on other sites

Antenna Helper v0.2 is here !

Quote

* New window that show the signal strength for each planet at their max and min distance
* Fix duplicate toolbar button

@Loren Pechtel The new window should do what your wanted. I'll see later for fancy color for signal strength, important for now is the value :wink: 

@Skalou Thanks for the hints. I've looked at it and... that will take some time...

@Errol Not at the moment, I'll see how Remote Tech do its magic when I'm satisfied with the stock antennas. Actually if RT use the stock ModuleDataTransmitter, or inherit from it, it may work. If you try I'll be curious to see what happen.

Thanks for the support guys. Please keep the suggestion coming :wink: And I'm still searching the right math to calculate the max range for a signal of 100%, see posts above if you feel like a NASA mathematician :wink:

 

Edit : I've updated the OP with pics of the new window.

Edited by Li0n

Share this post


Link to post
Share on other sites

I know that the RT dev team is currently working on the next version of RT which will make use of as much of the exisiting stock comm net code as possible, so we'll see. It is still a ways out from release yet, I don't even think they have a beta yet. 

Share this post


Link to post
Share on other sites
1 minute ago, Errol said:

I know that the RT dev team is currently working on the next version of RT which will make use of as much of the exisiting stock comm net code as possible, so we'll see. It is still a ways out from release yet, I don't even think they have a beta yet. 

Thanks for the info, I haven't used RT for a long time. Hopefully Antenna Helper will be in a more finished state when they do release a new version.

 

Share this post


Link to post
Share on other sites

Something I forgot to mention earlier : there is a bug in the UI that make the main window of Antenna Helper empty and spam the log with :

Spoiler

ArgumentException: Getting control 0's position in a group with only 0 controls when doing Repaint
Aborting
  at UnityEngine.GUILayoutGroup.GetNext () [0x00000] in <filename unknown>:0
  at UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type layoutType) [0x00000] in <filename unknown>:0
  at UnityEngine.GUILayout.BeginVertical (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) [0x00000] in <filename unknown>:0
  at UnityEngine.GUILayout.BeginVertical (UnityEngine.GUILayoutOption[] options) [0x00000] in <filename unknown>:0
  at AntennaHepler.AntennaHelper.MainWindow (Int32 id) [0x00000] in <filename unknown>:0
  at UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) [0x00000] in <filename unknown>:0
  at UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) [0x00000] in <filename unknown>:0

It is triggered when both Antenna Helper and Real Time Clock 2 (see my sig) are installed. I strongly suspect other mod can trigger it to, if you find one that does please report it to me. For Real Time Clock you can disable the window in the VAB/SPH via its settings file, only workaround for now.

 

I also forget to mention that the "Planet Window" introduced in 0.2 should work with planet pack but I haven't tested it yet. If you do, please report how it goes.

Share this post


Link to post
Share on other sites
On 11/02/2017 at 6:27 PM, Li0n said:

Antenna Helper v0.2 is here !

@Loren Pechtel The new window should do what your wanted. I'll see later for fancy color for signal strength, important for now is the value :wink: 

@Skalou Thanks for the hints. I've looked at it and... that will take some time...

@Errol Not at the moment, I'll see how Remote Tech do its magic when I'm satisfied with the stock antennas. Actually if RT use the stock ModuleDataTransmitter, or inherit from it, it may work. If you try I'll be curious to see what happen.

Thanks for the support guys. Please keep the suggestion coming :wink: And I'm still searching the right math to calculate the max range for a signal of 100%, see posts above if you feel like a NASA mathematician :wink:

 

Edit : I've updated the OP with pics of the new window.

Tell me if you need more help for the maths, but there is everything here: http://www.1728.org/cubic2.htm  ,it seems to me that the solutions will always be x3= L * (M - N) + P (in the chapter: ALL 3 Roots Are Real), so you need to calculte i, j, etc... to get them, i hope there is a way to get arcsinus number with unity... :/

On an other side, i don't think there is really a range for the 100% Signal Strenght, i made a few tests to know more:
I think the display on the top left side is rounded to the superior number, when it is 99,xxx it will display 100%, when 34,xxx it will be 35%, etc...
i also looked in game at when does it change:
Owxu4qE.png

It's changing from signal strenght 100% to 99% in the corner (red arrow), when the vessel is nearly to 20.8Mm away from the DSN station (orange arrow, not precise enough to know it more accurately): 1 communotron 16 vs a lvl3 DSN, Range and DSN modifiers=1.

VbBuH0Z.png

 

 

Im1x5yN.png

I also looked at the numbers from this Sheet calculator, it seems to match :) ( don't forget to adjust the difficulty settings: Range and DSN modifiers), thanks @Poodmund

So when it displays 100%, it could be in fact, 99.xxx%, and the only way to get a real 100% could be to sit at 0m from the DSN.

can you display the numbers more accurately in flight? (calling the dark force)

this could also help you:

An answer from @RoverDude, one of the authors of this feature :wink:

Edited by Skalou

Share this post


Link to post
Share on other sites

If you need some more figures to look at how the Sheet is generating its numbers, make a copy for yourself to your own Google Docs repo and make sure to unhide some of the hidden columns. I'm storing constants and dynamic variables off the main viewable sheet.

Also, if you're not already doing so, be sure to check out http://docuwiki-kspapi.rhcloud.com/ and https://kerbalspaceprogram.com/api/index.html to see if there are any additional classes/objects you could call to make your life easier.

EDIT: I also found that it seemed to by rounding the Signal Strength displayed in-game up to the nearest integer.

Edited by Poodmund

Share this post


Link to post
Share on other sites
31 minutes ago, Poodmund said:

EDIT: I also found that it seemed to by rounding the Signal Strength displayed in-game up to the nearest integer.

I think it's not to the nearest, but to the next above, because when 99,23 it seems to  gives 100%.

Share this post


Link to post
Share on other sites
34 minutes ago, Skalou said:

I think it's not to the nearest, but to the next above, because when 99,23 it seems to  gives 100%.

Yes that is what I found also. :D 

1 hour ago, Poodmund said:

EDIT: I also found that it seemed to be rounding the Signal Strength displayed in-game up to the nearest integer.

:sticktongue:

I'm not sure at which point it determines the 0% Signal Strength threshold though in this case. I would guess that it flips from 1% to 0% as soon as the distance between the two connection points exceed the maximum possible signal distance.

Share this post


Link to post
Share on other sites
17 hours ago, Skalou said:

Tell me if you need more help for the maths, but there is everything here: http://www.1728.org/cubic2.htm  ,it seems to me that the solutions will always be x3= L * (M - N) + P (in the chapter: ALL 3 Roots Are Real), so you need to calculte i, j, etc... to get them, i hope there is a way to get arcsinus number with unity... :/

I don't think I'm at this point yet, before I can use those formulas I need an equation of the form "ax^3 + bx^2 + cx + d = 0". Here is the closer I get :

Spoiler

cW28FRW.jpg

Where "d" is the distance (the "x" of the above equation)

"m" is the max range of the antennas

"s" is the signal strength

 

17 hours ago, Skalou said:

On an other side, i don't think there is really a range for the 100% Signal Strenght, i made a few tests to know more:

[...]

So when it displays 100%, it could be in fact, 99.xxx%, and the only way to get a real 100% could be to sit at 0m from the DSN.

Yep I think you're right. I've made the test with the "Planet Window" and no matter how much antennas the signal never reach 100%.

 

So, it make me re-think about this "Max Distance For 100% Strength" feature. It may be better to let the user enter the distance he wants to check and calculate the signal strength based on that. It will be like the "Enter Required Range" in @Poodmund 's Calculator. What you think of it ?

 

17 hours ago, Skalou said:

 

can you display the numbers more accurately in flight? (calling the dark force)

You mean as a feature of the mod or just for helping with the development ? I will add a flight display at some point, as I like building stuff with KIS it will help.

 

17 hours ago, Skalou said:

this could also help you:

An answer from @RoverDude, one of the authors of this feature :wink:

Thanks. I use the same method to calculate the distance between planets, with the same inaccuracy as I don't take into account the inclination either.

@RoverDude show the "easy" way of calculating the signal strength, from the KSP wiki :

Quote

To obtain your signal strength for a link at any given distance between the two points it is mostly the relative distance between the two points. The true calculation requires plotting the relative distance on a Bezier curve with they keys '0 0 0 0' and '1 1 0 0' to obtain the true Signal Strength. This can be calculated as follows:

  • 1 - ( Distance away from 'Link Point' / Max Range of Antenna Link ) = 0 < x < 1 (as a fractional percentage)
  • Substitute the result above into the Bezier Curve equation (Cubic derivation) of y = -2x³ + 3x² = (3-2x)x²

This will give you the Signal Strength between the link at your specified distance.

 

16 hours ago, Poodmund said:

If you need some more figures to look at how the Sheet is generating its numbers, make a copy for yourself to your own Google Docs repo and make sure to unhide some of the hidden columns. I'm storing constants and dynamic variables off the main viewable sheet.

Also, if you're not already doing so, be sure to check out http://docuwiki-kspapi.rhcloud.com/ and https://kerbalspaceprogram.com/api/index.html to see if there are any additional classes/objects you could call to make your life easier.

EDIT: I also found that it seemed to by rounding the Signal Strength displayed in-game up to the nearest integer.

Thanks. I haven't deeply look into your sheet yet, the KSP wiki was my main source of info, but I will.

I've also check the doc but don't see anythings that could help me. There is some method with abbreviated name and no comment about it, so it's very likely I've missed something.

Edited by Li0n

Share this post


Link to post
Share on other sites

Just a curiosity question...are the planet names hard coded in your DLL?  I've currently got this installed under a Galileo Planet Pack setup which completely replaces the stock solar system (including the sun) but not a single planetary or lunar body shows up on the per planet list.

I ask because I'm looking at overhauling antennas within the stock system in order to generate more forced choices and need for variety.  I hate that I have 30 antennas on my list from all the mods I use but still only manage to use about 4 or 5 different antennas.  Your tool would give me an easy way to help write antenna configs for non-stock planetary systems by being able to make and see all my measurements at once in game without having to constantly enter and exit for testing.  BUT, I need to be able to see non-stock planetary bodies... :D

 

Share this post


Link to post
Share on other sites
7 hours ago, Li0n said:

I don't think I'm at this point yet, before I can use those formulas I need an equation of the form "ax^3 + bx^2 + cx + d = 0". Here is the closer I get :

  Reveal hidden contents

cW28FRW.jpg

Where "d" is the distance (the "x" of the above equation)

"m" is the max range of the antennas

"s" is the signal strength

 

The y = -2x³ + 3x² or y = (3-2x)x² equation to calculate the Signal Signal strength is complex when rearranging to make x the subject (representing the linear, fractional value of link distance against max distance), ending up with imaginary numbers in some cases (not sure how Unity handles these).

Try these:

960ffe8e5dd7ad66ba68816364e2a01b-3.png?t

960ffe8e5dd7ad66ba68816364e2a01b-4.png?t

960ffe8e5dd7ad66ba68816364e2a01b-5.png?t

and see if they give you what you'd expect.

7 hours ago, Li0n said:

Thanks. I use the same method to calculate the distance between planets, with the same inaccuracy as I don't take into account the inclination either.

I may be able to help you here. The values on the 'System Stats' page on my Google Sheets doc show the min max distance between Kerbin and the other bodies up to the game year 1000 (if I remember correctly). If I have permission from the original author I may be able to share the calculation document I used to get these figures.

7 hours ago, Li0n said:

@RoverDude show the "easy" way of calculating the signal strength, from the KSP wiki :

I actually contributed pretty much the majority of that Wiki article as it is today in parallel to creating the Google Sheets document. I wrote down what I was finding as I was creating the calculator as the info on that page originally was pretty bleak. If you have any queries about the information in the Wiki article directly or find any errors, please let me know.

EDIT: 

5 minutes ago, rasta013 said:

Just a curiosity question...are the planet names hard coded in your DLL?  I've currently got this installed under a Galileo Planet Pack setup which completely replaces the stock solar system (including the sun) but not a single planetary or lunar body shows up on the per planet list.

I ask because I'm looking at overhauling antennas within the stock system in order to generate more forced choices and need for variety.  I hate that I have 30 antennas on my list from all the mods I use but still only manage to use about 4 or 5 different antennas.  Your tool would give me an easy way to help write antenna configs for non-stock planetary systems by being able to make and see all my measurements at once in game without having to constantly enter and exit for testing.  BUT, I need to be able to see non-stock planetary bodies... :D

 

You can call FlightGlobals.Bodies to return a list of all the Celestial Bodies in a system i.e.

Bodies[0] = Sun 
Bodies[1] = Kerbin 
Bodies[2] = Mun 
Bodies[3] = Minmus 
Bodies[4] = Moho 
Bodies[5] = Eve

etc.

This should help populate the list dynamically but you'd have to hard code the max/min distance for the bodies from the Homeworld body unless you did an approximation calculation just using the apoapsis and periapsis of each body... it may be a good enough solution.

Edited by Poodmund

Share this post


Link to post
Share on other sites
15 minutes ago, Poodmund said:

You can call FlightGlobals.Bodies to return a list of all the Celestial Bodies in a system i.e.


Bodies[0] = Sun 
Bodies[1] = Kerbin 
Bodies[2] = Mun 
Bodies[3] = Minmus 
Bodies[4] = Moho 
Bodies[5] = Eve

etc.

This should help populate the list dynamically but you'd have to hard code the max/min distance for the bodies from the Homeworld body unless you did an approximation calculation just using the apoapsis and periapsis of each body... it may be a good enough solution.

That should actually work nicely.  For my purposes the approximation will most likely work perfectly fine.  I don't plan on making the antenna limits so stringent that small measurement inconsistencies would throw them off.

Share this post


Link to post
Share on other sites
17 minutes ago, Poodmund said:

 


Bodies[0] = Sun 
Bodies[1] = Kerbin 
Bodies[2] = Mun 
Bodies[3] = Minmus 
Bodies[4] = Moho 
Bodies[5] = Eve

etc.

This should help populate the list dynamically but you'd have to hard code the max/min distance for the bodies from the Homeworld body unless you did an approximation calculation just using the apoapsis and periapsis of each body... it may be a good enough solution.

A apoapsis of the homeworld + apoapsis of the target body should be 'maximum theoretical distance' right?  (Well, moons make the calculation a bit more complex.  But if you just take the parent body if it's not the sun, you should be good, right?)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.