Jump to content

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


nightingale

Recommended Posts

6 hours ago, severedsolo said:

I was worried that the RNG would just roll the dice a million times, until it hit, but it doesn't seem to be.

It'll roll it on each contract generation chance.  How the system works:

  1. On entry of the Space Center scene, start trying to generate contracts
  2. Go through the list in order, and attempt to generate each contract in turn (happens over many frames)
  3. If at least one contract was generated, do another pass (ie. go back to 2).  This is to handle contracts that generate in many different variants
  4. If no contracts were generated this pass then don't generate for a set amount of time (right now it's just 30s)

Contract generation can also get kicked off by a number of events (mostly related to the contracts changing to do completions, declines, withdrawals).  So on entry to mission control, you'll probably get 2-3 generation chances on those contracts (could be higher, but will probably be at least 1).

If a player sits around in mission control long enough, odds are they will get one of these contracts.

6 hours ago, severedsolo said:

So maybe that's the middle ground, keep it as it is, and if authors want randomisation, we add it ourselves.

That was more of less the hope/intention.  I may need to revisit this in Field Research and see what's appropriate there.

6 hours ago, severedsolo said:

Quick question for you nightingale:

If I set up a DATA node in the Contract_Group and then reference that number in expressions, under REQUIREMENT at Contract_Type level - will they re-roll the random number for each contract, or will they all get the same number?

DATA nodes in CONTRACT_GROUP is for ease of maintenance (so you only have the expression in one place).  They are still executed for each pass of each CONTRACT_TYPE.

6 hours ago, severedsolo said:

What I'm asking is: is it better to set up a DATA node in each contract, or at group level?

The same, in this case.

6 hours ago, severedsolo said:

Edit again: Never mind. Seems that CC doesn't like using a group DATA node for requirements anyway, so will have to be at Contract Level.

Might've been a syntax error or bug on my end - it should work just fine.

Let me know if you want anything additional in CC now that you know how it works.  I could try to figure out some way that you can have a shared random number (or perhaps a number that doesn't change if it's been generated in the last day, or something).

1 hour ago, vardicd said:

@nightingale actual issue, latest version of Contract configurator [possible culprit] seems to be spamming this in my log? also mentions research bodies? not sure what that is, but I'm noticing a not insignificant performance hit since I upgraded. Not unplayable, just noticeable.

I was aware of it, and it's fixed.  If it's occurring enough to slow things down then I'll do a release (the contract system can cause those checks to happen really frequently, so I can't say I'm completely surprised that it's spammy enough to slow things down).

5 minutes ago, westamastaflash said:

Same error here. This logging seems to be creating at ton of garbage that needs to be collected (new string every time?)

Probably not due to garbage - more likely to be because of file I/O.

Link to comment
Share on other sites

6 minutes ago, nightingale said:

Probably not due to garbage - more likely to be because of file I/O.

True - though I have noticed though that a lot of mods create a ton of strings on the heap every frame (sometimes even more), and just let Mono's really bad GC clean up afterwards. As I haven't looked at the contract code I was just guessing :-). Massive I/O definitely will kill performance too. Especially here. My Log is 190 MB after about an hour of playtime.

Edited by westamastaflash
Link to comment
Share on other sites

I'm finally able to look at my contract packs, and having problems with the most basic.  The following contract has all Pre-Requisites met, but is not being offered. In fact, te only prerequisites listed on the contract screen are variables being set in the contract group in DATA segments.  Being set, but not being used here:

CONTRACT_TYPE
{
// For debugging
//trace = true
	name = First Orbit
	group = STGUnmannedMissions
	title = Let's get a probe into orbit

	topic = orbit
	subject = HomeWorld()
	motivation = Because....

	notes = Complete the following:
	synopsis = Send a probe to space and get it into orbit around our homeworld
	completedMessage = You did it! You've successfully gotten a probe into orbit
	agent = Space Penguins, Inc
	cancellable = true
	declinable = true
	prestige = Exceptional
	targetBody = HomeWorld()
	maxCompletions = 1
	maxSimultaneous = 1
	rewardScience = 25.0
	rewardReputation = 5.0
	rewardFunds = Random(18000.0, 22000.0)
	advanceFunds = Random(9000.0, 11000.0)
	
	PARAMETER
	{
		name = Orbit
		type = Orbit
	
		situation = ORBITING
		minInclination = 0
		minEccentricity = 0.0
		
	}
}

Log file is here, also the save file: https://www.dropbox.com/s/gp90ohwpto7b06v/ContractConfigurError.zip?dl=0

This was a brand new install, with only CC, MM & my contracts installed.

I see some messages in the log, are those preventing the contract from being offered?

Edited by linuxgurugamer
Link to comment
Share on other sites

@linuxgurugamer - Can you provide a KSP.log with the following debug config?

