Jump to content

[1.10.1+] Contract Configurator [v1.30.5] [2020-10-05]


nightingale

Recommended Posts

15 minutes ago, Maxsimal said:

@nightingale

Hi there.  We've got a bit of a minithread in the RP0 forum going trying to figure out the source of major stutter due /memory allocation & garbage collection that happens in career mode but not nearly as much in sandbox when you play RP0.  For instance, right now I have GC stutter every 5-6 seconds in career, and its 10x less frequent in sandbox

Do you know if there's a good way for us to rule in/rule out CC, without removing the mod completely?  RP0 doesn't like having CC not available.  Also, do you think there might be an issue when there are a lot of contracts both as potential contracts (due to a pack like historical missions) and also completed (my save is >10MB due mainly to data from completed contracts.) 

I realize this is highly speculative and we don't know for sure what's causing it, it may not have anything to do with contracts at all, but any insight would be appreciated.

Well, there should've been been some pretty big improvements since 1.15.x when the contract generation was almost completely disabled in flight (almost, because there's the auto-accept contracts like the record contracts in RP-0 that need to be generated in flight).  There are other areas in some of the parameters that I know have the potential to create lots of garbage, but are difficult to rewrite because of the way they were designed.  However, I don't have any hard data to know how bad those are.

So that's at least two possibilities within Contract Configurator - garbage from contract generation, garbage from parameters (active contracts).

So to rule in/out contract generation:

  • Disable/remove all the record contracts.  Does that have a noticeable change?

To rule in/out the parameters:

  • What active contracts do you have?  If you cancel all of those contracts, does the garbage situation in flight change drastically?

It may also be worth doing a test without Historical Missions - the sheer number of contracts in that contract pack may stress the system in a completely different way (and could provide another hint as to an avenue that I need to investigate).

The more hard data I have, the better I'll be able to direct myself towards specific problem areas.

Link to comment
Share on other sites

@nightingale I tried to test the microstutter issue on a clean install of a minimum set of RP-0 mods but nothing very definitive I'm afraid.

Set-up: totally clean copy of 1.1.3. Using CKAN add RSS with low-res textures; add RO (required mods only no recommended or suggested) and then RP-0 (again required only).

Ran the game three times creating a new normal difficulty career save each time. The same simple sounding rocket craft file was copied into each save after it was created.

Save A. Left everything at defaults and accepted initial contracts (launch vessel and pass Karman line). Perceptible microstutters approx every 4 seconds

Save B. Used CC toolbar icon to disable all contracts immediately after load. Microstutters still present could not detect any difference in duration or spacing.

Save C. Deleted CC folder from GameData before launching KSP. Could not detect microstutters on initial rocket launch.

Link to comment
Share on other sites

@nightingale

Ok, did some testing.  My baseline was GC happening in flight ~5seconds according to memgraph.

  • Removing Historical Contracts had no appreciable affect.  I deleted it through ckan.
  • Disabling RP0 contracts through the CC menu and cancelling the existing records contracts upped my interval to 10-11 seconds
  • Cancelling all other contracts so my contract window was clear further increased my interval to ~20 seconds.  I had 7 contracts open at that point, 6 for satellite placement, one for a scan sat scan of a planet.
  • Renabling RP0 contracts, so I had 2 active records contracts again, put me back at 10-11 seconds for collection.

So yes, a pretty appreciable difference, it's much more playable with GC happening that much slower.  It seems that both parameters and contract generation are having an impact.

Can I provide you with anything else?  I'm happy to help out in any way, sorry for the slow reply on testing was afk for a bit here.

Edit:  Btw I am on CC 1.17.0, installed through ckan.  I'm using Memgraph  to look at ksp heap memory utilization.

Edited by Maxsimal
Link to comment
Share on other sites

I've noticed something with recent versions (maybe the last 2) of CC - when I'm looking at the now much longer contract list, for a period of time after going into the admin building, the list shifts around (seems like additions/removals). If I've selected a contract, it will get de-selected several times. It seems to "settle" after a while. Is this only me? If so, probably a mod conflict of some kind, or a funky contract pack...?

Edited by AccidentalDisassembly
Link to comment
Share on other sites

1 hour ago, AccidentalDisassembly said:

I've noticed something with recent versions (maybe the last 2) of CC - when I'm looking at the now much longer contract list, for a period of time after going into the admin building, the list shifts around (seems like additions/removals). If I've selected a contract, it will get de-selected several times. It seems to "settle" after a while. Is this only me? If so, probably a mod conflict of some kind, or a funky contract pack...?

