Jump to content

Would someone be interested in reviving PartUpgrade?


Streetwind

Recommended Posts

@Merill made some useful plugins. Unfortunately, he/she has not even visited the forums at all since November last year.

I was hoping to use one of the plugins, called PartUpgrade, in my 1.1 career playthrough. It allows parts to automatically improve some of their stats when a pre-specified tech node is researched. A typical application would be engines - the 1.25m ones have noticably worse stats overall than the 2.5m family of engines, and the 3.75m ones are improved over those again. With PartUpgrade, you could set up the earlier tech engines to update their stats to be on par with the later tech ones at the same time as you research those. Kind of like using the newly discovered tech to improve older designs.

Unfortunately I'm not able to write plugins for KSP; I have no idea what I would have to do to make this compatible with KSP 1.1 for myself.

However, the sourcecode is available on Github under a GPL license, and the finished plugin is under a CC-BY-NC-4.0 license. Therefore it can be forked and redistributed to some extent. So I turn to the one option available to me - ask among the KSP modding community if there is someone who shares my interest in this plugin's functionality and would be willing to take it upon themselves to update it. :)

Link to comment
Share on other sites

Well I'm not a coder either or I'd be more than willing to take a look...however :cool:

Have you taken a look at Kerbal Research and and Development ? This is not exactly the same as PartUpgrade was but offers similar features.  It is designed to use excess (or not) science points in career mode to purchase upgrades for various parts.  Not all parts are covered but engines is one of them.  It's newer and @-MM- is still working on fleshing it out and getting it balanced but it's pretty nice so far and works cleanly.  Since you have to use your points it's not the automagical upgrades of PartUpgrade but that does makes it fit more logically with a career game.  Hope this helps!

Link to comment
Share on other sites

14 hours ago, rasta013 said:

Have you taken a look at Kerbal Research and and Development ?

I have seen it, yeah. :) Even tried it out briefly. It's a case of "doing too much" for me though, I'm afraid. I'm rather fond of having a limited design space to work in. Kerbal R&D allows you to pretty much remove all your design limits on demand, especially since generating infinite science points is a fully intended feature of KSP (there are at least four infinite sources, some more efficient than others). I know myself well enough to say with confidence that if I remove the challenge from building spacecraft, I'll end up getting bored and abandon the save.

The one thing I was intending to do with PartUpgrade is keeping 1.25m rockets viable in the endgame. In stock KSP, they get left behind so much in performance that it's often a better idea to just launch a larger rocket for the job than you actually need, and I think that's a shame. Making them re-appear in the tech tree in a later node with slightly updated stats would keep them relevant even as you unlock the other sizes.

Link to comment
Share on other sites

Yeah I know what you mean.  Personally, I avoid the infinity zones out of sheer will (most times LOL) and R&D has worked for me at least as a substitute to upgrade engines since that's really the only thing I want out it anyway. I'll pull down the code for PartUpgrade and take a look but that is by far my weakest area when it comes to anything with a PC but I do at least have my C# environment up and running.  Of course, knowing me and my lack of experience I'll compile and the first time I load it up a kerbal will literally crawl through the screen to give me a bug report. :0.0:

Link to comment
Share on other sites

  • 3 weeks later...
17 minutes ago, Streetwind said:

Hey @rasta013 - made any progress so far?

It's okay if you ended up not doing it, I am just curious.

Not at all.  The tiny bits I know about C# is the biggest hurdle.  I haven't completely given up yet but it's definitely giving me trouble.  If I ever do manage to get this working it'll end up being my test bed for learning to code.  

Link to comment
Share on other sites

A quick cursory glance and it looks as though it just needs the references updated.  At least I'm not getting any compile errors.  I've never used the mod, so I don't know exactly how it is supposed to behave but I could post a DLL and you guys could test it if you like.

Try this.  It is just a straight recompile with 1.1.2 references.  I have no idea if it works.