CC_DEBUGGING
{
	// Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR
	logLevel = DEBUG
	
	ADD_LOGLEVEL_EXCEPTION
	{
		// Type name
		type = ContractPreLoader
		// Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR
		logLevel = VERBOSE
	}
	
	ADD_LOGLEVEL_EXCEPTION
	{
		// Type name
		type = ContractType
		// Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR
		logLevel = VERBOSE
	}
	
	ADD_LOGLEVEL_EXCEPTION
	{
		// Type name
		type = MissionControlUI
		// Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR
		logLevel = VERBOSE
	}
}

Also, can you do this on the latest dev version (the release versions have verbose logging compiled out).

Link to comment
Share on other sites

Just now, nightingale said:

@linuxgurugamer - Can you provide a KSP.log with the following debug config?


CC_DEBUGGING
{
	// Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR
	logLevel = DEBUG
	
	ADD_LOGLEVEL_EXCEPTION
	{
		// Type name
		type = ContractPreLoader
		// Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR
		logLevel = VERBOSE
	}
	
	ADD_LOGLEVEL_EXCEPTION
	{
		// Type name
		type = ContractType
		// Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR
		logLevel = VERBOSE
	}
	
	ADD_LOGLEVEL_EXCEPTION
	{
		// Type name
		type = MissionControlUI
		// Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR
		logLevel = VERBOSE
	}
}

Also, can you do this on the latest dev version (the release versions have verbose logging compiled out).

later, as I'm going through the log I see some errors, will post later either with the successful results or with the requested data

Thanks

Link to comment
Share on other sites

1 hour ago, nightingale said:

Let me know if you want anything additional in CC now that you know how it works.  I could try to figure out some way that you can have a shared random number (or perhaps a number that doesn't change if it's been generated in the last day, or something).

That's fine, how it works already is exactly what I want.

On the subject of the requirement group level thing though:

This is what I'm having problems with:

Contract_Group:

    DATA
    {
        type = int
        randomRoll = Random(1,10)
    }

Contract_Type:

    REQUIREMENT
    {
    name = RandomRoll
    type = Expression
    expression = @BasesandStations:randomRoll < 3
    title = Something must have gone terribly wrong on a space station.
    }

- this causes it to fail validation with error: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

I'm guessing this means that CC is not getting that it's an int... but I have no idea how to fix it.

Link to comment
Share on other sites

redoing test

 

@nightingale

Ok, this test is clean, meaning only one contract in the cfgs:

https://www.dropbox.com/s/gp90ohwpto7b06v/ContractConfigurError.zip?dl=0

I included the complete directories needed (ContractPacks and spacetux) so you can replicate it.

No errors in the log file

Edited by linuxgurugamer
Link to comment
Share on other sites

I just found this in the log:

[VERBOSE] ContractConfigurator.ContractType: Didn't generate contract of type First Orbit: 'STGUnmannedMissions:innerMoons' had zero count.
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
[VERBOSE] ContractConfigurator.ContractPreLoader: First Orbit was not generated: requirement not met.
 

Which is strange, because the contract has NO requirements

Link to comment
Share on other sites

35 minutes ago, linuxgurugamer said:

I just found this in the log:


[VERBOSE] ContractConfigurator.ContractType: Didn't generate contract of type First Orbit: 'STGUnmannedMissions:innerMoons' had zero count.
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
[VERBOSE] ContractConfigurator.ContractPreLoader: First Orbit was not generated: requirement not met.
 

Which is strange, because the contract has NO requirements

DATA nodes have a flag (requiredValue) which defaults to true.  So if a List<T> has zero values, it will consider that DATA node unmet.

@severedsolo - That worked for me - can you provide the full contract?

Link to comment
Share on other sites

5 hours ago, nightingale said:

DATA nodes have a flag (requiredValue) which defaults to true.  So if a List<T> has zero values, it will consider that DATA node unmet.

@severedsolo - That worked for me - can you provide the full contract?

Ok, but if the data node isn't a requirement, why it it acting as if it was a requirement?

Link to comment
Share on other sites

On 7/28/2016 at 0:12 AM, nightingale said:

Forgot to mention - once you put them up there, you'll get a contract to bring them back too (and I think that one pays even more).  That being said, the hotel/casino deliveries are meant to be easy funds - so either your lifters are really expensive, or I need to rebalance that contract.

The contract calls for delivering 39 tourists to the hotel for which I will be paid 123,364 funds. That a touch over 3 grand per tourist. I have a version of my Eloi-class craft with four Mk1 Crew cabins delivering 8 kerbals for 49,844 funds. That's costing me 6 thousand funds per kerbal, twice what they are paying me. Now, if the contract pays more to bring them back then I will be able to break even or make a profit if I squeeze a little more efficiency out of my rocket.

Link to comment
Share on other sites

27 minutes ago, nightingale said:

It is a requirement, unless you set requiredValue to false explicitly.

