DuoDex

Crowd Sourced Science-Biome Reports Everywhere! (May 31st) [4.1]

What do you want next?  

659 members have voted

  1. 1. What do you want next?

    • Expand, with an eye towards support for other science mods.
      325
    • Make contributing easier!
      105
    • Add support for the planet pack mods.
      221


Recommended Posts

7 hours ago, Fwiffo said:

Hey @DuoDex I noticed CKAN still says this isn't compatible with 1.2.  I asked them to address that; hope that's ok.

That's because it'snot compatible with 1.2. The main function of the mod is broken. 

Share this post


Link to post
Share on other sites

Has anyone looked into a small c# mod that might be able to rotate the given reports?
I did not work on the science parts explicit, but taking a look does not hurt.

Share this post


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

Has anyone looked into a small c# mod that might be able to rotate the given reports?
I did not work on the science parts explicit, but taking a look does not hurt.

I am not a proficient C# coder...if anyone is though... :wink:

Share this post


Link to post
Share on other sites
21 minutes ago, DuoDex said:

I am not a proficient C# coder...if anyone is though... :wink:

Let me take a quick look; if it is possible at all to hook in there.

EDIT:
Hmm so with a brief look into it, it seems quite possible.
But you guys will need a coder that is focusing on this; I'm already working on welding.

Also no need to be afraid of coding c# and Visual Studio is providing a lot of help.
@DuoDex someone from the science mods with source code might be helpful.

Edited by Alewx
SitRep

Share this post


Link to post
Share on other sites

So, I've been using some of my downtime at work (sssh, don't tell anybody) to look into this issue a little further. Some of what I'm about to babble about may already be known, but for what it's worth, here it is.

The Problem

The first thing the game has to do with regards to this is to read all the entries in the RESULTS block for each ExperimentID. Each entry's name (what I will call from here on in the "Where The Heck Am I" value) consists of a concatination of in-game body (e.g. "Kerbin"), the situation (e.g. "InSpaceLow") and the biome (if applicable, e.g. "Water"). The body and biome may be omitted, and the situation may be only partially given (e.g. "Space").

As it reads them, it stuffs them as key => value pairs into what I'd call a hash or associative array and what C# apparently calls a Dictionary (you say potato...). When it encounters a duplicate (say, it already recorded a definition for KerbinInSpaceLow, and now found another one) it will postpend a ( * ) onto the key name. Each additional duplicate gets another ( * ) (e.g KerbinInSpaceLow, KerbinInSpaceLow*, KerbinInSpaceLow**, etc).

For reference, all the above is in the ScienceExperiment class. Also see the ScienceSubject class for the formulation of the "Where The Heck Am I" string.

Here's an example of what the Experiment Results Dictionary might look like, given the following configuration (I wrote a little DLL to dump specific stuff to the logfile):

