Jump to content

Kerbal 4X: inventory and scavenging


SiriusSam

Recommended Posts

Now contains Epic Lootz!

KSP4X adds an inventory where you can store your parts and resources. The number of each item is displayed in the VAB inside the part's icon.

The quantities decrease as you build your ship. If a part displays a negative number this means you don' thave enough in store, the missing quantity will be automatically purchased when you roll out your ship.

Experimental parts cannot be purchased, so you won't be able to place more than you own.

When your recover a ship, all its parts and the resources left are added to the inventory instead of being refunded, but you will still have to pay for the repairs in the normal way.

capture.jpg

Goal

Adding an inventory opens up some gameplay mechanics that i find lacking in Kerbal:

  • Quest rewards: For now, mission rewards in the form of items (aka Lootz) make no sense since they could be replaced by the same amount of money and purchased in the VAB. The inventory would make mission rewards in the form of experimental parts possible. Those parts could be reused as long as you keep recovering them. The part's value would greatly outweight its price since it cannot be replaced until you unlock the part in the tech tree.
  • acquisition of technology from the environment (more Lootz?): in the stock behavior, all parts can be acquired in the VAB, so there is little reason to bother bringing back a part you stumble across on a mission (especially since it would simply be sold back as soon as you return to KSC). Being able to store items you find on the field paves the way to scavenging missions: explore unknown structures in search for alien artifacts, and come back to Kerbin a hero, your container loaded with artifacts. (This would rely on KAS.)

Download link: http://3dstudios.fr/KSP4X/KSP4X.zip

To install, just place the DLL in your Gamedata folder.

Source code : http://3dstudios.fr/KSP4X/KSP4Xsrc.zip

This is public domain.

Changelog

0.4 Alpha

  • Fixed the part bug linked to resources
  • Resource inventory added. Resources are visible in the part's list under "Propulsion". Resource barrels indicate the resource name and quantity available. They cannot be placed on a ship.

0.3 Alpha

  • Accepting a mission to test an experimental part will add one unit to your inventory. It will keep displaying even after the mission is finished, so you'd better make sure you recover it. If the mission is cancelled, the part is removed. If you don't have it anymore (tsk tsk!), you must pay its price.

0.2 Alpha

  • Refunds: when a ship is rolled out, all the parts that you own are free. When a ship is recovered, the part's price isn't refunded (but you still pay for the repairs).
  • Persistence: the inventory is persisted in the savegames,
  • Experimental parts: it is not possible to place more experimental parts than you have in store

0.1 Alpha

  • Display: the quantity available is now displayed in the part's icon (thanks xEvilReeperx)
  • Simplified interface : removed the "store" button, so we're back to Pellinor0's design: Every time you place a part on the ship the counter decreases by one. Parts with negative quantities are the ones that must be purchased when the ship is rolled out.
  • Recovery: vessel parts are recovered when a ship is recovered.
  • Persistent inventory: inventory's content gets saved/loaded

Upcoming

  • Adjustments on the experimental mission : Change the mission reward to reflect the price of the part that was given. Ideally I'm looking for a way to overload the basic PartTest missions so the description indicates these changes.
  • Tweakscale compatibility
  • Disable the mod if not in career mode.

Long term:

  • Moar missions with Lootz
  • Multiple inventories: one per launchpad
  • Recovery missions: derelict ships, debris... land them to recover the parts, including potentially experimental parts or even unique items.
  • Scavenging: explore ruins, recover the parts (using KAS).

Edited by SiriusSam
Link to comment
Share on other sites

Thank you, this would be a great feature. And it certainly demonstrates the kind of gameplay mechanics that could open up if we had a persistent inventory. The entire concept of repairing or reusing your beloved ship makes little sense as long as everything is melted back into money at the end of the mission.

Any idea how i could record damage to parts? a random % of damage upon recovery? based on maximum G experienced during mission? landing speed? or maybe there is already a variable i could use?

A variation of the repairs could be the option to recover the vessel in its landing state and store it in a "garage". You can then load it in the VAB to repair all the parts that went AWOL during that "smooth as silk landing on Eve". Repairing half-wrecks in the VAb sounds like lots of fun to me.

