Jump to content

[1.1.3] AntennaRange 1.11.4 - Enforce and Encourage Antenna Diversity


toadicus

Recommended Posts

OK, folks. I've got a build that implements basic relaying. Antennas will look for nearby relays that can talk to Kerbin, and will use the "cheapest for me" target. So, if you're at the Mun with any antenna, and have a comms satellite or mothership in Munar orbit with a medium dish antenna, it will always transmit "via" that nearby relay instead of going back to Kerbin.

This does NOT attempt to do anything with resource consumption on unloaded ships; if you build a giant chain of whip antennas all the way to Eeloo, a ship at Eeloo will use the nearest relay on the cheap even though technically going through all those relays would be less efficient. If you're looking for that level of challenge, RemoteTech is probably the solution for you.

I have done almost zero playtesting with this yet, so I'm considering it to be an experimental build and not uploading it to SpacePort yet. A new .dll is available here; just drop this over the previous AntennaRange.dll and you're good to go. You'll need AntennaRange.cfg from a previous version (no changes there, don't worry).

So, if you're game for it, please go test and let me know how it works for you! Otherwise, once I've had a chance to do more than the basic "does it work" edge tests, I'll get a new package uploaded.

Link to comment
Share on other sites

Why do my antennas now seem to have infinite packet size? It still says '2', but rather than transmitting, say, an 8-Mit crew report in 4 chunks, it just instantly goes to 100%.

AntennaRange "rewards" the use of antennas at short range by increasing the data packet size. Basically, each antenna has a "nominal" range. At this range, the antenna behaves exactly as it does in Squad's vanilla implementation. At longer range, the MiT-per-packet stays the same, but the power use increases. At shorter range, the power use stays the same, but the MiT-per-packet increases. For example, if you're using a whip antenna in low Kerbin orbit, you will have a very high data rate and small experiments will transmit back in a single packet. If you were using it out beyond Kerbo-stationary orbit, it would take the standard four packets, but each of those packets would cost extra power to send. The "nominal" range for the whip antenna is a bit short of 5 megameters altitude; around there, it will behave a great deal as it does in the stock KSP implementation.

Link to comment
Share on other sites