@EXPERIMENT_DEFINITION[*]:HAS[#id[temperatureScan]]:FINAL
{
    !RESULTS {}
    RESULTS
    {
        default = Default Temperature message one.
        default = Default Temperature message two.
        default = Default Temperature message three.
        KerbinInSpaceLow = Kerbin Space Low Temperature message one.
        KerbinInSpaceLow = Kerbin Space Low Temperature message two.
        KerbinInSpaceLow = Kerbin Space Low Temperature message three.
        MunInSpaceLow = Temperature message. You should only ever get this message in low orbit of Mun.
    }
}

[LOG 08:35:33.404] [DBG] temperatureScan result key: default
[LOG 08:35:33.405] [DBG] temperatureScan result key: default*
[LOG 08:35:33.405] [DBG] temperatureScan result key: default**
[LOG 08:35:33.405] [DBG] temperatureScan result key: KerbinInSpaceLow
[LOG 08:35:33.406] [DBG] temperatureScan result key: KerbinInSpaceLow*
[LOG 08:35:33.406] [DBG] temperatureScan result key: KerbinInSpaceLow**
[LOG 08:35:33.406] [DBG] temperatureScan result key: MunInSpaceLow

 

When one performs the experiment, it constructs the WTHAI string and passes it to the ResearchAndDevelopment.GetResults() method. This is where I think things fall off the rails.

If the WHTAI string EXACTLY matches a value in the Experiments Results Dictionary (e.g. given KerbinInSpaceLow and finding an entry KerbinInSpaceLow), it will use it and stop looking. The problem araises that we have some duplicates entries in the dictionary that it doesn't try (KerbinInSpaceLow* and KerbinInSpaceLow**).

If it doesn't find an exact match, it starts building a list of any dictionary entry that is contained within the WTHAI string. For example, if we added a "Space = Temperature measurement from SPACE!" entry to our MM file above, the "Space" dictionary entry would be contained within the given WTHAI string of "KerbinInSpaceLow", thus it would add it to the list. Also, it strips off any trailing ( * ) characters as it does the comparison, so if we forget the exact match above for the moment, now we have three "KerbinInSpaceLow" entries, and since the WTHAI string of "KerbinInSpaceLow" is technically contained within each of these entries, they would get added to the list. Once the list is built, if it's not empty, it picks a random one to use.

If the list is empty, it sees if there is an EXACT key in the dictionary for "default" and if so uses it. It does not appear to do any wildcard checking if it reaches this stage.

If all else fails, it postpends "Data Acquired" to the experiment title (e.g. "Temperature Scan Data Acquired").

Oy vey...

Workarounds?

With a little experimenting, I found that if I postpended a ( * ) to fully specific WTHAI strings in my MM file, I could get it to randomly rotate (since technically speaking there was no direct match anymore):

@EXPERIMENT_DEFINITION[*]:HAS[#id[temperatureScan]]:FINAL
{
    !RESULTS {}
    RESULTS
    {
        default = Default Temperature message one.
        default = Default Temperature message two.
        default = Default Temperature message three.
        KerbinInSpaceLow* = Kerbin Space Low Temperature message one.
        KerbinInSpaceLow* = Kerbin Space Low Temperature message two.
        KerbinInSpaceLow* = Kerbin Space Low Temperature message three.
        MunInSpaceLow = Temperature message. You should only ever get this message in low orbit of Mun.
    }
}

[LOG 10:02:34.333] [DBG] temperatureScan result key: default
[LOG 10:02:34.333] [DBG] temperatureScan result key: default*
[LOG 10:02:34.334] [DBG] temperatureScan result key: default**
[LOG 10:02:34.334] [DBG] temperatureScan result key: KerbinInSpaceLow*
[LOG 10:02:34.335] [DBG] temperatureScan result key: KerbinInSpaceLow**
[LOG 10:02:34.335] [DBG] temperatureScan result key: KerbinInSpaceLow***
[LOG 10:02:34.335] [DBG] temperatureScan result key: MunInSpaceLow

 

But, doing the same thing for the default string, it wouldn't use any of them and would defailt to the "Data Acquired" message (because it doesn't appear to check for wildcards on defaults). This is really funny because the stock ScienceDefs file contains three "default" entries for the surface sample experiment... which obviously won't rotate at this point.

So... now what?

My C#-fu is that of a rank beginner amateur, so I'm not sure without concocting an extension of ModuleScienceExperiment (which seems like an awful lot of work) if there's any way to get around this with a 3rd party plugin...

In the mean time I'll look through the bugtracker and if I can't find anything already in there I will submit it.

 

Share this post


Link to post
Share on other sites
5 hours ago, akardam said:

So, I've been using some of my downtime at work (sssh, don't tell anybody) to look into this issue a little further. Some of what I'm about to babble about may already be known, but for what it's worth, here it is.

The Problem

The first thing the game has to do with regards to this is to read all the entries in the RESULTS block for each ExperimentID. Each entry's name (what I will call from here on in the "Where The Heck Am I" value) consists of a concatination of in-game body (e.g. "Kerbin"), the situation (e.g. "InSpaceLow") and the biome (if applicable, e.g. "Water"). The body and biome may be omitted, and the situation may be only partially given (e.g. "Space").

As it reads them, it stuffs them as key => value pairs into what I'd call a hash or associative array and what C# apparently calls a Dictionary (you say potato...). When it encounters a duplicate (say, it already recorded a definition for KerbinInSpaceLow, and now found another one) it will postpend a ( * ) onto the key name. Each additional duplicate gets another ( * ) (e.g KerbinInSpaceLow, KerbinInSpaceLow*, KerbinInSpaceLow**, etc).