This is at least what i had in mind to cover repairs. Another idea was to add permanent stations where you can buy and sell goods, as well as the extraction of expensive resources (diamonds, gold...) to sell back on earth, thus making a 4X experience (ok... 3X since there is nothing to eXterminate in Kerbal, except your own rockets).

But for now i prefer to stick to the minimum to get the inventory working, trying to make it as seamlessly integrated and stable as possible.

Link to comment
Share on other sites

Some thoughts on the interface questions:

@Interface for Storing Parts: you could just display the number of parts in store (subtracting the current assembly). So the editor shows all parts which are in store or can be bought. For 'regular' parts, a negative (or red) number means the missing parts will be auto-bought when launching. For 'limited' parts, you can get negative while editing (so you can still edit vessels, just let some light turn red), but are not allowed to launch with missing parts. I don't think you need any new drag&drop interface for this to work.

@Environment: what about always recovering parts into the store instead of auto-selling them at recovery? You might even disable selling at all. After all, these parts are highly specialized stuff that you probably can't sell anywhere near the price you paid for them. Otherwise, I'd imagine selling from the VAB where you would have the best overview of your parts stock.

Link to comment
Share on other sites

Pellinor0:

@interface for storing: absolutely. I didnt resist trying to make that part list shorter (but this has a lot to do with the overwhelming number of addons installed in my KSP). By all means i need to know if those icons can be modified in any way, otherwise both methods fail... I will delve into the code next week as i am currently on holiday. but in the meanwhile do you know any mod that affects that aspect of the game?

@environment: this goes well with my conception of the mod, and makes the dev shorter. Sounds good to me. I'll just wait for more input from other users because it sounds a bit hardcore. (But then KSP isn't the most casual game ever created...)

Thanks for the input!

Edited by SiriusSam
Link to comment
Share on other sites

Justice Kerbice

Thanks!

So in your opinion each part would wear off by a certain amount at each mission. This could be a good solution. Then i feed the overall chance of failure to the failure mod. I will install it and check it when i come back.

Another problem I see with the repairs: how to distinguished broken parts in the list. Making multiple icons for the same part sounds like a horror movie... Maybe using the background color of the part to indicate the level of damage (showing the less damaged one first).

Edited by SiriusSam
Link to comment
Share on other sites

@interface for storing: absolutely. I didnt resist trying to make that part list shorter (but this has a lot to do with the overwhelming number of addons installed in my KSP). By all means i need to know if those icons can be modified in any way, otherwise both methods fail... I will delve into the code next week as i am currently on holiday. but in the meanwhile do you know any mod that affects that aspect of the game?

Part catalog selectively hides parts, and simple part organizer allows sorting. Using these two, I never had problems with cluttered part lists.

http://forum.kerbalspaceprogram.com/threads/35018-0-24-PartCatalog-3-0-RC5-%282014-07-18%29

http://forum.kerbalspaceprogram.com/threads/34779-0-21-Simple-Part-Organizer-%28v0-250%29

Editor extensions writes numbers on the screen in the VAB scene (it changes the symmetry field from a symbol to a number). When the elements underneath were moved in 0.24, the number didn't follow, so I guess it just writes to a fixed position on the screen.

http://forum.kerbalspaceprogram.com/threads/38768-0-24-Editor-Extensions-v1-3-19-Jul-2014-%28EdTools-Editor-Tools-replacement%29