Ok.  So, even if the data node is in the  Contract Group and not the contract, it is still required (if the flag isn't set)?  That kind of doesn't make sense.  I have a number of data nodes in the contract group, not all of which apply to each contract.

For now, i've made them all not-required, will see how it goes

Link to comment
Share on other sites

14 hours ago, CaptKordite said:

The contract calls for delivering 39 tourists to the hotel for which I will be paid 123,364 funds. That a touch over 3 grand per tourist. I have a version of my Eloi-class craft with four Mk1 Crew cabins delivering 8 kerbals for 49,844 funds. That's costing me 6 thousand funds per kerbal, twice what they are paying me. Now, if the contract pays more to bring them back then I will be able to break even or make a profit if I squeeze a little more efficiency out of my rocket.

I've always felt that 39 tourists is a bit grindy, and 11-15 would be a better headcount if you don't like space planes.  (Made  trickier if you get into USI-LS requirements for 39 tourists plus a pilot.)

Link to comment
Share on other sites

Testing my unmanned contracts:

Contract to get probe to orbit and back again

It seems to work until I get in orbit, the contract shows the the orbit part is fulfilled, then, I decelerate, and decouple from the rocket, and all of a sudden the orbit parameter is unfilled again.

CONTRACT_TYPE
{
// For debugging
//trace = true
	name = First Return from Orbit
	group = STGUnmannedMissions
	title = Let's get a probe into orbit and return it safely home

	topic = orbit
	subject = HomeWorld()
	motivation = Because....

	notes = Complete the following:
	synopsis = Send a probe to space and get it into orbit around our homeworld and then get it back
	completedMessage = You did it! You've successfully gotten a probe into orbit and returned it home
	agent = Space Penguins, Inc
	cancellable = true
	declinable = true
	prestige = Exceptional
	targetBody = HomeWorld()
	maxCompletions = 1
	maxSimultaneous = 1
	rewardScience = 25.0
	rewardReputation = 5.0
	rewardFunds = Random(18000.0, 22000.0)
	advanceFunds = Random(9000.0, 11000.0)
	
	PARAMETER
	{
		name = VesselParameterGroup_1
		type = VesselParameterGroup
		completeInSequence = true
	
		PARAMETER
		{
			name = Orbit
			type = Orbit
	
			situation = ORBITING
			minInclination = 0
			minEccentricity = 0.0
			
			disableOnStateChange = true
			
			completeInSequence = true
		
		}
		PARAMETER
		{
			name = ReturnHome
			type = ReturnHome
			completeInSequence = true
		}
	}
}

Here is a link to all relevent files:  https://www.dropbox.com/s/gp90ohwpto7b06v/ContractConfigurError.zip?dl=0

I'm thinking there might be a conflict with something, but have no idea what.

Link to comment
Share on other sites

I've figured out what's happening:

It has to do with the root part being in the part of the rocket which is below the decoupler.

This test will show the problem:

This craft file: https://www.dropbox.com/s/sismussknpcb2bi/goodrootpart.craft?dl=0 works

This one shows the problem: https://www.dropbox.com/s/9luidhu8w8zlfbz/badrootpart.craft?dl=0

Test as follows:

Install the following mods:

  • Unmanned Missions
  • HyperEdit
  • Contracts+ (makes it easier to see the reqs)
  1. Create new save, give yourself lots of science & money, you will need to unlock the first few levels of science
  2. Download the craft files, put them into your VAB folder
  3. Go into Mission Control, select the Unmanned Mission "Let's get a probe into orbit and return it"
  4. Put craft on launch pad
  5. Open HyperEdit, then open the Orbit Editor.  Make sure the active ship is selected, and that the altitude is >70000
  6. Set throttle to full
  7. Quickly launch, wait a second, then kill the throttle
  8. When engine has stopped, click the HyperEdit "Apply" button to move the craft into an orbit
  9. Close Hyperedit
  10. Open the Contracts window
  11. See in the contracts window that the Orbit has been achieved
  12. In orbit, wait until  the craft is pointing retrograde (it doesn't have reaction wheels), then activate the engine, enough to deorbit
  13. Shut down the engine
  14. Stage

For the craft file labeled "goodrootpart", it will be unchanged.  For the craft file labeled "badrootpart", the Orbit requirement will become unfilled

8 minutes ago, SilverlightPony said:

Version available via CKAN is out of date.  CKAN only has v1.12.1.

Umm, refresh CKAN, it has the latest, I have 1.16.2 installed via CKAN

Link to comment
Share on other sites

2 hours ago, Merkov said:

According to CKAN, you are running KSP version 1.1.2. In the bottom right, you can see that CKAN has mod version 1.16.1 available for KSP 1.1.3.

Ah.  Yeah, I'm running a ton of mods, most of which aren't updated to 1.1.3 yet.

What threw me off was that I updated a dozen or so to newer versions that are still compatible with 1.1.2, and one of them then complained that Contract Configurator was out of date.

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...