Jump to content

[1.2.2] CommNet Constellation [v1.0] [7 April 2017]


TaxiService

Recommended Posts

zhv6Ikk.png

6uCc9GP.png

What is this?

A gameplay add-on for Kerbal Space Program. The purpose is to transform the CommNet network of the single type into multiple constellations of different types.


Why?

Three reasons:
* In our real-life universe, we have satellite constellations of GPS, GLONASS and Galileo talking to their own members. So why can't CommNet have such feature?
* Every vessel in the whole network is talking to everyone within its root range model.
* This mod is a testbed and prototype for one feature proposal of constellations in the RemoteTech project. (I am a member of the current RemoteTech team)


Mods required

* Module Manager


License

GNU GENERAL PUBLIC LICENSE, Version 3


Current status

* Radio frequency for every CommNetVessel instance [completed]
* A simple interface to assign a radio frequency [0, 32767] (short-type) to a specific eligible vessel [completed]
* All vessels within the constellation of each radio frequency are connecting to each other (default frequency of 0 is public) [completed]
* Frequency-associated color of vessel icons in KSP's mapview mode [completed]
* Piggyback onto most of KSP's CommNet components and develop a layer onto CommNet for an eventual integration into RemoteTech codebase [completed with on-going refinement effort]
* A control-panel interface to manage a number of constellations and satellites [completed]


Links

Download the releases
List of CommNet classes
RemoteTech's feature requests on constellation
Release thread


What can you help?

Post some information about CommNet workings. I reckon that having such information available to public will help me or a third-party developer to speed up the development of a CommNet-based mod

Edited by TaxiService
updated
Link to comment
Share on other sites

Organisation of KSP CommNet

  • The entire CommNet feature is mainly consisted of CommNetUI, CommNetwork and CommNetVessel, along with a bunch of support classes and data structures
  • CommNetUI is the user interface where a player is seeing and interacting with. This class has the method of interest, UpdateDisplay(), which draws every connection and shows/hides some or all connections, depending on the mode (FirstHop, VesselLinks, Network etc) the player selected.
  • CommNetwork is subclass of the abstract class, Net, which is data-oriented class itself with multiple lists of different types, such as Link, Data and Occluder. This CommNetwork class manages and operates a global network of all CommNode (vessels) and CommLink (connections) objects. For example, the potential connectivity of a pair of two vessels is tested by SetNodeConnection() according to the connection and range rules.
  • Every vessel (Debris, Rover, Flag etc) has the variable 'connection' of CommNetVessel class. This class has a number of methods that are releated to the vessel itself. For example, the class's CalculatePlasmaMult() calculates the multipler of the radio blackout of the reentrying vessel.
  • CommNetScenario is responsible for starting up the CommNetwork and CommNetUI and disabling/enabling CommNet according to Game's settings.

 

Support CommNet class

  • CommNetNetwork seems to be a service layer where vessel and body data are added to and removed from CommNetork. It regularly fires a chain of health-check events for the CommNet.

 

Relevant data structures of the CommNet

  • CommNetHome is a ground station, whose data includes the body, alt, lat and lon.
  • CommNetBody is a celestial body, whose occluder is supplied for CommNetwork to check if the connection is occluded between two vessels.
  • CommNetVessel is a data structure attached to every vessel, even a debris (of course it is null). It has an unused variable of signalDelay, presumed a little gift for a certain mod. It also has a number of network-processing methods you can override: OnNetworkInitialized(), OnNetworkPostUpdate(), OnNetworkPreUpdate() and UpdateComm().
  • CommNode is analogous to a node of a graph. It has some information about antennas, remote-control capability. It is stored in the CommNetwork. The class conveniently provides a comparer, IEqualityComparer<CommNode>.
  • Likewise, CommLink is analogous to an edge of a graph. It contains some information about the vessel-pair connection, such as the signal strength, relay capability of each node.
  • CommPath, implied by its name, is a order-sequence of CommLink.

 

