Jump to content

Kerbal 4X: inventory and scavenging


SiriusSam

Recommended Posts

Just a question:

What do you think about storing whole individual ships after recovering? So that you can launch them again.

Let's say you have build a spaceplane, you are flying it into space and back, and after landing you store it. If there are parts missing, they can be purchased and will be added automatically to the ship.

Also there should be the ability to name the ships.

greetings,

Themorris

Link to comment
Share on other sites

Hello Themorris,

This was part of my original plan, because I really like the idea of refurbishing a ship that jsut landed and sending it back ^^

In the end i'd like to have 3 kinds of storage:

-parts

-vehicles

-assemblies

But for now idecided to focus on the most "simple" aspect (parts) until it works 100%.

As a sidenote, the mod KCT (Kerbal Construction Time) sounds pretty close to what you are describing.

Link to comment
Share on other sites

Magico

Let's continue the technical conversation as private messages if you don't mind, I would prefer to keep this thread readable for everyone.

Or Maybe we can open a new thread?

Anyway my answer will be in PM shortly.

I don't really think anyone would mind you guys talking about mod development in a thread under the mod delevelopment subforum...
Link to comment
Share on other sites

KCT will likely have something similar to that in the future, where you have the option of breaking a ship up into parts for the inventory or just refurbishing and rebuilding it as is, which is really only useful for SSTOs that don't have cargo, but would result in even smaller build times.

To me it never made any sense to store ships or assemblies specifically. I find it more restrictive than need be, at least for KCT. It's also way easier to deal only in parts. All a subassembly is is a bunch of parts that get added onto some other parts that need to be built still, so (for KCT at least) just prebuild your subassemblies and use the parts out of the inventory for the final build. Whole ships have reduced rebuild times if you use the same "model" and if you recover all the parts for it it takes comparatively no time to build. Since you have instant construction I don't see why assemblies or ships should be stored any differently from their component parts.

@Themmoris

I'm curious as to how that's much different from recovering the vessel, then clicking on the runway and launching the vessel again? Wouldn't that do the same thing you describe? That would purchase any missing parts and build the ship. With KCT you'd have to go into the SPH and press the build button, which is one more scene change than just recovering, but is still basically the same.

@SiriusSam

BTW, I'm fine with any of the names presented so far (Open/Shared/Common Inventory [system], PartsBin, etc) :)

For vessel recovery, maybe each mod can "tag" or "flag" a vessel for being disassembled and then the inventory.dll will disassemble it into parts. If multiple mods tag the same vessel, it only gets disassembled once (should be able to store the last tagged Vessel [maybe just the id] and compare that to any new tagged Vessels). Otherwise, simply setting a "PerformRecovery" flag to true would also work and then the inventory.dll would listen on the vessel recovery event and do all the recovery itself. Either method is fine by me.

We should maybe find a different way/place to discuss this. Either a new forum thread or PMs. Otherwise it may accidentally monopolize your thread :P

Link to comment
Share on other sites

Hi,

I am making a test for the resource storage. Resources are now visible in the inventory, with the quantity available / in use.

capture.jpg

It works like parts, resources recovered are stored and reused as much as possible for future ships.