https://www.dropbox.com/s/21kl57r6av4ckuc/PartUpgrade_beta_v0.5.1_recompile.zip?dl=0

Link to comment
Share on other sites

@Streetwind  That is unfortunate, have you tried more than one module?  Is there a specific module you tested?  I wish I knew more about how the mod was supposed to work.  The code is very well organized, and decently documented.

EDIT: It doesn't appear in the tech tree at all?  I installed it with some older demo configs included with the source and I am seeing them.  You might double check there are no errors in the configs.

3jPBTzS.png

Edited by Alshain
Link to comment
Share on other sites

Well, I tried the following for kicks and giggles:

@PART[liquidEngine]:NEEDS[PartUpgrade]:FINAL
{
	MODULE
	{
		name = ModuleUpgradeMass
		TECH-VALUE
		{
			advRocketry = 1.2
			heavyRocketry = 1.1
		}
	}
	MODULE
	{
		name = ModuleUpgradeCost
		TECH-VALUE
		{
			advRocketry = 900
			heavyRocketry = 500
		}
	}
	MODULE
	{
		name = ModuleUpgradeTitle
		TECH-VALUE
		{
			advRocketry = LV-T31 "Reliant-B" Liquid Fuel Engine
			heavyRocketry = LV-T32 "Reliant-C" Liquid Fuel Engine
		}
	}
}

It should have created two upgrade stubs for the LV-T30 in the tech tree, as Merill's imgur album shows. I confirmed that the config loaded and inserted the modules correctly via the debug menu, but still, nothing to see in R&D.

EDIT: I just grabbed a 1.0.4 install from my archives, as well as Merill's last release, and tested this config. While I couldn't see any new items appear in the tech tree there either, the engine in the VAB does show upgraded stats. In 1.1.2 with the recompile, it did not.

Edited by Streetwind
Link to comment
Share on other sites

It looks like you aren't adding the part to the TechTree, from what I can tell is is done in a separate node.  Here is Merill's config for the LVT30.  Pay close attention to the first PART node that begins with +.

So what he does is he precedes the part node with @PART to modify the initial stats of the part (when you first unlock) and uses +PART to add a stub to the tech tree that will enhance the part.

 

//////////////////////////////////////////////////////////////////////
// Example of ModuleManager conf to upgrade LV-T15 with UpgradePart
// Author : Merill
// Licence: CC-BY-SA
//////////////////////////////////////////////////////////////////////

//stub part to show on the tech tree but not in the vab.
+PART[liquidEngine]
{
	//new name, title & descrioption
	@name = liquidEngineStubGeneralRocketry
	@title = LV-T30 Upgrade num 1
	@description = Reduce the mass to 1.5t, increased the heat resitance to 1200°K, improve the isp by 20-30 and the thrust of the engine by 15. Add also an alternator.
	//select tech node
	@TechRequired = generalRocketry
	//do not show in vab
	@category = none
	
	//add all upgrades
	@mass = 1.5
	@maxTemp = 1200
	@cost = 1000
	@MODULE[ModuleEngines*]
	{
		minThrust = 0
		@maxThrust = 215
		
		@atmosphereCurve
		{
			@key,0 = 0 310
			@key,1 = 1 260
		}
	}
	@MODULE[ModuleAlternator]
	{
		@RESOURCE[ElectricCharge]
		{
			rate = 3
		}
	}
}
+PART[liquidEngine]
{
	@name = liquidEngineStubAdvRocketry
	@title = LV-T30 Upgrade num 2
	@description = Reduce the mass to 1.25t, increased the heat resitance to 1500°K, improve the isp by 20 and the thrust of the engine by 15. Improve also the alternator and add a gimbal module.
	@TechRequired = advRocketry
	@category = none
	@mass = 1.25
	@maxTemp = 1500
	@cost = 900
	@MODULE[ModuleEngines*]
	{
		minThrust = 0
		@maxThrust = 230
		
		@atmosphereCurve
		{
			@key,0 = 0 330
			@key,1 = 1 280
		}
	}
	@MODULE[ModuleAlternator]
	{
		@RESOURCE[ElectricCharge]
		{
			rate = 7
		}
	}
}
+PART[liquidEngine]
{
	@name = liquidEngineStubHeavyRocketry
	@title = LV-T30 Upgrade num 3
	@description = Reduce the mass to 1t, increased the heat resitance to 2000°K, improve the isp by 20 and the thrust of the engine by 20. Improve also the alternator and the gimbal module.
	@TechRequired = heavyRocketry
	@category = none
	@mass = 1
	@maxTemp = 2000
	@cost = 800
	@MODULE[ModuleEngines*]
	{
		minThrust = 0
		@maxThrust = 250
		
		@atmosphereCurve
		{
			@key,0 = 0 350350
			@key,1 = 1 300
		}
	}
	MODULE
	{
		name = ModuleGimbal
		gimbalTransformName = thrustTransform
		gimbalRange = 1
		useGimbalResponseSpeed = true
		gimbalResponseSpeed = 5
	}
	@MODULE[ModuleAlternator]
	{
		@RESOURCE[ElectricCharge]
		{
			rate = 10
		}
	}
}