For reference, all the above is in the ScienceExperiment class. Also see the ScienceSubject class for the formulation of the "Where The Heck Am I" string.

Here's an example of what the Experiment Results Dictionary might look like, given the following configuration (I wrote a little DLL to dump specific stuff to the logfile):


@EXPERIMENT_DEFINITION[*]:HAS[#id[temperatureScan]]:FINAL
{
    !RESULTS {}
    RESULTS
    {
        default = Default Temperature message one.
        default = Default Temperature message two.
        default = Default Temperature message three.
        KerbinInSpaceLow = Kerbin Space Low Temperature message one.
        KerbinInSpaceLow = Kerbin Space Low Temperature message two.
        KerbinInSpaceLow = Kerbin Space Low Temperature message three.
        MunInSpaceLow = Temperature message. You should only ever get this message in low orbit of Mun.
    }
}

[LOG 08:35:33.404] [DBG] temperatureScan result key: default
[LOG 08:35:33.405] [DBG] temperatureScan result key: default*
[LOG 08:35:33.405] [DBG] temperatureScan result key: default**
[LOG 08:35:33.405] [DBG] temperatureScan result key: KerbinInSpaceLow
[LOG 08:35:33.406] [DBG] temperatureScan result key: KerbinInSpaceLow*
[LOG 08:35:33.406] [DBG] temperatureScan result key: KerbinInSpaceLow**
[LOG 08:35:33.406] [DBG] temperatureScan result key: MunInSpaceLow

 

When one performs the experiment, it constructs the WTHAI string and passes it to the ResearchAndDevelopment.GetResults() method. This is where I think things fall off the rails.

If the WHTAI string EXACTLY matches a value in the Experiments Results Dictionary (e.g. given KerbinInSpaceLow and finding an entry KerbinInSpaceLow), it will use it and stop looking. The problem araises that we have some duplicates entries in the dictionary that it doesn't try (KerbinInSpaceLow* and KerbinInSpaceLow**).

If it doesn't find an exact match, it starts building a list of any dictionary entry that is contained within the WTHAI string. For example, if we added a "Space = Temperature measurement from SPACE!" entry to our MM file above, the "Space" dictionary entry would be contained within the given WTHAI string of "KerbinInSpaceLow", thus it would add it to the list. Also, it strips off any trailing ( * ) characters as it does the comparison, so if we forget the exact match above for the moment, now we have three "KerbinInSpaceLow" entries, and since the WTHAI string of "KerbinInSpaceLow" is technically contained within each of these entries, they would get added to the list. Once the list is built, if it's not empty, it picks a random one to use.

If the list is empty, it sees if there is an EXACT key in the dictionary for "default" and if so uses it. It does not appear to do any wildcard checking if it reaches this stage.

If all else fails, it postpends "Data Acquired" to the experiment title (e.g. "Temperature Scan Data Acquired").

Oy vey...

Workarounds?

With a little experimenting, I found that if I postpended a ( * ) to fully specific WTHAI strings in my MM file, I could get it to randomly rotate (since technically speaking there was no direct match anymore):


@EXPERIMENT_DEFINITION[*]:HAS[#id[temperatureScan]]:FINAL
{
    !RESULTS {}
    RESULTS
    {
        default = Default Temperature message one.
        default = Default Temperature message two.
        default = Default Temperature message three.
        KerbinInSpaceLow* = Kerbin Space Low Temperature message one.
        KerbinInSpaceLow* = Kerbin Space Low Temperature message two.
        KerbinInSpaceLow* = Kerbin Space Low Temperature message three.
        MunInSpaceLow = Temperature message. You should only ever get this message in low orbit of Mun.
    }
}

[LOG 10:02:34.333] [DBG] temperatureScan result key: default
[LOG 10:02:34.333] [DBG] temperatureScan result key: default*
[LOG 10:02:34.334] [DBG] temperatureScan result key: default**
[LOG 10:02:34.334] [DBG] temperatureScan result key: KerbinInSpaceLow*
[LOG 10:02:34.335] [DBG] temperatureScan result key: KerbinInSpaceLow**
[LOG 10:02:34.335] [DBG] temperatureScan result key: KerbinInSpaceLow***
[LOG 10:02:34.335] [DBG] temperatureScan result key: MunInSpaceLow

 

But, doing the same thing for the default string, it wouldn't use any of them and would defailt to the "Data Acquired" message (because it doesn't appear to check for wildcards on defaults). This is really funny because the stock ScienceDefs file contains three "default" entries for the surface sample experiment... which obviously won't rotate at this point.

So... now what?

My C#-fu is that of a rank beginner amateur, so I'm not sure without concocting an extension of ModuleScienceExperiment (which seems like an awful lot of work) if there's any way to get around this with a 3rd party plugin...

In the mean time I'll look through the bugtracker and if I can't find anything already in there I will submit it.

 

My C# is even more of a beginner-level than yours :) Your help and advice is greatly appreciated.

Share this post


Link to post
Share on other sites
11 hours ago, DuoDex said:

My C# is even more of a beginner-level than yours :) Your help and advice is greatly appreciated.

Be that as it may, I don't know if I can come up with a solution... but my curiosity and OCD will likely combine forces to ensure I give it the good 'ol college try.

One clarifying point I wanted to add is that the WTHAI string omits the biome if the biome is masked out. For example I was doing my temperatureScan tests from orbit (easy to get there with the cheat menu) and since its biomeMask is 7 (meaning biomes only apply to the result if landed, splashed, or flying low) the WTHAI string of KerbinInSpaceLow would exactly match the Dictionary value of KerbinInSpaceLow. If I'd been on the surface with a WTHAI string KerbinSrfLandedKSC, and only had a Dictionary value of KerbinSrfLanded, then it likely would have tried random search mode.

Pardon me for somewhat thinking out loud but I'm trying to put together that bug report for the tracker.

Share this post


Link to post
Share on other sites

I'm sad to hear this isn't working in 1.2, but I'm glad to hear someone's trying to fix it. :)

