Jump to content

[1.1.3] BackgroundProcessing


jamespicone

Recommended Posts

5 hours ago, bice said:

Hi again @JPLRepo

First, thanks again for your work.

Now, I have a request. I use the mod:

That has a special type of solar panel to capture a resource called "Dust". But this kind of resource is not updated by BackgroundProcessing.

After go over the code I saw this:

 
 

could it be posible to add a new interesting resource called "Dust"?

Going further, could it be possible to have the "interesting resources" in a config file outside the dll?

 

Hi. So a few things here... First Yes - this mod could be changed to process every known and unknown resource under the Kerbin Sun.
I said could but I believe that is not it's intention. It's intention is to provide background Electric Charge generation (as the stock game doesn't do this), and mod authors are intended to pick it up and integrate to it to process OTHER resources. Read the Opening Post again.

Spoiler

I'm a player. What does BackgroundProcessing offer me?

BackgroundProcessing will allow craft to gain and lose ElectricCharge while you're off doing something else. This doesn't actually happen in stock KSP.......|
The other thing BackgroundProcessing provides is support for other mods that might want to do something while a craft is in the background. A scanner, something that produces a mod-specific resource, anything like that. Because of the way BackgroundProcessing is designed that other mod doesn't have to include BP, and it doesn't have to use its features, but if that mod has implemented BP-compatibility, BP will detect it and use it.

I'm a mod author. What does BackgroundProcessing offer me?

If you have a PartModule that should do stuff even while a craft isn't the actual active vessel - like a scanner, or a solar-wind collector - you can get background processing just by implementing a couple of functions. BackgroundProcessing has already implemented a lot of the boilerplate required to get this working. Your PartModule can do anything in the background that can be done with a ProtoVessel - which is quite a lot - and BP provides some mechanisms for producing or consuming resources easily.


I believe the intention here is to keep this mod simple. Other mods can make use of this mod to process resources but it requires them to make changes to allow this mod to handle it.
To do what you asked then this mod would need to first understand this resource called "Dust" - which it doesn't, and has no definition for, given it's not part of the stock resources.
The code changes required are a lot more than just adding a list of resources.. Adding a list of resources is the first step, and it's complicated further if the resource you are talking about is not stock.
It would then have to have all the calculations and processing to handle this resource, so more code. Once you have done it for one resource, the list grows and grows. That is not the intention here.
What is intended is the mod you refer to that has "Dust" already defined, and already knows how to calculate it, etc. Makes a couple of easy changes to define a method for background processing of "Dust" and this mod will automatically detect it if it's installed and has these methods and process it.

The right answer here is you contact the mod author of your "Dust" collector and ask if they could integrate to this mod (it's two simple methods) and then it will get backgroundprocessing of "Dust".

Link to comment
Share on other sites

Understood.

For some reason i thought that because the definition of this "panel" is this

MODULE
{
 name = ModuleDeployableSolarPanel
 animationName = a1
 pivotName = suntransform
 raycastTransformName = suncatcher
 resourceName = Dust
 chargeRate = 0.0125
}

and the definition of XL solar array (stock) is this:

 MODULE
 {
  name = ModuleDeployableSolarPanel
  animationName = giantSolarPanelNew
  raycastTransformName = suncatcher
  resourceName = ElectricCharge
  chargeRate = 24.4
 }

It could be easily added, but you are right when you say that the intention here is to keep this mod simple.

i'll ask the creator of the other mod as you advised. :wink:

Thanks!

Link to comment
Share on other sites

1 minute ago, bice said:

Understood.

For some reason i thought that because the definition of this "panel" is this

MODULE
{
 name = ModuleDeployableSolarPanel
 animationName = a1
 pivotName = suntransform
 raycastTransformName = suncatcher
 resourceName = Dust
 chargeRate = 0.0125
}

and the definition of XL solar array (stock) is this:

 MODULE
 {
  name = ModuleDeployableSolarPanel
  animationName = giantSolarPanelNew
  raycastTransformName = suncatcher
  resourceName = ElectricCharge
  chargeRate = 24.4
 }

It could be easily added, but you are right when you say that the intention here is to keep this mod simple.

i'll ask the creator of the other mod as you advised. :wink:

Thanks!

Whilst they are both using the stock solar panel module to process a resource. They both do not process that resource when the vessel is not loaded.
so in theory it means that yes - Dust is processed and calculated the same way as EC from the looks of things.
But that one line is a very big difference. The problem here is Dust is not a stock resource. I don't understand how that mod works, it says in its OP that dust generation requires EC to capture dust.
Not sure how they are doing that using ModuleDeployableSolarPanel as it only generates a resource.
Anyway, best bet is to take it up with them to see if they will develop the change to integrate to BackgroundProcessing.

Link to comment
Share on other sites

Only FYI

The part that works like solar panels and doesn't need EC to capture dust is this one:

DP-7 "Stardust" Solar Wind Panel

maybe you looked at this one which requieres EC as you say:

B-3 "Hoover" Dust Accumulator-inator

It has no "deployableSolarpanel" definition but has "moduleresourceConverter" and "ModuleGenerator". It produces Dust from magnetic charge so requires EC

It's a great mod and i invite you to try it!

Sorry for my english. It's not my native language...

Link to comment
Share on other sites

13 minutes ago, bice said:

Only FYI

The part that works like solar panels and doesn't need EC to capture dust is this one:

DP-7 "Stardust" Solar Wind Panel

maybe you looked at this one which requieres EC as you say:

B-3 "Hoover" Dust Accumulator-inator

It has no "deployableSolarpanel" definition but has "moduleresourceConverter" and "ModuleGenerator". It produces Dust from magnetic charge so requires EC

It's a great mod and i invite you to try it!

Sorry for my english. It's not my native language...

I just read the Opening Thread. I wish I had time to play KSP. Most of my time is spent modding. I haven't even played 1.1+ yet except for testing and fixing my mods.
Let's see what happens with this mod first. I'm not so keen to take on yet another mod in my ever growing empire of mods. I'd rather jamespicone came back. But if he doesn't I will maintain this mod.
Adding to it, while I would love to, would take a very back seat.

Link to comment
Share on other sites

On Friday, 3 June 2016 at 5:06 AM, JPLRepo said:

I just read the Opening Thread. I wish I had time to play KSP. Most of my time is spent modding. I haven't even played 1.1+ yet except for testing and fixing my mods.
Let's see what happens with this mod first. I'm not so keen to take on yet another mod in my ever growing empire of mods. I'd rather jamespicone came back. But if he doesn't I will maintain this mod.
Adding to it, while I would love to, would take a very back seat.

Sorry, I appreciate I've been terribly lazy. Thank you for maintaining things.

@bice: The 'interesting resources' list is for things ModuleGenerator, ModuleDeployableSolarPanel, or ModuleCommand might care about other than electric charge. So if 'dust' was added to the interesting resources list, the ModuleDeployableSolarPanel you posted would generate dust, but the hoover wouldn't because I don't handle resource conversion (due to issues with figuring out how it's meant to work and also resources that aren't whole-ship like electric charge).

It'd be fairly easy to adjust it so that you can specify in the config file a list of interesting resources. But then only some of the dust stuff would work.

This does look like I'd have to make resource conversion work before it'd be useful; the mod author can't do much with it because none of these are new PartModule types.

I may - and I make no promises - look into some of this. I've been doing a bunch of other things and haven't played KSP for quite a while now.

Link to comment
Share on other sites

Thank you @jamespicone and welcome back.

Everybody feels lazy sometimes and need a period to disconnect and do "normal" living!

I have asked the owner of the other mod to implement the necessary calls to use your's.  Waiting answer.

And thanks again to you and @JPLRepo for your work. People like you make me think this is the best game i've ever played. More than 500h and engaged!

 

Link to comment
Share on other sites

18 hours ago, jamespicone said:

Sorry, I appreciate I've been terribly lazy. Thank you for maintaining things.

@bice: The 'interesting resources' list is for things ModuleGenerator, ModuleDeployableSolarPanel, or ModuleCommand might care about other than electric charge. So if 'dust' was added to the interesting resources list, the ModuleDeployableSolarPanel you posted would generate dust, but the hoover wouldn't because I don't handle resource conversion (due to issues with figuring out how it's meant to work and also resources that aren't whole-ship like electric charge).

It'd be fairly easy to adjust it so that you can specify in the config file a list of interesting resources. But then only some of the dust stuff would work.

This does look like I'd have to make resource conversion work before it'd be useful; the mod author can't do much with it because none of these are new PartModule types.

I may - and I make no promises - look into some of this. I've been doing a bunch of other things and haven't played KSP for quite a while now.

Hey @jamespicone, great to see you back.
Do you plan to update your code (I know you use bitbucket and my fork is on github) and update spackdock, etc?
Cheers.

Link to comment
Share on other sites

17 hours ago, JPLRepo said:

Hey @jamespicone, great to see you back.
Do you plan to update your code (I know you use bitbucket and my fork is on github) and update spackdock, etc?
Cheers.

Yes, when I can get to it, which might not be soon. Work's rather busy at the moment and it's sucking up most of my programming juice. I will eventually get to merging the fixes and updating spacedock.

Link to comment
Share on other sites

  • 3 weeks later...
16 minutes ago, JPLRepo said:

I've put up an up to date version for KSP 1.1.3 on my fork on github only.
Removed some temp vars (reduce garbage collector) and foreach loops in the FixedUpdate method to improve things a little bit. No other changes.

It's really unfortunate that your fork was before a bunch of the refactoring I did to make things a bit cleaner. :/.

I haven't forgotten about this, but I've essentially been on the go continuously for a month. Won't be able to get to things until after the middle of July at the earliest.

Link to comment
Share on other sites

2 minutes ago, jamespicone said:

It's really unfortunate that your fork was before a bunch of the refactoring I did to make things a bit cleaner. :/.

I haven't forgotten about this, but I've essentially been on the go continuously for a month. Won't be able to get to things until after the middle of July at the earliest.

I can factor them back in if you like.
Is your refactoring on bitbucket?

Link to comment
Share on other sites

2 minutes ago, JPLRepo said:

I can factor them back in if you like.
Is your refactoring on bitbucket?

Yes, and that would be amazing if you could. Probably an hour of work in at least though, just as a warning.

https://bitbucket.org/j_picone/background-processing

Haven't checked whether your fork has the updated solar panel handling either...

Link to comment
Share on other sites

1 minute ago, jamespicone said:

Yes, and that would be amazing if you could. Probably an hour of work in at least though, just as a warning.

https://bitbucket.org/j_picone/background-processing

Haven't checked whether your fork has the updated solar panel handling either...

Leave it with me... I'll do it as a background task. :wink: then when you get back to it you just need to look it all over.

Edited by JPLRepo
Link to comment
Share on other sites

  • 1 month later...

Updated Background Processing to re-factor @jamespicone updates and improved RayCasting (courtesy @ShotgunNinja)
V0.4.4.0 Available on Github here (hoping jamespicone comes back and updates all the other links, otherwise I might just have to start new ones).
Background Processing will do exactly that for Electric Charge background processing of: Solar Panels, Command Pods, Generators, and any other mods that use this mod (like my DeepFreeze mod).
Will maybe look at adding ResourceConverters as that would be nice to have as well.
 

 

Edited by JPLRepo
Link to comment
Share on other sites

On Sunday, 31 July 2016 at 4:33 AM, JPLRepo said:

Updated Background Processing to re-factor @jamespicone updates and improved RayCasting (courtesy @ShotgunNinja)
V0.4.4.0 Available on Github here (hoping jamespicone comes back and updates all the other links, otherwise I might just have to start new ones).
Background Processing will do exactly that for Electric Charge background processing of: Solar Panels, Command Pods, Generators, and any other mods that use this mod (like my DeepFreeze mod).
Will maybe look at adding ResourceConverters as that would be nice to have as well.
 

 

Confirming that I've seen this and will get around to fixing things on my end Soontm . Probably tomorrow night.

Link to comment
Share on other sites

On Sunday, 31 July 2016 at 4:33 AM, JPLRepo said:

Updated Background Processing to re-factor @jamespicone updates and improved RayCasting (courtesy @ShotgunNinja)
V0.4.4.0 Available on Github here (hoping jamespicone comes back and updates all the other links, otherwise I might just have to start new ones).
Background Processing will do exactly that for Electric Charge background processing of: Solar Panels, Command Pods, Generators, and any other mods that use this mod (like my DeepFreeze mod).
Will maybe look at adding ResourceConverters as that would be nice to have as well.
 

 

Committed all your changes into the BitBucket repo, uploaded a build to SpaceDock, and IIRC SpaceDock should propagate to CKAN. Don't know when there will be new dev effort on my part.

I guess the obvious next pieces of fruit are:

- Ability for players to specify 'interesting' resources in the config file.

- Resource converters and fuelled generators (Problem: Mimicking proper behaviour for resources that aren't whole-ship like electric charge)

- Emulating temperature effects on solar panels

Link to comment
Share on other sites

On 27-6-2016 at 0:03 PM, JPLRepo said:

I've put up an up to date version for KSP 1.1.3 on my fork on github only.
Removed some temp vars (reduce garbage collector) and foreach loops in the FixedUpdate method to improve things a little bit. No other changes.

Could you please create a new developement/reslease topic with this information?

Link to comment
Share on other sites

  • 4 weeks later...

There's an issue that I've isolated to this mod; if you have it installed & leave the Kerbin SOI, then when you switch vessels the NaN Kraken strikes. The only way I was able to resolve this was to uninstall BP & reload a save prior to leaving KSOI. Some comments in the linked thread indicates a vessel's mass is being set to zero which causes divide-by-zero errors, if that helps.

 

Edited by Bombaatu
Link to comment
Share on other sites

On 28/08/2016 at 6:42 AM, Bombaatu said:

There's an issue that I've isolated to this mod; if you have it installed & leave the Kerbin SOI, then when you switch vessels the NaN Kraken strikes. The only way I was able to resolve this was to uninstall BP & reload a save prior to leaving KSOI. Some comments in the linked thread indicates a vessel's mass is being set to zero which causes divide-by-zero errors, if that helps.

 

Yep Thought that had been addressed. But maybe when @jamespicone picked up all my changes and put out a new version it got regressed? Will put it on the list. but probably best @jamespicone fixes it if he has time.

Link to comment
Share on other sites

3 minutes ago, ShotgunNinja said:

Oh sorry @JPLRepo, didn't know an official jamespicone version for 1.1.3 was released on spacedock.

yeah he did. But that's cool. Let's see if he comes back and updates it. Otherwise I'll have to do an unofficial official patch'd up version again.
When I get a bit more time I'll go check his bitbucket repro, pretty sure we fixed that...

Edited by JPLRepo
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...