How to substitute KSP's CommNet for your own CommNet

  • Subclass CommNetUI to write your interface
  • Subclass CommNetwork to create your own connection rules
  • Subclass CommNetScenario to replace the KSP's stock CommNetwork and CommNetUI instances with your own subclasses above. You can also override OnLoad and OnSave for your CommNet data. You will need the KSPScenario tag to let KSP know it should run your CommNetScenario subclass instead of the stock CommNetScenario. 
  • Subclass CommNetVessel to write your communication behaviour for each vessel. KSP will automatically substitute the stock CommNetVessel for yours.
  • Bug (Squad is aware of this now): CommNetNetwork class has the hard-coded CommNetwork instance in ResetNetwork() so subclass this class to fix it and then replace it in your CommNetScenario subclass (via reflection, singleton or FindObjectOfType)
Edited by TaxiService
More info
Link to comment
Share on other sites

  • 2 weeks later...

I figure I could use your feedback on these user interfaces (not finalised, non-functional) while I am working on the backend.

  1. This button 'color' will be replaced by a color picker (there is sure thing inside KSP or UnityEngine (Not UnityEditor)?)
  2. Clicking of this buttion 'VesselName' will switch your focus to the specific vessel in the map view IF you are in either tracking station or map view (RemoteTech's satellite list has this functionality)
  3. This button 'Setup' in the Control Panel will just launch the other dialog of Setup without switching to the vessel

nCYYGMI.jpg

Frankly, CommNet is a tough nut to crack. So far, I am trying to slip in my subclasses of CommNet's classes into CommNet. I think I need to read KSP API documentation again.

Edited by TaxiService
Link to comment
Share on other sites

Thanks to a few tips of a certain mod developer, I take over the CommNet components and introduce the test-purpose stuff into. Here's a picture of a single dummy constellation (no functionality yet)

9NLV7G0.png

The codes below are to forcibly substitute for my own CommNet subclasses.

using CommNet;

namespace CommNetConstellation.CommNetLayer
{
    [KSPScenario(ScenarioCreationOptions.AddToAllGames, GameScenes.FLIGHT, GameScenes.TRACKSTATION, GameScenes.SPACECENTER, GameScenes.EDITOR)]
    public class CNCCommNetScenario : CommNetScenario
    {
        //these variables from the base are private so clone your own variables
        private CNCCommNetNetwork network; //getComponent<>() and getComponentInChildren<>() don't work. I tested them
        private CNCCommNetUI ui;

        protected override void Start()
        {
            this.ui = base.gameObject.AddComponent<CNCCommNetUI>();
            this.network = base.gameObject.AddComponent<CNCCommNetNetwork>();
        }
    }
}

 

Edited by TaxiService
Link to comment
Share on other sites

Does this screenshot pleasure you? Two functional constellations of three satellites each, with the CommNet option of extra ground stations turned off.

jnhYqrU.png

The milestone of forcing the CommNet to do my bidding is achieved but I need to clean up the mess of my codes. The next step is to refine the interface designs.

Edited by TaxiService
Link to comment
Share on other sites

  • 2 weeks later...

@TaxiService , so would it be possible to somehow split off the functionality of science transmission from the stock module?

Basically, I would like to have antennas specifically, and ONLY for control/communication, and OTHER antennas that ONLY do science transmission...
Currently, it seems stock antennas ONLY do both together...???

Edited by Stone Blue
Link to comment
Share on other sites

On 1/1/2017 at 10:49 PM, Stone Blue said:

@TaxiService , so would it be possible to somehow split off the functionality of science transmission from the stock module?

Basically, I would like to have antennas specifically, and ONLY for control/communication, and OTHER antennas that ONLY do science transmission...
Currently, it seems stock antennas ONLY do both together...???

Working on this matter since your last post as it is also part of my RemoteTech research on KSP's science-data transmission (eg how much power for full rate of transmission? How much data to transmit at an extreme range?)

Link to comment
Share on other sites

9 hours ago, TaxiService said:

Working on this matter since your last post as it is also part of my RemoteTech research on KSP's science-data transmission (eg how much power for full rate of transmission? How much data to transmit at an extreme range?)

Thanx!
Uh, did I already post asking for this?... If so, i apologize, I have CRS pretty bad, and for real... :P

Link to comment
Share on other sites

  • 4 weeks later...

Announcement

The first pre-release version is released to the public! Here's the link

P.S. Please backup your precious saves before installing this mod.

Spoiler

CommNet Constellation 0.1

What's new?

  • First pre-release version
  • Full functionality of constellations

Requirements

  • ModuleManager
  • Kerbal Space Program 1.2.2

Known issues

  • Random CommNet shutdown (no connections anywhere)

Frequent Asked Questions

  • What happens if you install the CommNet Constellation mod on your existing save?

All existing vessels did not initially have radio frequencies yet so they would have the public frequency temporarily but would not save it. You need to visit each vessel and edit its radio frequency so that this frequency will be saved persistently.

For the first time, all of your existing vessels will be "upgraded" to have Constellation module and related data.

  • What happens if you install the CommNet Constellation mod and start a new game?

Nothing bad would happen. Just edit the radio frequency of a ship in the editor and launch away!

  • What happens if you remove the CommNet Constellation mod from your game folder?

There are no parts introduced by this mod so your existing vessels would be safe. However, the entire CommNet would revert to the network of the single type. This means every vessel would yell at each other within its range.

  • How do I edit my vessel's radio frequency?

Every command part has its own frequency (meaning that your vessel can have multiple frequencies but can only utilize one frequency at any time). In the editor or flight, you can right-click each command part to open its part-action menu and then click the CommNet Constellation button to launch an user interface for this frequency.

  • How does the overall radio frequency of a vessel with multiple frequencies get chosen?

The overall frequency is the frequency of the command part that is added in the order in the editor. So if your root part is a command part, that part is the first one to utilize its frequency as the vessel's frequency.

  • How can I overwrite all frequencies of a vessel to the same frequency?

In the control panel in either flight or tracking station, you can open up the setup button of that vessel and update the frequency that will be forced upon every command part of the same vessel.

Edited by TaxiService
Link to comment
Share on other sites

  • 2 weeks later...

Announcement

The pre-release version 0.2 is released (link). It contains several improvements and one issue fix.

P.S. Please backup your precious saves before installing this mod.

Spoiler

What's new?

  • Code cleanup, documentation and logging
  • Enhance ground-station marks
  • Cache of CommNet Vessels
  • Fix the issue of random CommNet shutdown (no connections anywhere)

Requirements

  • ModuleManager
  • Kerbal Space Program 1.2.2

Known issues

 

Edited by TaxiService
Link to comment
Share on other sites

Announcement

The pre-release version 0.3 is released (link). You can filter vessels out through KSP's MapView filters and sort the vessel list!

P.S. Please backup your precious saves before installing this mod.

Spoiler

What's new?

  • New pretty logo for application launcher and thread
  • Reduce verbose log noise and add more error handling
  • Fix another issue of CommNetwork not working under certain circumstances
  • Revert the ground-station marks' camera-distance calculation back to the RemoteTech approach
  • Add a new feature for constellation members to talk to members only (not to public ones)
  • Tie the vessel list to KSP's MapView filters
  • Add a sort functionality to the vessel list
  • Automatic upgrade system for first-time and subsequent installations of this mod

Requirements

  • ModuleManager
  • Kerbal Space Program 1.2.2

Known issues

 

LOOK!

W1CGVod.jpg

Edited by TaxiService
Link to comment
Share on other sites

  • 3 weeks later...

Announcement

The pre-release version 0.4 is released (link). This is possibly the last pre-release version before I launch an official version 1.0 in the sub-forum of add-on releases.

P.S. Please backup your precious saves before installing this mod.

Spoiler

CommNet Constellation 0.4

What's new?

  • Move the dialog messages to KSP's ScreenMessage system
  • Remove the unnecessary temporary storage for user inputs

Requirements

  • ModuleManager
  • Kerbal Space Program 1.2.2

Known issues

 

Link to comment
Share on other sites

12 hours ago, stk2008 said:

Realy silly question does this work well with Remotetech or does it do more etc I am a noob so :P

No, it won't co-exist with RemoteTech 1.x branch because RT 1.x disables CommNet and operates its own network (until RT 2.x under development would run on CommNet). CommNet Constellation depends on CommNet to check potential connections between two satellites (think it as additional regulations on connections compared to CommNet's stock open-nature)

Edited by TaxiService
Link to comment
Share on other sites

  • 2 weeks later...

It seems I've found an issue when this is used with ModularFlightItegrator. It spams the log and connections don't work.

I'm submitting an issue to Github, with output_log attached.

EDIT: Or not.. I can't get it to reproduce for a log. Sorry if this isn't actually an issue!

EDIT2: Found it! It's actually a combination of MFI and Persistent Dynamic Pod Names, submitting the Github issue now.

Edited by DerpyFirework
Link to comment
Share on other sites

  • 4 weeks later...
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...