It will really start making sense when we start collecting rare resources from other planets (for example KSPI's anti-matter), so it can wait for later.

What do you think of this system? useful? overkill?

Edited by SiriusSam
Link to comment
Share on other sites

One question that I think will probably come up: Can you sell parts/resources? Especially resources. Some mods let you mine resources on other moons/planets/asteroids and return them to Kerbin for funds. Resource recovery would make that impossible since they would just be added to the inventory. I meant to say that in the PM, but it's more related to this mod rather than the inventory.dll.

Link to comment
Share on other sites

Hi,

I am making a test for the resource storage. Resources are now visible in the inventory, with the quantity available / in use.

It works like parts, resources recovered are stored and reused as much as possible for future ships.

It will really start making sense when we start collecting rare resources from other planets (for example KSPI's anti-matter), so it can wait for later.

What do you think of this system? useful? overkill?

It's depend how it's works and how we deal with resources. It may eventually allow you to set "difficulty" mode: start with no resources, start with a little amount or more, with the addition of resources "market" (we can just buy and sell at a fixed price but it may open some doors for extensions).

Link to comment
Share on other sites

Yes, definitely. I was trying to add as little to the game UI, but i think i can't escape a toolbar icon for actions like these.

I'm thinking of a little panel that would sum up some information about the costs, and allows you sell items or filter the list to see all the parts you own.

Link to comment
Share on other sites

Could you make the propellants displayed/purchased elsewhere ?

I mean, one fuel tank on the pic above, and maybe a list:

LF 360/540

MP 10/10

Ox 440/660

SF 433/433

It may be out of the scope of your mod right now, but maybe one tank, and "fill with" action, the propellant we want. This will obviously make fuel tank fully versatile (in the cost of forgetting the property of each propellant and their requirement for storage/usage).

Link to comment
Share on other sites

Thanks it looks much better like this, i just need to make it more readable

it gets a bit cluttered if i start displaying the prices, i think i'd better make a total

You're welcome.

But as passinglurker said, doing this way is not very good, as it will for sure go over everything and mess up the parts display (using RealFuels for example).

I more imagine a small window (moveable maybe/a toolbar window which can be closed/hidden) with a slider if relevant with all the resources.

Link to comment
Share on other sites

What about 4 per icon, like you had before, and then as many icons as are needed. Maybe don't show the resource it it's 0, but then do if it's positive or negative. That might keep it from getting too cluttered.

Edit: Looks like you already don't show it if there's none in the inventory, so forget that last part

Link to comment
Share on other sites

I could also switch pages on click. Or maybe even switching between both styles by clicking on the "summary" icon... (not sure i can pull it out)

Looking at the screenshots i prefer the display of one icon per resource, but we need a way to filter them.

There's also the problem of implementation:

-if I use one part total: the modders must register the name of their resource + abbreviation in a static dictionary

-if i use one part per resource: the modders must supply one part named like their resource (unless one of you knows how to add a part programatically).

How about the display? Do you prefer "used/stored" ? or the total (stored - used) ?

Edited by SiriusSam
Link to comment
Share on other sites

Why not just use the current part you're using for all of them (it's like a storage drum), one per part, and listed at the end of the propulsion tab? Total may be better since, especially for liquid fuel or TAC life support oxygen the quantities are going to be very large, very quickly, meaning you'd run out of space.

Link to comment
Share on other sites

Well, i added both. By default you see only one barrel with the summary of the main resources. Clicking on it will toggle to the other view. Clicking on any of the resources will toggle back to summary.

I have also added public static parameters to modify the behavior of the DLL.

  • ManageResources yes/no: if false, resources aren't taken into account (and their parts don't appear in the editor). Otherwise they are stored/refunded etc.
  • ResourceDisplay: minimal / detail, can be switched programatically to change between the two modes.
  • a String.Format for the text that appears inside the icons, so each modder can choose how they want to format the information.

I am currently splitting the project in two parts:

The Scrapyard, Shared Inventory System:

The base of the mod. Manages parts and resource storage. If you plan on making a mod using the Scrapyard, you should link to this DLL. More detailed explanation to come.

KSP 4X

This DLL is based on the Scrapyard, so far it only adds the rewards for experimental parts, but this is where i will keep adding features and missions in the future. It is a good example to get started if you want to make a mod based on the Scrapyard.

I am setting up the GitHub and collaborating with Magico to determine the best way to go about this, so there will be some changes to this thread shortly.

Edited by SiriusSam
Link to comment
Share on other sites

  • 4 weeks later...

@SiriusSam: any news ?

I have some idea to use your Scrapyard code :).

EDIT: and a bad news, with a sandbox save, having some vessels somewhere to recover maybe, I got this:

Recovering ship scifi t2 Debris: Adding parts to Inventory, current scene=EDITOR

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

NullReferenceException: Object reference not set to an instance of an object

at KSP4X.InventoryManager.OnVesselRecovered (.ProtoVessel proto) [0x00000] in <filename unknown>:0

at EventData`1[ProtoVessel].Fire (.ProtoVessel data) [0x00000] in <filename unknown>:0

at ShipConstruction.RecoverVesselFromFlight (.ProtoVessel vessel, .FlightState fromState) [0x00000] in <filename unknown>:0

at FlightDriver.Start () [0x00000] in <filename unknown>:0

After that, it's a complete disaster and Kerbal Alarm Clock seems to have trouble doing its job:

KerbalAlarmClock,Active Vessel unreadable - resetting inqueue flag

and an infinite loop of:

NullReferenceException: Object reference not set to an instance of an object

at ResourceDisplay.CreateResourceList () [0x00000] in <filename unknown>:0

at ResourceDisplay.Update () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

NullReferenceException: Object reference not set to an instance of an object

at UIPartActionController.UpdateResourceWindows () [0x00000] in <filename unknown>:0

at UIPartActionController.UpdateFlight () [0x00000] in <filename unknown>:0

at UIPartActionController.Update () [0x00000] in <filename unknown>:0

EDIT 2: vessels are not debris, and all was "recovered" by force without asking me 1st ! :huh:

By the way; KSP 0.24.2 on win7.

Edited by Justin Kerbice
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...