love this mod. still need to work on my old tendency of sticking the antenna on everything (currently my probes on the mun can't radio science back), but it's a fun thing to have to take into consideration.

I do like the relay idea, since it means my usual approach for multi-moon exploration is more valid again. IE, building a ship with a single larger probe and numerous small ones. now the largest carries a big dish and the rest all carry the smaller stuff.

Link to comment
Share on other sites

love this mod. still need to work on my old tendency of sticking the antenna on everything (currently my probes on the mun can't radio science back), but it's a fun thing to have to take into consideration.

I do like the relay idea, since it means my usual approach for multi-moon exploration is more valid again. IE, building a ship with a single larger probe and numerous small ones. now the largest carries a big dish and the rest all carry the smaller stuff.

If you don't mind being something of a guinea pig, download the testing DLL linked in this post and copy it over the AntennaRange.dll file in your spaceport installation. Then you could send a relay sat up to "rescue" your probes! And you could tell me if it breaks anything terribly. ;)

One report I have heard is that there is some weirdness to do with adding the module to ships launched and/or designed before installing AntennaRange. There's no good work around for this; MechJeb has the same basic issue: if you don't open up a ship there's nothing I can do to save the module information needed for AntennaRange's relaying to work.

The "design" report is a weird one and I think I have a way around that. But at the very least you'll need to open up all existing flights in progress for AntennaRange to add its module data to the antenna.

Link to comment
Share on other sites

too late for that now ^^, I downloaded the file and the patched .dll in one go, so I can't test that bug really. it was just my habit of sticking antennae on everything but not the bigger ones untill I got to bigger power supplies. but the relay system certainly works for me. sending a dish over to the mun let me rescue the bots indeed. a new flotilla is already en route for an encounter (need more !!science!!).

Link to comment
Share on other sites

toadicus I tried out the new dll and it seems to be working as it should. I'd change the font of the message that you get when you don't have enough range to the same one that is used for the science messages. Creates more consistency. Other than it's pretty much perfect. Going to be a must-have mod for any future careers.

Link to comment
Share on other sites

AntennaRange has been updated to version 0.6.0! This includes full compatibility with 0.23 and ModuleManager 1.5.6, along with the new relay feature.

The relaying feature is intentionally simple. That is, if your ship has a short range antenna, but is in range of a longer range antenna that can communicate back to Kerbin, it will do so. At this time, no attempt is being made to model electric use on the relay vessels; this mechanic is intended to feel rewarding for those interested in putting together a relay system (say, a flat dish antenna in orbit of Minmus so your probes can just use whips, or a big dish in high Jool orbit with a few flat dishes in low orbits, so once again your probes can use whips). Because of the limited number of antenna parts and because this mechanic is intended to be optional, range is not additive: if you want to use a whip from far away, you need a bigger antenna within whip range.

@CaptRobau, I am looking in to a way to match the look and feel of Squad's text while maintaining control over what my messages look like, but the messages are all private members in Squad's code, and fonts are a little weird in Unity. I'll push a revision when I get that sorted.

Link to comment
Share on other sites

  • 2 weeks later...
toadicus is there away to get the max range and current range to stay on screen like the void info does ?

I'll add them as display fields in the right-click menu for each part in the next release, but at this point I don't have any global utility for displaying them. Maybe I'll write a VOID module for it. ;)

Link to comment
Share on other sites

AntennaRange has been updated to version 0.6.2! This version features performance and stability improvements for the relaying code, and adds useful data to the "right click" context tip.

CHANGELOG:


v.0.6.2 [2014-01-14]
* Refactored a lot of the relaying code to improve reliability and performance.
* Added range and packet data to the "right click" context tip.
* Made the AntennaRange messages match the stock antenna messages more closely.
* Skipped 0.6.1 because I got my version numbers confused with TweakableEverything.

Toadicus you thought about making a mod like RemoteTech would be nice to have more mods to pick from there was a old but good post here is a link to post http://forum.kerbalspaceprogram.com/members/65251-NeoSky , I thought it was better then what RT has now , thinks for all the time you put in this and hard work.:D

Thanks for the request, but frankly I have no plans to produce such a mod. I don't use RemoteTech myself, but from my review of the code it looks like a pretty good implementation of a pretty complex problem, so I don't see a big void to fill in that regard. As to NeoSky's requests for modeling of solar activity and magnetic storms, it seems to me like that belongs in a larger realism kit because it only has any real pertinence to games run with life support mods, etc, where "oops, solar flare happening, time to fast forward" isn't an option. Finally, I'm already way behind on updating VOID; I just don't have time to take on another mod at this point.

Link to comment
Share on other sites

@MeCripp: It is very unlikely that, at any point for any reason, AntennaRange and RemoteTech 2 could be made to work well together. Your last patch is removing the RT antenna module completely and replacing it with an AntennaRange module; while I don't see a specific reason for that not to work with the rest of the AntennaRange code, it would certainly break parts of RemoteTech. Too, RemoteTech supplants vast swaths of the stock transmission behavior around which AntennaRange is built.

In my mind, though, I can't see a reason to want to use both mods. I'm not very familiar with RemoteTech, but to my reading of the description it essentially models everything AntennaRange does with more realism, and a whole lot more besides. AntennaRange is entirely superceded by RemoteTech and is designed to fill a different role. If you want stock-like transmission behavior but with quasi-reasonable restrictions on transmission distance and a basic relay model that rewards "going the extra mile" for a small comms network without requiring it, AntennaRange is what you want. If you want strict enforcement of mostly-realistic transmission restrictions and complex network relay behavior, RemoteTech is for you. Putting the two together doesn't make sense to me conceptually; even if I could code it, I wouldn't know what it would be.

Edited by toadicus
Link to comment
Share on other sites

What a great idea for a mod! IMHO this is exactly how the antennas should work in the stock game. I've looked at remote tech and it just looks like way too much busywork to be interesting, but this hits the challenge versus simplicity ratio right at the point of maximum fun. Many thanks.

Link to comment
Share on other sites

  • 2 weeks later...

Okay, I have a lander on Minmus with a Communotron 16, and a satellite in a 250km orbit over Minmus with a Communotron 88-88. The lander refuses to transmit, correctly noting it's too far from Kerbin, but... shouldn't it be able to use the satellite as a relay? I'm confused...

Javascript is disabled. View full album
Edited by Gaius
Link to comment
Share on other sites

AntennaRange has been updated to version 0.6.3! This version fixes a bug where flags in range of transmitters would cause exceptional conditions.

CHANGELOG:


v.0.6.3 [2014-02-10]
* Fixed a bug where flags in range would cause exceptional conditions.

Okay, I have a lander on Minmus with a Communotron 16, and a satellite in a 250km orbit over Minmus with a Communotron 88-88. The lander refuses to transmit, correctly noting it's too far from Kerbin, but... shouldn't it be able to use the satellite as a relay? I'm confused...

If 0.6.3 doesn't fix your issue, would you be willing to share your persistence file with me? I have been chasing another bug to do with relays not always working every time, but I've been having trouble narrowing it down. Maybe a fresh set of conditions will help. :)

Link to comment
Share on other sites

New download has fixed the issue. :)