I'd help, but my C# skills are on the level of "that's when you stab someone with a pointer, right?" :sticktongue:

Share this post


Link to post
Share on other sites

Hello all,

I was interested in the mod and sorry to hear that it was not compatible with 1.2. So looking through this thread, I saw the problem description above and decided to take a crack at it myself as I know C#.

So, I went ahead and downloaded the source zip from github, but I could not find any code inside?! There is only the config files containing the experiment strings. Where can I find the code itself?

Share this post


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

Hello all,

I was interested in the mod and sorry to hear that it was not compatible with 1.2. So looking through this thread, I saw the problem description above and decided to take a crack at it myself as I know C#.

So, I went ahead and downloaded the source zip from github, but I could not find any code inside?! There is only the config files containing the experiment strings. Where can I find the code itself?

The mod as released didn't need any code - It relied on KSP's ability to add results and randomly choose which of them would be presented.  This is the ability that was broken in 1.2.  If you want to try writing a code module to override stock KSP's behavior (to get back what it was), go ahead.  :wink:

Share this post


Link to post
Share on other sites

Hmm, I had suspected this could be the case :( Now, it sounds like a lot more difficult of a job. I would still like to help, but I would not know where to begin at all! Would anyone like to point me in the correct direction? Would it be helpful if someone just sent me the relevant code and I could maybe suggest a patch?

Share this post


Link to post
Share on other sites
22 minutes ago, canisin said:

Hmm, I had suspected this could be the case :( Now, it sounds like a lot more difficult of a job. I would still like to help, but I would not know where to begin at all! Would anyone like to point me in the correct direction? Would it be helpful if someone just sent me the relevant code and I could maybe suggest a patch?

Anyone who has access to the relevant code would be on Squad's payroll, and under contract not to reveal it.  :wink:

Share this post


Link to post
Share on other sites

Oh? I thought it was like there was an SDK and we could see some of the code or something. But then, how did @akardam mention the problems as if they were looking at the code? I am confused :(

 

Share this post


Link to post
Share on other sites
1 hour ago, canisin said:

Oh? I thought it was like there was an SDK and we could see some of the code or something. But then, how did @akardam mention the problems as if they were looking at the code? I am confused :(

 

You could ask @akardamakardamakardam about it, he seemed to have a handle on it.

Share this post


Link to post
Share on other sites
11 hours ago, jokiab said:

Was just wondering if this is official dead?

No, but it is currently broken. Maybe functionality it needs will be fixed in 1.3

Share this post


Link to post
Share on other sites
On 1/7/2017 at 10:45 AM, akardam said:

snippity - 

As it reads them, it stuffs them as key => value pairs into what I'd call a hash or associative array and what C# apparently calls a Dictionary (you say potato...). When it encounters a duplicate (say, it already recorded a definition for KerbinInSpaceLow, and now found another one) it will postpend a ( * ) onto the key name. Each additional duplicate gets another ( * ) (e.g KerbinInSpaceLow, KerbinInSpaceLow*, KerbinInSpaceLow**, etc).

- snip

So it's a KSP 1.2 bit that's broken for this to work, to do with the "WTHAI" string and all that comes from that?  That's a shame.

 

I don't know how much manipulation room we have but I immediately thought, why not make the value of the key-value-pair a collection... so e.g. KerbinInSpaceLow is the key, and remains so for any duplicate entries found, none of the * appending, but the experiment text for subsequent "KerbinInSpaceLow"s is just added to the value collection.  TBH I haven't looked at this any further than this page of posts, however...so...dunno what background there is or isn't.

Edited by Doslidnyk

Share this post


Link to post
Share on other sites
On 3/9/2017 at 0:34 AM, DuoDex said:

No, but it is currently broken. Maybe functionality it needs will be fixed in 1.3

Out of curiosity: Has anyone tried this with the 1.2.9 beta?  Does it work?

Share this post


Link to post
Share on other sites

I have a weird idea, but sadly I've not the skills to try that by myself: would it be possible to replace the stock experiment with custom ones with a MM patch using the same models that stock offers? If yes, you can use the custom science reports to show just the crowd sourced ones, am I wrong?

Edited by Nansuchao

Share this post


Link to post
Share on other sites
On 6.4.2017 at 3:03 PM, Nansuchao said:

I have a weird idea, but sadly I've not the skills to try that by myself: would it be possible to replace the stock experiment with custom ones with a MM patch using the same models that stock offers? If yes, you can use the custom science reports to show just the crowd sourced ones, am I wrong?

Problem is as soon as you remove the patch for any reason all your experiments are gone, you stil got the science but the reports and everything else is gone.

 

Share this post


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

Problem is as soon as you remove the patch for any reason all your experiments are gone, you stil got the science but the reports and everything else is gone.

 

Isn't that the problem with any mods?

Share this post


Link to post
Share on other sites

in my signature there is "science - full reward" for example it makes you get always 100% on recovery, wich is nice. And if you deinstall it nothing will hapen besides the fact that you wont get 100% on mystery goo recovery etc.... but what you got is fixed and if you lookup your science reports in R&D theyll stil be 100% for those you recovered with the mod active.

If you creat new experiments and something happens to those experiments .. module manager not up to date etc... it's all gone. I don't know much about the save system of ksp but I guess if you reinstall the mod later youll have to do it all again..

Share this post


Link to post
Share on other sites
16 minutes ago, maculator said:

in my signature there is "science - full reward" for example it makes you get always 100% on recovery, wich is nice. And if you deinstall it nothing will hapen besides the fact that you wont get 100% on mystery goo recovery etc.... but what you got is fixed and if you lookup your science reports in R&D theyll stil be 100% for those you recovered with the mod active.

If you creat new experiments and something happens to those experiments .. module manager not up to date etc... it's all gone. I don't know much about the save system of ksp but I guess if you reinstall the mod later youll have to do it all again..

Oh, I didn't imagine something like that. Maybe I can make a test with DMagic Orbital Science?

Share this post


Link to post
Share on other sites

You mean to test if the experiments get lost and you'll have to redo them? Since OS has unique experiments a test would work I guess.

Share this post


Link to post
Share on other sites

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.