//Here, modifying the LV-T15 part
@PART[liquidEngine]
{
	//initial values for mass, maxttemp, alternator and engine lower than default
	@mass = 2
	@maxTemp = 1000
	
	//remove this module, it's added in an upgrade.
	!MODULE[ModuleAlternator]{}
	
	@MODULE[ModuleEngines*]
	{
		minThrust = 0
		@maxThrust = 200
		
		@atmosphereCurve
		{
			@key,0 = 0 280
			@key,1 = 1 240
		}
	}
	//module to upgrade the mass
	//if multiple tech in the list have been researched, the only one used is the last in this list.
	// when a vessel load, this module restore his last mass (because it shouldn't upgrade)
	MODULE
	{
		name = ModuleUpgradeMass
		
		//if you have problems with data persistance, you can set this field to false, to make part in flight magically upgrades when you research a new tech.
		//persitance = true //default true
		
		//list of techName / value to set
		TECH-VALUE
		{
			generalRocketry = 1.5
			advRocketry = 1.25
			heavyRocketry = 1
		}
		// example: if generalRocketry and heavyRocketry are researched, The lv-t15 mass value will be the one of heavyRocketry because it's below in the list.
	}
	//same as the mass, but change the max temp value
	MODULE
	{
		name = ModuleUpgradeMaxTemp
		TECH-VALUE
		{
			generalRocketry = 1200
			advRocketry = 1500
			heavyRocketry = 2000
		}
	}
	//same as the mass, but change the cost value
	MODULE
	{
		name = ModuleUpgradeCost
		TECH-VALUE
		{
			generalRocketry = 1000
			advRocketry = 900
			heavyRocketry = 800
		}
	}
	//module to upgrade engine (in a more easy way than ModuleUpgradeModule)
	MODULE
	{
		name = ModuleUpgradeEngine
		//Here, it's a list of an other type of "TECH-VALUE"
		// each TECH-VALUE node contain an upgrade at a tech level.
		// like ModuleUpgradeMass, only the last researched is taken.
		TECH-VALUE
		{
			tech = generalRocketry
			// the min/max thrust is considered with vaccum isp => it give the min/max fuel flow.
			minThrust = 0
			maxThrust = 215
			atmosphereIsp = 260
			vacuumIsp = 310
		}
		TECH-VALUE
		{
			tech = advRocketry
			minThrust = 0
			maxThrust = 230
			atmosphereIsp = 280
			vacuumIsp = 330
		}
		TECH-VALUE
		{
			tech = heavyRocketry
			minThrust = 0
			maxThrust = 250
			atmosphereIsp = 300
			vacuumIsp = 350
		}
	}
	
	//this module is designed to upgrade other modules
	//It's more compicated, and maybe i change it in a future day.
	// right now, you should create a new module for each type/tech combinaison
	// note: Please, do not add multiple module with the same name to your part, i can only upgrade one of them.
	MODULE
	{
		name = ModuleUpgradeModule
		 //module upgrade type : create, replace or delete.
		type = create
		//tech needed to apply this upgrade
		tech = generalRocketry
		//If you want to use multiple ModuleUpgradeModule on this part with the same type/tech, add this field with a unique int id
		//id = 144124
		//add all modules to [add|replace|delete] here. As it's defined in a normal part.
		MODULE
		{
			name = ModuleAlternator
			RESOURCE
			{
				name = ElectricCharge
				rate = 3
			}
		}
	}
	//if you want to upgrace a upgrade-created modle, it must be place AFTER the creation one.
	MODULE
	{
		name = ModuleUpgradeModule
		type = replace
		tech = advRocketry
		MODULE
		{
			name = ModuleAlternator
			RESOURCE
			{
				name = ElectricCharge
				rate = 7
			}
		}
	}
	MODULE
	{
		name = ModuleUpgradeModule
		type = create
		tech = advRocketry
		
		//In ModuleUpgradeModule, vessel-persisted fields must have a type in {primitif | string | vector[3|3d|4] | Color[32] | Matrix4x4 | Quaternion[D]}
		//	other fields are ignored.
		//persitance = true //default true
		
		MODULE
		{
			name = ModuleGimbal
			gimbalTransformName = thrustTransform
			gimbalRange = 0.5
			useGimbalResponseSpeed = true
			gimbalResponseSpeed = 2
		}
	}
	MODULE
	{
		name = ModuleUpgradeModule
		type = replace
		tech = heavyRocketry
		MODULE
		{
			name = ModuleGimbal
			gimbalTransformName = thrustTransform
			gimbalRange = 1
			useGimbalResponseSpeed = true
			gimbalResponseSpeed = 5
		}
		//you can upgrade multiple modules
		MODULE
		{
			name = ModuleAlternator
			RESOURCE
			{
				name = ElectricCharge
				rate = 10
			}
		}
	}
}

 