I noticed this a while back but never got a chance to investigate.  Can you raise an issue on GitHub for me?

Link to comment
Share on other sites

Noticing that Any is not really applying when one of the option is a NEEDS:

 

//KSP-IslandPrep - Kerbal Space Program: KSC Island Airfield Preparation

CONTRACT_TYPE
{

    sortKey = b2

//REQUIREMENTS FOR CONTRACT TO APPEAR

    REQUIREMENT
    {
        name = Any
        type = Any
        title = Complete KSP Island Survey or KSP Island Landing
    
        REQUIREMENT
        {
            name = CompleteContract
            type = CompleteContract
            
            contractType = KSP-IslandSurvey
            minCount = 1

        }
        
        REQUIREMENT:NEEDS[BDArmory]
        {
            name = CompleteContract
            type = CompleteContract
            
            contractType = KSP-IslandLandingBD
            minCount = 1

        }

    }

 

Mission Control displays the first as met (when I meet it), but the second as unmet (beacuse i've not played that contract yet), so then the KSP-IslandPrep contract is never offered. In short, it appears Mission Control is ignoring the Any type for the requirement and is instead requiring both be met before offering KSP-IslandPrep.

Link to comment
Share on other sites

I think I discovered a more serious bug though with contract generation for repeatable contracts in the same group.

[LOG 00:37:39.182] Added -1.000012 (-1) reputation: 'ContractDecline'.
[LOG 00:37:39.192] [DEBUG] ContractConfigurator.ConfiguredContract: Initializing contract: CONTRACT_TYPE [Charter-Flight-4]
[LOG 00:37:39.205] [DEBUG] ContractConfigurator.ConfiguredContract: Initialized contract: CONTRACT_TYPE [Charter-Flight-4]
[LOG 00:37:39.366] Added -1.000011 (-1) reputation: 'ContractDecline'.
[LOG 00:37:39.375] [DEBUG] ContractConfigurator.ConfiguredContract: Initializing contract: CONTRACT_TYPE [Charter-Flight-4]
[LOG 00:37:39.388] [DEBUG] ContractConfigurator.ConfiguredContract: Initialized contract: CONTRACT_TYPE [Charter-Flight-4]
[LOG 00:37:39.549] Added -1.00001 (-1) reputation: 'ContractDecline'.
[LOG 00:37:39.558] [DEBUG] ContractConfigurator.ConfiguredContract: Initializing contract: CONTRACT_TYPE [Charter-Flight-4]
[LOG 00:37:39.572] [DEBUG] ContractConfigurator.ConfiguredContract: Initialized contract: CONTRACT_TYPE [Charter-Flight-4]
[LOG 00:37:39.732] Added -1.000009 (-1) reputation: 'ContractDecline'.

I have a KSC Air Charters group in Mission Control with Charter Flight 4, 45, and 5 in it.  45 and 5 are depending on 4 completing.   All three are repeatable contracts with max completions = 0. When I complete Charter Flight 4, it is offered over and over again, and Flights 45 and 5 are never offered - even if I constantly decline Flight 4 as in the log above. Only when I set Charter Flight 4 to max completions = 1 does Flight 45 generate, but then never Flight 5 until I set Flight 45 to max completions = 1.  

It seems as if you can duplicate this by setting a contract to max completions = 0, and have its sort order or alphbetical contract name first before all others. Other equal contracts in the group will never generate, only that one first listed contract.

Thoughts?

edit: reported here: https://github.com/jrossignol/ContractConfigurator/issues/560

Edited by inigma
Link to comment
Share on other sites

I'm seeing this in my debug toolbar:

Spoiler

[Warning]: ContractConfigurator.ConfiguredContract: Error loading contract for contract type 'RT_MoonRelay'.  The contract type either failed to load or was uninstalled.

[Warning]: ContractConfigurator.ConfiguredContract: Error loading contract for contract type 'RT_InnerPlanetRelay'.  The contract type either failed to load or was uninstalled.

[Warning]: ContractConfigurator.ConfiguredContract: Error loading contract for contract type 'RT_GasGiantRelay'.  The contract type either failed to load or was uninstalled.

 

I don't think I've uninstalled anything. I installed the normal way in CKAN. I have a few contract packs installed as well, including tourism, scansat, unmanned, remote tech, K-files, and anomaly.

Link to comment
Share on other sites

@inigma - I removed the short-circuit in the Any/All requirements that was causing this (it wouldn't keep checking if it found one that caused the parent condition to be met).  No idea what's up with the other one, but will look into it as time permits.

@charliepryor - It's due to the changes I made to that contract pack a while back (with the Contract Configurator 1.15.x update).  You can safely ignore those.

Link to comment
Share on other sites

So I tried to find an older post from someone else to quote from, but I couldn't. How come all the CC contracts are always available? No matter what I complete, another contract always takes its place (Immediately). Does not CC have some sort of randomization for how long a contract stays in limbo before it shows up again? Shouldn't it?  It sure seemed like stock KSP had that kind of effect. Just wondering...

Link to comment
Share on other sites

On 8/21/2016 at 0:11 AM, nightingale said:

@inigma - I removed the short-circuit in the Any/All requirements that was causing this (it wouldn't keep checking if it found one that caused the parent condition to be met).  No idea what's up with the other one, but will look into it as time permits.

@charliepryor - It's due to the changes I made to that contract pack a while back (with the Contract Configurator 1.15.x update).  You can safely ignore those.

Great!

Ya https://github.com/jrossignol/ContractConfigurator/issues/560 is sort of a major GAP breaker. Without repeatable contracts, GAP is essentially ground to a halt.  Here's hoping you can find a moment to look into it. :)

Link to comment
Share on other sites

Hi, I've been running into a recurring error in my logs. I found it when trying to diagnose an issue with another mod, so not sure if it's actually causing any noticeable negative effect itself, but thought I'd mention it. 

Repeated error that I noticed: http://pastebin.com/vUgAHQbC

Full log: https://1drv.ms/u/s!Aj0TjF5ApmITj9oYaKsfgfTxLDS1Uw

 

 

Link to comment
Share on other sites

Hello,

I think there is an issue with resources stored in a list. When I want to set a HasResource parameter like this :

PARAMETER
{
	name = HasMonoPropellant
	type = HasResource
	resource = @RP0:monoPropellant.Random()
	minQuantity = Round(Random(20.0, 100.0), 10.0)
}

Look my previous post here to see the definition of the resource list.
That give me this error :

[ERR 08:16:54.781] ContractConfigurator.HasResourceFactory: CONTRACT_TYPE 'repeatableEPOComSatContract', PARAMETER 'HasMonoPropellant' of type 'HasResource': Error parsing resource

[EXC 08:16:54.782] InvalidOperationException: Operation is not valid due to the current state of the object
        System.Linq.Enumerable.First[PartResourceDefinition] (IEnumerable`1 source)^M
        ContractConfigurator.ConfigNodeUtil.ParseResourceValue (System.String name)^M
        ContractConfigurator.ConfigNodeUtil.ParseSingleValue[PartResourceDefinition] (System.String key, System.String stringValue, Boolean allowExpression)^M
        ContractConfigurator.ConfigNodeUtil.ParseValue[PartResourceDefinition] (.ConfigNode configNode, System.String key, Boolean allowExpression)^M
        ContractConfigurator.ConfigNodeUtil.ParseValue[PartResourceDefinition] (.ConfigNode configNode, System.String key, System.Action`1 setter, IContractConfiguratorFactory obj, .PartResourceDefinition defaultValue, System.Func`2 validation)^M
        UnityEngine.Debug:LogException(Exception)^M
        ContractConfigurator.LoggingUtil:LogException(Exception)^M
        ContractConfigurator.ConfigNodeUtil:ParseValue(ConfigNode, String, Action`1, IContractConfiguratorFactory, PartResourceDefinition, Func`2)^M
        ContractConfigurator.ConfigNodeUtil:ParseValue(ConfigNode, String, Action`1, IContractConfiguratorFactory)^M
        ContractConfigurator.HasResourceFactory:Load(ConfigNode)^M
        ContractConfigurator.ParameterFactory:GenerateParameterFactory(ConfigNode, ContractType, ParameterFactory&, ParameterFactory)^M
        ContractConfigurator.ParameterFactory:GenerateParameterFactory(ConfigNode, ContractType, ParameterFactory&, ParameterFactory)^M
        ContractConfigurator.ContractType:Load(ConfigNode)^M
        ContractConfigurator.<LoadContractConfig>d__26:MoveNext()^M
        ContractConfigurator.ContractConfigurator:Update()

Seems that the PartResourceDefinition is not the expected type for the resource.
The problem doesn't appear if I first store the resource into a temporary DATA node in my contract.

Link to comment
Share on other sites

19 hours ago, DarkonZ said:

So I tried to find an older post from someone else to quote from, but I couldn't. How come all the CC contracts are always available? No matter what I complete, another contract always takes its place (Immediately). Does not CC have some sort of randomization for how long a contract stays in limbo before it shows up again? Shouldn't it?  It sure seemed like stock KSP had that kind of effect. Just wondering...

It's a side effect of the new Mission Control changes. Basically it's up to Contract pack authors to now introduce that kind of randomisation if they want it.

I've put it into Bases and Stations and CleverSats (but may not be working 100% until the upcoming version of CC).

TL:DR ask Contract authors to put it in.

Link to comment
Share on other sites

@inigma - I've got #560 on my list of items that need to be looked at...  haven't had much time for modding the last little bit, unfortunately.  It is top priority though.

@Fobok - Something is breaking the Sun...  can't really say much beyond that.

@hargn - That's a bug, think I've got it fixed, can you try the dev dll from GitHub and let me know if that solves your issue?

Link to comment
Share on other sites

2 hours ago, nightingale said:

@hargn - That's a bug, think I've got it fixed, can you try the dev dll from GitHub and let me know if that solves your issue?

@nightingale your fix is working well! Thanks for you fix.

And if I may add another request, could you please update the wiki page of the orbit generator ?
I think that misses informations for the FIXED_ORBIT properties (SMA, ECC, ...) : real property name, unit and range would be welcomed.
Or, even KSP does not implement orbit's precession, I will be greatly happy with a Sun-Synchronous random orbit generator, but it could be hard to have a generic implementation for all celestial bodies (when they can have it).

Edited by hargn
Link to comment
Share on other sites

2 hours ago, nightingale said:

@Fobok - Something is breaking the Sun...  can't really say much beyond that.

 

Ok, thanks. That helps track it down. I think I've got a couple of Kopernicus mods installed, I'll start checking each one. 

Link to comment
Share on other sites

27 minutes ago, hargn said:

And if I may add another request, could you please update the wiki page of the orbit generator ?
I think that misses informations for the FIXED_ORBIT properties (SMA, ECC, ...) : real property name, unit and range would be welcomed.

All stock KSP - I've made the assumption that anyone going there can either figure it out for themselves, or can just pull it from a save file without understanding the components of the orbit.  That being said, the only reason that I've disabled anonymous wiki edits is the web editor screws up the page hierarchy.  So if you want to fork the project and send me the changes, I'd be happy to merge them in.

27 minutes ago, hargn said:

Or, even KSP does not implement orbit's precession, I will be greatly happy with a Sun-Synchronous random orbit generator, but it could be hard to have a generic implementation for all celestial bodies (when they can have it).

The orbit generators are pretty much all just hooks into stock stuff.  Hypothetically, you could do the math in expressions and come up with your own (although if you do want to do this, there might be some math functions that I need to give you like sin and cos).

Link to comment
Share on other sites

Sorry, I should have read your code first to see that it uses KSP API to load this field, and as I don't use to look into my save files...

The KSP API documentation is not very clear about all these fields, and as I don't find the document for ConfigNodUtil.ParseValue<Orbit>, I'm not sure for the fields LPE and EPH. I assume that LPE is Longitude of PEriapsis (that is usually named as argument of periapsis), but I dont see what could be EPH. The last parameter for the Orbit constructor is the true anomaly. But I think that this field isn't used for the generation of contract orbits.

The functions need to calculate inclination of orbit for a given altitude/period are arcos and sqrt.
You could give the possibility to use advanced math functions in expression, but that will lead to a more complicated parser and it could be a source of bugs or instability (at the beginning). So I think it may be better to improve the random orbit generator.

Link to comment
Share on other sites

7 hours ago, hargn said:

Sorry, I should have read your code first to see that it uses KSP API to load this field, and as I don't use to look into my save files...

The KSP API documentation is not very clear about all these fields, and as I don't find the document for ConfigNodUtil.ParseValue<Orbit>, I'm not sure for the fields LPE and EPH. I assume that LPE is Longitude of PEriapsis (that is usually named as argument of periapsis), but I dont see what could be EPH. The last parameter for the Orbit constructor is the true anomaly. But I think that this field isn't used for the generation of contract orbits.

EPH = Epoch (KSP notion, not an orbital mechanics one).  The orbital parameters represent a snapshot in time (including position), and this is the time the snapshot was taken.  KSP can then rewind/fast forward based on your game's current UT.

7 hours ago, hargn said:

The functions need to calculate inclination of orbit for a given altitude/period are arcos and sqrt.
You could give the possibility to use advanced math functions in expression, but that will lead to a more complicated parser and it could be a source of bugs or instability (at the beginning). So I think it may be better to improve the random orbit generator.

Heh, this won't add complexity to the parser that isn't already there - it's one line of code to add a hook from the parser to a given math function that's in the standard C# library.  I can do these changes in about 5 minutes.  A random orbit generator for a specific use case (sun-synchronous) would be better - but would be many hours of work (which is time that I don't currently have).

Anyway, I'll add the math functions for next release, and you can raise an enhancement request for the orbit generator - but the earliest I'd be able to even think about looking at it is after KSP 1.2 drops.

Link to comment
Share on other sites

On 8/23/2016 at 10:09 AM, severedsolo said:

It's a side effect of the new Mission Control changes. Basically it's up to Contract pack authors to now introduce that kind of randomisation if they want it.

I've put it into Bases and Stations and CleverSats (but may not be working 100% until the upcoming version of CC).

TL:DR ask Contract authors to put it in.

Thanks for mentioning that. I can see some of the differences in the 'KerbinSpaceStation' pack. But I'm still not sure Contract Configurator is doing what it's supposed to. Either that or I've totally missed something. I currently have the above mentioned contract pack as well as 'Kerbin Academy' and 'Tourism Plus'. Why is it each and every contract in these packs ALWAYS starts with an offer expiration set at 5 days?. No matter what I try, everything from mucking around with ALT+F12 to starting a new game, the contracts always appear with 5 days exactly. All of them. Wouldn't either of the following have had an effect by now?

minExpiry = 1.0  -->  minExpiry = 10.0
maxExpiry = 7.0  -->  maxExpiry = 17.0

Why is it always 5 days? Odd because I saw in the wiki that these two values default to 5 and 100 respectively. And I can't find anywhere else that five days is specified. According to whats in ALT+F10, the above values are there, but the offer expiration still says 5 days. What the heck am I missing?

BTW - Can the CooldownDuration be bet set as a random number, or does it need to be exactly specified.

 

@severedsolo - Since I do like both Kerbalism and the KerbinSpaceStations pack, why not support Kerbalism? I could see a contract to attach the Gravity Ring to a station as a good one.

Link to comment
Share on other sites

New release!  Download here.

EDIT: Hotfix to a possibly save breaking issue.

Contract Configurator 1.18.1

  • Fixed NRE on contract save (thanks CecilFF4).

ontract Configurator 1.18.0

  • New Base and ISRU agent icons from Enceos.
  • Added Resource.Density() method.
  • Added partModule and partModuleType to TechResearchedRequirement.
  • Fixed problem with requirement data for offered data not getting fixed until contract save (thanks severedsolo).
  • Fixed sorting of contract groups (thanks pap1723).
  • Fixed Resource parsing limitations (thanks hargn).
  • Fixed issue with DATA nodes and child contract groups (thanks hargn).
  • Disallow DMOS Seismic Impact Hammer at KSC in science subsystem (thanks BeafSalad).
  • Remove short-circuit in Any/All requirement texts for players aren't given incorrect information (thanks inigma).
  • Fixed an issue that prevented expressions from working in resource loading (thanks hargn).
  • Cycle through new contracts to generate in a random order to prevent certain contracts from getting preference.
  • Fixed issue where contract expiries were never getting set (thanks DarkonZ).
  • Fixed issue with some parameters combined with the All parameter causing incorrect contract failure (thanks tomf).
  • Fixed issue with selected contract in mission control getting unselected when a new contract is generated (thanks AccidentalDisassembly).
Edited by nightingale
Link to comment
Share on other sites

I just installed the new CC in a RP0 install. When I decline contracts, new ones don't seem to pop up in their place. Is this expected? With the previous version, declining a contract would almost always result in a new contract coming up in it's place. (I know this is probably a poor game play choice, but having 6 satellite contracts around Mars and the Sun doesn't help me when I can only do missions around Earth.)

Link to comment
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.

×
×
  • Create New...