For selling parts, I would make it an option (set a percentage in a config file, 0% means you can't sell).

For repairs, I would prefer to have this optional or separate. You could auto-repair parts at recovery (so recovery costs money, both for distance and damage). This avoids damage counters for stored parts. A good damage and repair management probably is a mod on its own, so consider supporting an existing mod instead of writing your own. 'Dang it' comes to my mind (haven't used it yet).

http://forum.kerbalspaceprogram.com/threads/81794-0-24-2-Alpha-3-1-Dang-It!-A-random-failures-mod-%2827-july%29

Edited by pellinor0
Link to comment
Share on other sites

Thanks!

So in your opinion each part would wear off by a certain amount at each mission. This could be a good solution. Then i feed the overall chance of failure to the failure mod. I will install it and check it when i come back.

You're welcome :).

Yes, and this would/should be optional (for players who don't want to deal with failure and repair).

Another problem I see with the repairs: how to distinguished broken parts in the list. Making multiple icons for the same part sounds like a horror movie... Maybe using the background color of the part to indicate the level of damage (showing the less damaged one first).

:) good catch, I don't use one of the mod yet (dangIt or the other), icons maybe if possible, or context menu (the easier I guess) or a health-bar next to stage icons (not sure it worth it), quite like the engine overheating one.

Link to comment
Share on other sites

I think part shall wear and tear differently, let say engines need a overhaul every time they flown and head shields too. Structural parts need repairs when getting to hot in flight or high g-forces in flight. This can correlated with breaking force and heat resistance of the specific part. Mechanical thinks like landing gear and robotic parts needs repairs depending on flight hours. Science parts need calibration after every fight. SRBs and all tanks need refill. Explosive charges in decouplers needs replacement. Batteries, solar cells and RTGs becoming less effective every flight/hours of use.

Edited by Kolago
Link to comment
Share on other sites

Why not make the repair and refurbishment of parts simple? just give the player the choice between selling the parts or adding them to the inventory if they choose to sell its the same result you get in stock where you get money based on how far away the KSC is. If they choose to add the parts to their inventory then they are automatically charged a refurbishment fee based on how far away from the KSC the parts landed?

Have you thought about having separate inventories for separate bases?(for example the bases you get using the kerbin side mod or the ones you make using extraplanetary launchpads or the hangar mod?)

Link to comment
Share on other sites

I agree with passinglurker about the refurbishment system. It seems like a good alternative to rhe previous suggestions. Perhaps a resource inventory, mostly for things like interstellar mod's antimatter but also other resources like fuels.

Link to comment
Share on other sites

  • 4 weeks later...

I am currently implementing the storage logic, it works pretty well:

Dragging parts onto the "Inventory" button adds them to your inventory, while another button allows you to inspect the content of your inventory (acting like a filter on the part list).

But I am running into a problem... To make the inventory fully functionnal, I need to remove the item as soon as (either will work):

1-the player picks it from the filtered list (but I cannot find an event "onPartPickedFromEditor")

2-the part is attached to a ship (that is working) OR it is placed in the background (onEditorShipModified fires, but there is no info on the part that was added).

Does anyone know if these events exist, or any mod that acts similarly?

Link to comment
Share on other sites

I am currently implementing the storage logic, it works pretty well:

Dragging parts onto the "Inventory" button adds them to your inventory, while another button allows you to inspect the content of your inventory (acting like a filter on the part list).

But I am running into a problem... To make the inventory fully functionnal, I need to remove the item as soon as (either will work):

1-the player picks it from the filtered list (but I cannot find an event "onPartPickedFromEditor")

2-the part is attached to a ship (that is working) OR it is placed in the background (onEditorShipModified fires, but there is no info on the part that was added).

Does anyone know if these events exist, or any mod that acts similarly?

I'm not a code savvy person but kerbal construction time seems to implement a form or inventory (ships made from recovered inventory parts can be built and turned around faster) so it might be worth poking around their code. the only other remotely similar mod I know of is the resourcerecovery mod.

Link to comment
Share on other sites

@passinglurker

Yes i dit, it has all i need for the recovery of parts, though i use the inventory a bit differently.

But someone just pointed me the event i was looking for, so i should be able to finish this part easily.

Thanks for the help! This community is really good for modding.

Link to comment
Share on other sites

Hi everyone,

I made some progress on the mod:

-display: the quantity available is now displayed in the part's icon (thanks xEvilReeperx)

-simplified interface : removed the "store" button, we're back to Pellinor0's design: Every time you place a part on the ship the counter decreases by one. Parts with negative quantities are the ones that must be purchased.

-Recovery: vessel parts are recovered when a ship is recovered.

-Persistent inventory: inventory's content gets saved/loaded

Loopholes:

When you exit the VAB, the current assembly persists in the hanger. When a vehicle recovered it is placed in the VAB.

In both cases, the vessel parts items should be removed from the inventory, other wise you can build a vessel, leave the hangar, come back and get free parts... but I can't find the location of the vehicle currently on assembly.

When the first part is created, it should be removed from inventory. But i can't find the event.

Experimental parts are greyed out when they reach 0, so you cannot place any more of them. But using symmetry it is possible to place more parts than currently available. So i'd need to limit the symmetry under the currently available amount.

Other developments:

The inventory is currently saved as a config file. It should be in the savegame file.

The price of the ship doesn't reflect the parts already owned.

Feel free to try out the plugin.

DOWNLOAD LINK:

http://3dstudios.fr/KSP4X/KSP4X.zip

Edited by SiriusSam
Link to comment
Share on other sites

would it be possible to have off world inventories? I've been hunting for a mod that'll let me macgyver debris I've hauled into orbit and repurpose it. something that lets me collect and inventorize parts in orbit and spawn a ship in orbit made from them would be a dream come true but so far the mods I've looked at for the job have always come up short. KAS never seems to attach things on straight and it doesn't deal in large parts, ExPL requires breaking the whole ship down into resources and rebuilding from scratch and since you can turn any part into any other part it removes the fun of making due with what you have. and as for stock I thought klaws would be a god send but you can't target debris center of mass like you can with asteroids so they are only good for refueling old craft not building onto them.

Link to comment
Share on other sites

@passinglurker

Hello,

Well i don't know if it is possible yet. I have a lot of long term objectives like orbital factories, trading with outposts and maybe give a go for the damage to parts. This is why i called it Kerbal4X :)

But right now I am still trying to save the inventory in the game save instead of the config file... So it could take months before i get there.

On the plus side, i have already found how to save one inventory by launchsite, so it will be possible to have multiple sites with different inventories.

Also I think it is possible to put whole parts in the inventory and have them display the whole thing in the icon. If this is the case then we're a bit closer to what you want.

Festina lente!

Link to comment
Share on other sites

@Chezburgar7300

So far the money isn't even refunded :)

This is very much WIP, but the first milestone will soon be reached.

My plan for resource is to have them recovered as well. I plan to display them as barrels in the inventory, with the quantity of the resource displayed.

I will get to that part when im done with the funds, the saving and i fix the 2 little loopholes that are left in the system.

Link to comment
Share on other sites

So in principle an inventory could be something as small as a KAS-container, allowing to use the full editor interface for more precise assembling. This is geetting greater than I thought. First saw this mod mainly as a KSC-only solution to manage experimental parts and the like.

Link to comment
Share on other sites

@passinglurker

Hello,

Well i don't know if it is possible yet. I have a lot of long term objectives like orbital factories, trading with outposts and maybe give a go for the damage to parts. This is why i called it Kerbal4X :)

But right now I am still trying to save the inventory in the game save instead of the config file... So it could take months before i get there.

On the plus side, i have already found how to save one inventory by launchsite, so it will be possible to have multiple sites with different inventories.

Also I think it is possible to put whole parts in the inventory and have them display the whole thing in the icon. If this is the case then we're a bit closer to what you want.

Festina lente!

well if you are looking for more mods to poke around inside their code the three I know that spawn ships are kerbtown, extraplanetary launchpads(ExPL), and hangar(hangar also stores whole ships in its own inventory(but has no way to glue bits of ship together unfortunatly).

as for what the mod is capable of doing now are there any mods out there that randomly spawn things other than asteroids using the asteroid code? for that spawn things other than stranded kerbals using the contract code? you know for alien archeology and space piracy and stuff

Edited by passinglurker
Link to comment
Share on other sites

@pellinor

I think so but i still have to try it. In essence, when we can have multiple inventories I don't see a problem doing this.

I definitely want to make the assembly directly in space (at a much later stage), and use the panel to interact with KAS containers.

I'm not sure if its possible but so far Kerbal is very open, it feels less like modding and more like programming.. so we'll see when i reach the level :)

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