Jump to content

Open Resource System (ORS) - Mod Resource API - version 1.4.2


Fractal_UK

Recommended Posts

It is much much safer for atmospheric and oceanic resources to define defaults and edit them with ModuleManager.

So then you have five different mods all trying to change the composition of an ocean with ModuleManager (and all of them using "final", right?) while adding their own resources on top of that because they think they've altered the composition to accommodate. In the end I suppose it's just a matter of how you want users and modders to make a mess...

Anyway, I'm still curious as to how the scanning works and looks on the map screen. Is this something you can easily show or do I need to download KSPI?

Link to comment
Share on other sites

So then you have five different mods all trying to change the composition of an ocean with ModuleManager (and all of them using "final", right?) while adding their own resources on top of that because they think they've altered the composition to accommodate. In the end I suppose it's just a matter of how you want users and modders to make a mess...

Anyway, I'm still curious as to how the scanning works and looks on the map screen. Is this something you can easily show or do I need to download KSPI?

Check out this post: http://forum.kerbalspaceprogram.com/threads/43839-0-23-KSP-Interstellar-%28Tweakables-New-ISRU-Preecoolers%29-Version-0-9-2-%28Beta%29?p=783727&viewfull=1#post783727, it's where I originally described the planetary resource system for Interstellar.

The gamma ray spectrometer is displaying the thorium and the uranium values found just below the scanner while the marks show a few strategic locations (within line of sight) that contain high value deposits while maintainity variable quantities across the surface of the entire planet.

Link to comment
Share on other sites

Check out this post: http://forum.kerbalspaceprogram.com/threads/43839-0-23-KSP-Interstellar-%28Tweakables-New-ISRU-Preecoolers%29-Version-0-9-2-%28Beta%29?p=783727&viewfull=1#post783727, it's where I originally described the planetary resource system for Interstellar.

The gamma ray spectrometer is displaying the thorium and the uranium values found just below the scanner while the marks show a few strategic locations (within line of sight) that contain high value deposits while maintainity variable quantities across the surface of the entire planet.

Very nice, thanks.

Link to comment
Share on other sites

One question that comes to mind: can a minimum threshold for something be set? So that you can assure people can land anywhere on a body (for example) and find something - this would be useful to make say an emergency refueling/O2 device. Works best on a decent node but will not come up completely empty.

Link to comment
Share on other sites

I can't help but think of how the Forge Ore Dictionary in Minecraft functions very similar to what you're trying to accomplish. In the case of multiple mods adding the same resource you could solve the multiple additions of the same resource by using a mod-specific name for the resource in its "deposit" form and a universal name is it's "mined" form. For example; mod A adds X amount of "Ferrous Ore" which when excavated yields "Ore" as a resource. Mod B adds X amount of "Mun Ore" which also yields "Ore" when excavated. In this way, both resources get added to the map, but only the parts of Mod A will be able to mine "Ferrous Ore" and conversely, mod B can mine "Mun Ore", thus preventing the concentration from exceeding 100%. Now anyone could exploit that by simply transferring either example into eachother's parts, but that's a bit harder to solve.

As for atmospheric/oceanic resources, you could just use an averaging mechanic? Mod A adds 10% Nitrogen to a planet's atmosphere, and mod B adds 20% nitrogen, so in game effect is 15% nitrogen in that atmosphere? Just a thought.

Resource definitions aside, I'm really excited for this because with this system, a temporary fix for Kethane/EL can be easily devised for use on my KMP server. At present, since the Kethane and EL Ore are spawned randomly whenever you start a new game and stored in the persistent.sfs file, and KMP generates a NEW persistent.sfs everytime it synchronizes, kethane and ore deposits change constantly, making a kethane/ore base impossible as your deposits will literally disappear right out from under you. With this you could simply add Kethane and Ore to the resource spawner and have their spawns based on a static map which could be distributed to all the players. Exploitable, yes, but it will work for private servers like mine, since I know the people I play with won't cheat (they even hate using spawn commands in Minecraft).

Link to comment
Share on other sites

One question that comes to mind: can a minimum threshold for something be set? So that you can assure people can land anywhere on a body (for example) and find something - this would be useful to make say an emergency refueling/O2 device. Works best on a decent node but will not come up completely empty.

From what I can tell, yes, quite easily. Just make the entire resource map at least a few shades brighter than black, with resource concentration pockets scaling up to white according to intensity. If I'm following the implementation correctly, the resource generator should interpret that as "some resources everywhere, lots of resources in the bright spots."

Link to comment
Share on other sites

Fractal, are you taking the resource system out of KSPI and bundling this mod with KSPI? I think my resource integration addon would be something that would be good to run with this, trying to think how to best go about it.