Edited by Alshain
Link to comment
Share on other sites

Yeah, I was just typing a second edit to mention that I figured that part out when I saw the forum report that you posted a reply :)

 

Still, even though the tech tree stuff has nothing to do with the plugin, the fact remains that the part is not actually being upgraded in 1.1.2, whereas in 1.0.4 it worked.

 

Edited by Streetwind
Link to comment
Share on other sites

2 minutes ago, Streetwind said:

Still, even though the tech tree stuff has nothing to do with the plugin, the fact remains that the part is not actually being upgraded in 1.1.2, whereas in 1.0.4 it worked.

Hmm, yeah I concur.

Link to comment
Share on other sites

@Streetwind  So, interestingly there was a VersionChecker script throwing an exception error and apparently that somehow shut down half the mod.  I'm not clear on how that was happening, part of the mod was clearly functional in the tech tree, but I nuked the version checker and it works completely now, as far as I can tell.  I'm preparing an upload now.

Link to comment
Share on other sites

Ok, here is the new version.  It should work, however I did discover a bug during my final testing.  If you are playing with the option to unlock parts/upgrades with funds, that is ignored, the upgrade is available the moment the tech tree node is researched.

https://www.dropbox.com/s/4uz85bptzifw2o8/PartUpgrade_beta_v0.5.1_recompile2.zip?dl=0

Link to comment
Share on other sites

Hmmm.... So I may have to try this myself... I have some parts I'd like to add MODULES {} to as upgrades... I was just trying to figure out where to fit them on the tree, and the added modules were making it hard... This should help, I imagine... :)

Link to comment
Share on other sites

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