RemoteTechnologiesGroup / RemoteTech

Community developed continuation of Kerbal Space Program's RemoteTech mod.
http://remotetechnologiesgroup.github.io/RemoteTech
GNU General Public License v2.0
233 stars 102 forks source link

[API] Add function to obtain transmission rate and cost of a vessel #708

Closed ShotgunNinja closed 5 years ago

ShotgunNinja commented 7 years ago

Like the title says. A function that return the current data transmission rate, and another that return the current transmission cost in EC/s.

YamoriYuki commented 7 years ago

We're currently redesigning RT to work on top of CommNet, including our Api. Part of this new design is an extension to stock ModuleDataTransmitter. Would a pair of properties on this part module work for you? Or do you need(prefer) a more generic/flexible approach?

ShotgunNinja commented 7 years ago

I could scan the vessel part modules and read these properties. However that is not ideal because, even after obtaining the individual antenna transmission rate and cost, then the overall rate/cost for the vessel has to be found. That will require prior knowledge of the internals of RT. With the API calls instead, no such prior knowledge is required.

YamoriYuki commented 7 years ago

Are we talking about transmission rate as in how fast is data flowing right at that moment or as in the antenna's capabilities? How would you want to combine that information (whichever it should be) to create a per-vessel trasmission rate? The same goes for transmission resource cost. What kind of prior knowledge of RT internals do tou have in mind? Do you (plan to) have an implementation for stock transmitters? Sorry for so many questions but I'm trying to understand what's the purpose of the information you're trying to get or at least get a clear specification of the required data you need us to provide.

ShotgunNinja commented 7 years ago

Sorry, I'll try to clarify.

Your model may be such that a vessel can transmit data with a rate (in kbps) and cost (in EC/s) that is the one of the 'best' antenna in that vessel. Or it may be completely different and more complex. I don't know, and in a certain sense I shouldn't need to know. That's why the API solution is better, even if in the case of RT it may be simply the best antenna. Because the API client will then not require prior knowledge of the internals of your model.

As for the reason I'm asking this: I am adding science data transmission over long time-span to a mod. It is agnostic in terms of the communication system used: could be my own, or CommNet, or even RT in its current incarnation. From all these systems I need 'connected/not connected' status, the data transmission speed and the cost of transmission in terms of electric charge.

YamoriYuki commented 7 years ago

The thing is, RT does not decide which antenna is used to transmit. It only provides a part module that implements IScienceTransmitter and KSP decides on how to use them. So the logic you need for stock data transmission should work with RT as well without any major changes. And in CommNet based RT2.0 it will be even more stock alike. Stock already has properties DataRate and DataResourceCost that will be available on RT transmitters as well (it is a child class of the stock transmitter).

HaullyGames commented 5 years ago

This can be close! We have implement a solution using the new APIs

KSP-TaxiService commented 5 years ago

We have no plan to replace the current connection-or-not mechanism of antenna ranges in RT. Separately, RemoteTech Redev is expected to embed a more realistic model, loosely based on our real-life radio communications.

The new APIs added are GetRangeDistance and GetMaxRangeDistance that allows to compute "signal strength" between 2 vessels in a third-party mod.