Link to comment
Share on other sites

This is pretty cool. I have been messing around with it for awhile and really like it.

Question: if a resource is not available in the atmosphere, say ammonia, and I set up a scoop to try an capture some, will the module simply not give me the option or will it just chug away pulling in nothing? I ask because I tried it and the option just disappeared when I set it to ammonia while sitting on the launchpad at Kerbin.

Link to comment
Share on other sites

This is pretty cool. I have been messing around with it for awhile and really like it.

Question: if a resource is not available in the atmosphere, say ammonia, and I set up a scoop to try an capture some, will the module simply not give me the option or will it just chug away pulling in nothing? I ask because I tried it and the option just disappeared when I set it to ammonia while sitting on the launchpad at Kerbin.

Glad you like it. The behaviour of the included parts is to hide options to collect resources if the amount available is a hard zero, if you leave a part collecting a resource it will also stop if you move into an area where there is zero of that resource available. The collection option will reappear when there is something to find.

Fractal, are you taking the resource system out of KSPI and bundling this mod with KSPI? I think my resource integration addon would be something that would be good to run with this, trying to think how to best go about it.

Yes, that's right. In the current version of Interstellar almost all of this code is replicated but the next version of Interstellar will reference this instead. Interstellar takes advantage of some of the more powerful features included here so I'll try and put up some example code from there showing how to use the ResourceManager. Interstellar also creates the megajoules power management display by using a trick (it reimpliments some parts of ORSResourceOvermanager and ORSResourceSuppliableModule to create a factory for a subclass of ORSResourceManager) so I can show how other modders can do the same thing and create GUIs that provide information about resource managed resources.

I'm fairly certain your resource integration addon won't be affected by the change in architecture, KSPI alters the resource definitions found in this with standard MM nodes (to try and make sure that other mods can make changes afterwards). Your addon uses final nodes so all its changes should be executed after Interstellar's.

Link to comment
Share on other sites

One thing that would be good if there are modellers out there with some free time - add generic models + parts. So the pack could include

short/long range generic scanner - find stuff

small/large generic miner (drill or digger?) - extract it

small/large generic cracking column - break A down into B (and possibly C)

small/large generic reactor vessel - join A and B into C

With stretchy tanks, spherical/toroidal tanks and Modular fuels it should be possible to cover the storage side pretty easily. Or would that require something in modular fuels?

I know this isn't in what you have currently but it's the logical place for such things to live and wouldn't be much effort (once the initial release changes settle down I'll look at it).

Link to comment
Share on other sites

some code for you i made for my own usage, seems to work well iwe used them in a playtrough

AtmosphericExtractor(similear to ISRUScoop but more gui stuff,can switch between different resources on the fly, also made to take electriccharge definable in the partmodule, default is 0)

https://drive.google.com/file/d/0B9yFzV-G4YPzcFgwblZfekJkbnc/edit?usp=sharing

example partmodule


MODULE
{
name = AtmosphericExtractor
ScoopAmount = 0.015
PowerConsumption = 1
}

