KSP-KOS / KOS

Fully programmable autopilot mod for KSP. Originally By Nivekk
Other
691 stars 229 forks source link

Docs are unclear about Communication Manager restrictions #1912

Open jberkman opened 7 years ago

jberkman commented 7 years ago

The code mentions that relay antenna is required for sending messages to other vessels, but the docs do not mention this limitation. It's difficult to discover without reading code.

jberkman commented 7 years ago

So I was going to use this feature to send commands to probes instead of their local console. My boot script reads and executes commands at startup.

I don't think it's in the spirit of the game to require relay antennae on all my craft, however.

As I see it, there are 3 options:

  1. I can just queue the message on the probe's console, pretending it was run elsewhere
  2. The CommNet manager can be changed to always be connected (if a probe has an antenna deployed), and if a probe is out of contact the user can restrict use themselves.
  3. Some sort of convoluted workaround where messages include a list of relays the sender can see, and the receiver doesn't actually have the message posted to their queue until they can see one of those relays.

I'd lean towards option 2 myself.

hvacengi commented 7 years ago

This is documented in the section about the individual communication managers (because the limitation does not exist for other managers). You can find it under the CommNetConnectivityManager heading as a note box call out here: http://ksp-kos.github.io/KOS_DOC/commands/communication.html#connectivity-managers

I agree it isn't in the spirit of the game to require a relay antenna on every single craft. But the second option you list above is even less in the spirit of the game in my opinion. That presents a major flaw where you can send messages to any probe no matter where it is so long as it has an antenna. All probe cores have a small antenna (at least they eventually do, not sure if that is unlocked along the way in career) which essentially negates the restriction entirely.

I looked at ways to try and work around the active vessel/relay antenna restriction while working on the system, and couldn't find anything practical from within the code. It's a performance issue for Squad, so the feature got locked down pretty good. You might try using module manager to add a zero range relay antennae to each of the kOS processors. That may be sufficient to get KSP to update their network, even though the relays themselves can't talk to anything.

The whole goal of our new communications framework was to abstract away all of the communication details themselves. With that in mind, I'm reluctant to introduce workarounds for specific instances. If this issue had come up with another mod I think I'd suggest asking the mod author to change their behavior, but that's a little harder to do with Squad.

A byproduct of our abstraction method is that you could write a new ICommunicationManager implementation which always allows communication between vessels (essentially a mash up of CommNetConnectivityManager and PermitAllConnectivityManager). To test it out you can do it in a separate dll (similar to how addons are written, just without needing an actual addon class). I'd have to think about it and play around with it a little bit, but we might be willing to add it as an option to kOS itself, or maybe it just becomes a separate optional download. I'll ask @Dunbaratu to add his thoughts about that option.

If adding the zero range relay to kOS parts works and doesn't complicate the stock experience I think that would be my preferred choice.

jberkman commented 7 years ago

Thanks, I see the warning now; I hadn't scrolled all the way, and I also think I misunderstood what connection managers did. They're only used for sending messages, and are separate from control?

I'd worry about performance implications of the zero-range relays.

For now I'll probably stick with option 1 above, but might switch to PermitAll. Thanks and apologies for the bogus bug. Feel free to close or retitle as would best be helpful for you.

hvacengi commented 7 years ago

Communication managers are used for anything that requires a connection (essentially inter-vessel communication, access to the archive, and steering event subscription). After reading it again, it looks like it isn't explicitly stated what the communication manager controls. I'll have to go through the docs and see if we mention the various connectivity restrictions elsewhere. We should link them if they exist, or create them if they don't.

To relieve some of the performance implications, you also use MM to clone the part and make a special "relay enabled KAL9000" that you only add to the vessels that you need to use this feature on.