Given your patch notes, I suspect the fact that the probe on the surface was 80m away from a flag might have been what was causing the problem.

EDIT: Noticed one problem remains -- newly docked/undocked vessels can have bizarre ideas for their current transmission distance. A quicksave and reload fixes the problem.

Edited by Gaius
Link to comment
Share on other sites

  • 1 month later...

...and 0.23.5 seems to have broken it. :( When attempting to transmit from Minmus, with a relay satellite in orbit, nothing happens, and the debug log says:

[Log]: Sending data to vessel comms. 1 devices to choose from. Will try to pick the best one

[Exception]: KeyNotFoundException: The given key was not present in the dictionary.

Link to comment
Share on other sites

...and 0.23.5 seems to have broken it. :( When attempting to transmit from Minmus, with a relay satellite in orbit, nothing happens, and the debug log says:

[Log]: Sending data to vessel comms. 1 devices to choose from. Will try to pick the best one

[Exception]: KeyNotFoundException: The given key was not present in the dictionary.

Look in the Output.log file to break down that Exception. Its located in C:\kerbal\Kerbal Space Program\KSP_Data

The file will give you more info on whats actually causing the problem. A few of the mods out there are having issues with some new code in 23.5. I have seen that same exception from Engineer.. In fact Engineer has all kinds of issues in 23.5. Not sure if you have that installed.. But that why you need to check the outputlog file.. To double check to make sure what mod is causing the problem.

Link to comment
Share on other sites

Look in the Output.log file to break down that Exception. Its located in C:\kerbal\Kerbal Space Program\KSP_Data

There is no such file [DERP, there is, I found it, although it's not named exactly that; see below]. If you mean KSP.log, it just contains the same errors that are written to the debug log, albeit with timestamps.

[LOG 03:31:16.052] Sending data to vessel comms. 1 devices to choose from. Will try to pick the best one

[EXC 03:31:16.055] KeyNotFoundException: The given key was not present in the dictionary.

[LOG 03:31:21.547] Sending data to vessel comms. 1 devices to choose from. Will try to pick the best one

[EXC 03:31:21.549] KeyNotFoundException: The given key was not present in the dictionary.

In this case, I hit Transmit, and when it did nothing, waited five seconds and hit it again, when it once again did nothing (other than yarf up errors into the debug log). Pretty sure it's this mod, it's the exact same behavior the mod used to display when it was coughing up exceptions when you attempted to transmit data when too close to a flag, although no flags are nearby this time, and that bug was already patched.

EDIT: Confirmed, same error occurs when no other mods are installed.

EDIT2: Oops, I derped -- was looking in KSP_win, not KSP_win/KSP_data. In there I found "output_log.txt", which is logging the stack traces quite nicely. Here's the stack trace from my latest attempt:

NullReferenceException: Object reference not set to an instance of an object

at AntennaRange.RelayDatabase.getVesselRelays (.Vessel vessel, System.Collections.Generic.Dictionary`2& relays) [0x00000] in <filename unknown>:0

at AntennaRange.RelayDatabase.UpdateVessel (.Vessel vessel) [0x00000] in <filename unknown>:0

at AntennaRange.RelayDatabase.AddVessel (.Vessel vessel) [0x00000] in <filename unknown>:0

at AntennaRange.RelayDatabase.get_Item (.Vessel vessel) [0x00000] in <filename unknown>:0

at AntennaRange.Extensions.GetAntennaRelays (.Vessel vessel) [0x00000] in <filename unknown>:0

at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator12`2[Vessel,AntennaRange.IAntennaRelay].MoveNext () [0x00000] in <filename unknown>:0

at System.Collections.Generic.List`1[AntennaRange.IAntennaRelay].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0

at System.Collections.Generic.List`1[AntennaRange.IAntennaRelay]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0

at System.Linq.Enumerable.ToList[iAntennaRelay] (IEnumerable`1 source) [0x00000] in <filename unknown>:0

at AntennaRange.AntennaRelay.FindNearestRelay () [0x00000] in <filename unknown>:0

at AntennaRange.AntennaRelay.get_transmitDistance () [0x00000] in <filename unknown>:0

at AntennaRange.AntennaRelay.CanTransmit () [0x00000] in <filename unknown>:0

at AntennaRange.ModuleLimitedDataTransmitter.CanTransmit () [0x00000] in <filename unknown>:0

at AntennaRange.ModuleLimitedDataTransmitter.TransmitData (System.Collections.Generic.List`1 dataQueue) [0x00000] in <filename unknown>:0

at ModuleScienceExperiment.sendDataToComms (.ScienceData pageData) [0x00000] in <filename unknown>:0

at (wrapper delegate-invoke) Callback`1<ScienceData>:invoke_void__this___ScienceData (ScienceData)

at ExperimentsResultDialog.drawWindowContent (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

Interestingly, same behavior, but different exception this time (NullReferenceException instead of KeyNotFoundException).

EDIT3: And with a bit of further testing, I got the stack trace from the KeyNotFoundException:

KeyNotFoundException: The given key was not present in the dictionary.

at System.Collections.Generic.Dictionary`2[system.Guid,System.Int32].get_Item (Guid key) [0x00000] in <filename unknown>:0

at AntennaRange.RelayDatabase.get_Item (.Vessel vessel) [0x00000] in <filename unknown>:0

at AntennaRange.Extensions.GetAntennaRelays (.Vessel vessel) [0x00000] in <filename unknown>:0

at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator12`2[Vessel,AntennaRange.IAntennaRelay].MoveNext () [0x00000] in <filename unknown>:0

at System.Collections.Generic.List`1[AntennaRange.IAntennaRelay].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0

at System.Collections.Generic.List`1[AntennaRange.IAntennaRelay]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0

at System.Linq.Enumerable.ToList[iAntennaRelay] (IEnumerable`1 source) [0x00000] in <filename unknown>:0

at AntennaRange.AntennaRelay.FindNearestRelay () [0x00000] in <filename unknown>:0

at AntennaRange.AntennaRelay.get_transmitDistance () [0x00000] in <filename unknown>:0

at AntennaRange.AntennaRelay.CanTransmit () [0x00000] in <filename unknown>:0

at AntennaRange.ModuleLimitedDataTransmitter.CanTransmit () [0x00000] in <filename unknown>:0

at AntennaRange.ModuleLimitedDataTransmitter.TransmitData (System.Collections.Generic.List`1 dataQueue) [0x00000] in <filename unknown>:0

at ModuleScienceExperiment.sendDataToComms (.ScienceData pageData) [0x00000] in <filename unknown>:0

at (wrapper delegate-invoke) Callback`1<ScienceData>:invoke_void__this___ScienceData (ScienceData)

at ExperimentsResultDialog.drawWindowContent (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

Edited by Gaius
Link to comment
Share on other sites

It's 0.23.5! Update time! Major version time! This update brings full 0.23.5 compatibility, solves the last big problem I'm aware of around relaying, and improves relay search performance by several times.

CHANGELOG:


v.1.0.0 [2014-04-04]
* Recompiled against KSP 0.23.5 for compatibility.
* Major Surgery on relay-searching code to improve performance and reliability.
* Added new event-listeners to improve relay behavior around vessel-changing events like undocking.

Link to comment
Share on other sites

Can someone make module manager file for aeis antennas?

In a similar vein to MeCripp, let me (try to) teach a man to fish.

An AntennaRange entry in an MM file should look like this:


@PART[<yourPartNameHere>]
@MODULE[ModuleDataTransmitter]
{
@name = ModuleLimitedDataTransmitter
// This is the distance from Kerbin and/or another relay at which the Antenna performs exactly as designed by AEIS/Squad/Whoever
// When outside this range, the power requirements will increase up to maxPowerFactor times.
// When inside this range, the data capacity will increase up to maxDataFactor times.
nominalRange = <your nominal range here>
// This is the maximum amount of power increase the antenna can do at long range. In effect, this manipulates the maximum range. MaximumRange = nominalRange * sqrt(maxPowerFactor)
maxPowerFactor = 8
// This is the maximum amount of data speedup the antenna will do at short range. This will be reached at IdealDataRange = nominalRange / sqrt(maxDataFactor)
// Below this range the antenna will continue to function ideally.
maxDataFactor = 4
}
}

So, suppose you felt like the CommTech EXP-VR-2T should be useful within 2 AU, which would get you coverage throughout Kerbin, Eve, and Moho's orbits, and sometimes up to Duna (when it's not near opposition). That part would look like:


@PART[Antennaexpatvr2]
@MODULE[ModuleDataTransmitter]
{
@name = ModuleLimitedDataTransmitter
// This is the distance from Kerbin and/or another relay at which the Antenna performs exactly as designed by AEIS/Squad/Whoever
// When outside this range, the power requirements will increase up to maxPowerFactor times.
// When inside this range, the data capacity will increase up to maxDataFactor times.
nominalRange = 9616539270
// This is the maximum amount of power increase the antenna can do at long range. In effect, this manipulates the maximum range. MaximumRange = nominalRange * sqrt(maxPowerFactor)
maxPowerFactor = 8
// This is the maximum amount of data speedup the antenna will do at short range. This will be reached at IdealDataRange = nominalRange / sqrt(maxDataFactor)
// Below this range the antenna will continue to function ideally.
maxDataFactor = 4
}
}

Hope that helps! If you do get a full set of configs done I'd be interested to see them. :)

Link to comment
Share on other sites

For some reason, this mod breaks Simple Part Organizer, which I just can't play without...

ryNDLId.png?1

It does exactly what the screenshot shows - the mods selection menu doesn't pop up. Here is the KSP log-> https://www.dropbox.com/s/te3bck4qpnjecqv/KSP.log

Oh, and I declare myself former king of the lurkers.

(Edit) https://www.dropbox.com/s/d76hianw453plsb/output_log.txt

Edited by johnnyboy76
Forgot the output log
Link to comment
Share on other sites

For some reason, this mod breaks Simple Part Organizer, which I just can't play without...

http://i.imgur.com/ryNDLId.png?1

It does exactly what the screenshot shows - the mods selection menu doesn't pop up. Here is the KSP log-> https://www.dropbox.com/s/te3bck4qpnjecqv/KSP.log

Oh, and I declare myself former king of the lurkers.

(Edit) https://www.dropbox.com/s/d76hianw453plsb/output_log.txt

It looks like this is actually an issue with the way Simple Part Organizer fetches Module names. I've given Felbourn a detailed report:

Felbourn, I got an incompatibility report from one of my AntennaRange users, and it looks like the bug is maybe sorta on your end.

In looking at his log and through your code, I'm pretty sure the issue is line 440, which trims the "useful module name" out of, effectively, PartModule::ToString(). AntennaRange overrides ToString and includes no parentheses, so your Substring is looking from 0 to -1, which is Exceptional.

Seems to me it would be easier and safer to use PartModule::moduleName, which should save you most of the trimming and avoid issues with modules that override ToString().

Let me know if / how I can help!

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...