(ps: i use very low scoopamount because i use oxygen and co2 from asmi's lifesupport that has really low densities)

OceanicExtractor(same as AtmosphericExtractor but for oceanic resource nodes, can switch between different resources on the fly and has gui output, also made to take electriccharge definable in the partmodule, default is 0)

https://drive.google.com/file/d/0B9yFzV-G4YPzZ3ZhNEExTkpsU2s/edit?usp=sharing

example partmodule


MODULE
{
name = OceanicExtractor
ScoopAmount = 0.15
PowerConsumption = 1
}

they both enherit the "no VAB modulename" thing from the ISRUScoop, if anyone knows a quick fix to get that i would appriciate to know how

Edited by landeTLS
Link to comment
Share on other sites

I'd like to edit these a little to support different resource consumption rather than just electric charge and to support resource managed resource consumption, that would make them consistent with the existing modules. After that, I can include them as a general use module if you like?

Link to comment
Share on other sites

I'm excited to play with this, but am also embarrassed to admit I haven;t had the time to. However that won't stop me from asking a question and suggesting a alteration in how resources are defined

Does this take into account where in the atmosphere of a planet a part is trying to harvest things and adjusts the efficiency accordingly? For example, if you at sea level on Kerbin, you'll get oxygen faster that you would if you were 20,000m up, even if we assume the % was still 20.946

And now the annoying suggestion. Right now one needs to define a ATMOSPHERIC_RESOURCE_DEFINITION for each gas in an atmosphere. It would be nicer if we could define things per celestial body, with biome modifiers. With a biome modifier, you could supply a multiplier that would alter the amount of a given material. Like...water vapour in the desert. Something like:


ATMOSPHERIC_RESOURCE_DEFINITION
{
celestialBodyName = Kerbin
RESOURCES
{
Nitrogen = 0.78084
Oxygen = 0.20946
Argon = 0.0093
CarbonDioxide = 0.00035
Neon = 0.00001818
Helium = 0.00000524
Methane = 0.00000175
Krypton = 0.00000114
Hydrogen = 0.00000055
Water = 0.02
}
BIOME
{
name=Desert
Water = 0.1
}
}

Link to comment
Share on other sites

I'd like to edit these a little to support different resource consumption rather than just electric charge and to support resource managed resource consumption, that would make them consistent with the existing modules. After that, I can include them as a general use module if you like?

Ofcourse. Use them as you like

Link to comment
Share on other sites

Btw. I like the kethane grid. I currently use a modded source with both kethane and the fnplugin working in the same namespace. Use the kethane stuff for planetary extraction and fn plugin for the rest. Would it be interesting to create some unified resource scan overlay and gui with planetary resources showing up in a kethane-like grid on the map view only and oceanic/atmospheric/magnethospheric resource scan results integrated into the gui somehow?(maybe also with a togglable highlighting overlay on the oceans, atmosphere/magnetosphere edge, perhaps with fading). I can provide some code too probably. I think this mod appears very promising for a unified resource extraction/scanning system.

EDIT:

i could upload my modified kethane grid with a gray unity gui that says "resource scan map" instead of "kethane scan map" for reference use if you like? i also patched the kethane extractor/animator to show gas effects for other resources than kethane. And i fixed a bug that could make the grid invisible and also changed the main meny grid display to display two different resource overlays

EDIT 2:

the only thing that bugs me about the kethane grid is that the color configs use float converted rgb values(value / 255). Which makes setting resource colors really cumbersome. Making it accept regular rgb values would vastly improve configurability. (Maybe ill try to fix it myself tomorrow)

Edited by landeTLS
Link to comment
Share on other sites

Btw. I like the kethane grid. I currently use a modded source with both kethane and the fnplugin working in the same namespace. Use the kethane stuff for planetary extraction and fn plugin for the rest. Would it be interesting to create some unified resource scan overlay and gui with planetary resources showing up in a kethane-like grid on the map view only and oceanic/atmospheric/magnethospheric resource scan results integrated into the gui somehow?(maybe also with a togglable highlighting overlay on the oceans, atmosphere/magnetosphere edge, perhaps with fading). I can provide some code too probably. I think this mod appears very promising for a unified resource extraction/scanning system.

EDIT:

i could upload my modified kethane grid with a gray unity gui that says "resource scan map" instead of "kethane scan map" for reference use if you like? i also patched the kethane extractor/animator to show gas effects for other resources than kethane. And i fixed a bug that could make the grid invisible and also changed the main meny grid display to display two different resource overlays

EDIT 2:

the only thing that bugs me about the kethane grid is that the color configs use float converted rgb values(value / 255). Which makes setting resource colors really cumbersome. Making it accept regular rgb values would vastly improve configurability. (Maybe ill try to fix it myself tomorrow)

Doing anything with the kethane grid is a no-go for anything other than personal use. Hooking into the Kethane API is allowed but distribution of Kethane, modified or unmodified, is prohibited which makes it license incompatible with this system.

I'm excited to play with this, but am also embarrassed to admit I haven;t had the time to. However that won't stop me from asking a question and suggesting a alteration in how resources are defined

Does this take into account where in the atmosphere of a planet a part is trying to harvest things and adjusts the efficiency accordingly? For example, if you at sea level on Kerbin, you'll get oxygen faster that you would if you were 20,000m up, even if we assume the % was still 20.946

It should but I've just realised that it doesn't so I'll fix this for the next revision.

And now the annoying suggestion. Right now one needs to define a ATMOSPHERIC_RESOURCE_DEFINITION for each gas in an atmosphere. It would be nicer if we could define things per celestial body, with biome modifiers. With a biome modifier, you could supply a multiplier that would alter the amount of a given material. Like...water vapour in the desert.

Using optional image maps to vary concentrations like the PLANETARY_RESOURCE_DEFINITION nodes do is on my list of planned features. I like the extra control of this approach because it allows you to be very specific in creating points of interest.

Link to comment
Share on other sites

Personally I don't like the hex grid system Kethane uses. You land just outside a hex you get nothing - this seems rather illogical. I prefer something with a spread like this where peaks get you more but you won't go completely empty handed by landing off by a few meters.

Link to comment
Share on other sites

Actually I think some talking is in order. I personally dont like the Kethane hard borders - but that is not what the grid is. I think it would be easiyl to put some more granular subgrid there. The grid is just a visualization and that is not a bad one. One could be more granular though (same size fields, i.e. more on a larger planet).

But the license - forget it. I mean not "break it". Contact the owner and talk about whether there is some possibility to integrate it. Just because the Kethane mod is not open enough for incorporation does not mean the Author may not be willing to talk about some integration possibilities. Remember: he is not bound by the license and dual and more licensing is known. For example he may want to integrate Kethane here from HIS side...

Link to comment
Share on other sites

Actually I think some talking is in order. I personally dont like the Kethane hard borders - but that is not what the grid is. I think it would be easiyl to put some more granular subgrid there. The grid is just a visualization and that is not a bad one. One could be more granular though (same size fields, i.e. more on a larger planet).

But the license - forget it. I mean not "break it". Contact the owner and talk about whether there is some possibility to integrate it. Just because the Kethane mod is not open enough for incorporation does not mean the Author may not be willing to talk about some integration possibilities. Remember: he is not bound by the license and dual and more licensing is known. For example he may want to integrate Kethane here from HIS side...

This is what i meant. But making something similear(a kethane-like gui overlay that in its finished state would look nothing like kethane but would use colors in a similar way to mark deposits and have a gui box that allows you to select resource to show/show all resource overlays at the same time. Plus atmospheric/oceanic/magnethospheric overlay with values displayed eather in the main gui or on mouseover the planet) would not be stealing from majiir.

Im all for a granular deposit view. Its just that the current resource display system in ors/kspi is not as visually pleasing as a color overlay. And the atmospheric/oceanic/magnethospheric resources desplay is not integrated into a general gui. The current way the planetary resources are distributed in ors/kspi is fine. But it would be nice but not essential with a more random system.

If this plugin got this working it would certanly become the king of all resource extraction frameworks(there is currently just kethane and kspi/ors)

Edited by landeTLS
Link to comment
Share on other sites

This is what i meant. But making something similear(a kethane-like gui overlay that in its finished state would look nothing like kethane but would use colors in a similar way to mark deposits and have a gui box that allows you to select resource to show/show all resource overlays at the same time. Plus atmospheric/oceanic/magnethospheric overlay with values displayed eather in the main gui or on mouseover the planet) would not be stealing from majiir.

Im all for a granular deposit view. Its just that the current resource display system in ors/kspi is not as visually pleasing as a color overlay. And the atmospheric/oceanic/magnethospheric resources desplay is not integrated into a general gui. The current way the planetary resources are distributed in ors/kspi is fine. But it would be nice but not essential with a more random system.

If this plugin got this working it would certanly become the king of all resource extraction frameworks(there is currently just kethane and kspi/ors)

It's certainly possible that we can find a way to display the resource abundance in a way which provides significantly more detail though I'm not exactly sure what that method should be at this point.

In other news, I've written a new ORSHelper.fixedRequestResource() method which functions very much like KSP's part.requestResource (indeed it calls this method for STACK_PRIORITY_SEARCH and NO_FLOW draws) except that if you request a large amount than can be provided it uses the maximum amount it can manage and returns the change (rather than doing nothing and returning 0). It also implements new code for ALL_VESSEL flow resource draws so that you can draw less than 1e-5 of a resource without the method arbitrarily returning 0.

I'll release this along with a few other minor tweaks in the fairly near future.

Link to comment
Share on other sites

What about a (relatively) simple sphere display overlay? Provide a model of a sphere with a standard cylindrical UV set, so that your resource abundance pngs map directly to their 'correct' locations on this sphere. Using a partially transparent shader of some sort, instantiate the sphere for each planet, for each resource map at the correct centre coordinates so that it's overlaid atop it. Display, say, one at a time.

You could even then allow people to provide a gradient map along with their abundance png, which you could index into to colour the sphere for different resource colourmaps.

Link to comment
Share on other sites

What about a (relatively) simple sphere display overlay? Provide a model of a sphere with a standard cylindrical UV set, so that your resource abundance pngs map directly to their 'correct' locations on this sphere. Using a partially transparent shader of some sort, instantiate the sphere for each planet, for each resource map at the correct centre coordinates so that it's overlaid atop it. Display, say, one at a time.

You could even then allow people to provide a gradient map along with their abundance png, which you could index into to colour the sphere for different resource colourmaps.

I like this idea. Hadnt thought about implimenting it like that. It would probably allow hooking into the current ors resource allocation system with little or no modifications. Its a good place to start. Cudos

The overlay produced would probably need to be simplified somewhat (less variation in shades compared to the png resource maps) for more contrast and easy viewing.

Regarding the custom requestresource method. Iwe been waiting on something just like this. The stock method is really inpredictible especially with large qty requests. Cant wait to test it!

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