Jump to content

[Min KSP 1.12.X] Sandcastle: 3D printing for parts and vessels


Angelo Kerman

Recommended Posts

Features completed for the Shipwright!

v7LWD4S.png

KaEs3Go.png

dCpp3Mn.png

0NnkQFR.png

Now it can handle special resources required to print the vessel, just like the existing printers can require when printing parts. Additionally it can handle the resources required to print parts in the vessel that are deployed- like the test base here. Its assembled Castillo parts require Ore and Konkrete.

Additionally, the Shipwright can create an alarm to let players know when the printing will be done. Note though, you'll need to ensure that you have sufficient resources on hand, or you'll run into problems.

Now that it's done, I have to create the Shipbreaker, the vessel recycler that will tear vessels down into their constituent parts. If you have room in your inventory then the parts will be added, and if not, it'll work like the existing recycler.

Link to comment
Share on other sites

Also, just a heads up that once I get the Shipbreaker done, I'll create a release for Sandcastle. It won't have everything that I want completed, but it's enough for people to play with.

Link to comment
Share on other sites

8 hours ago, KspNoobUsernameTaken said:

This is interesting; will EL be a dependency? If not, Sandcastle would be an all in one solution for vessel building.

 

Edit: NVM, found the answer in a previous post. How does the printer decide where to spawn the ship?

There is a spawn transform that I create in the 3D model, much like how EL's launchpad parts work.

EL has always been optional, but now the Sandcaster and construction manipulator will always be available even when EL isn't installed. You'll also have the option to use EL's RocketParts-based vessel construction or Sandcastle's Ore-based vessel construction. It depends on your play style.

Link to comment
Share on other sites

8 hours ago, Angelo Kerman said:

There is a spawn transform that I create in the 3D model, much like how EL's launchpad parts work.

EL has always been optional, but now the Sandcaster and construction manipulator will always be available even when EL isn't installed. You'll also have the option to use EL's RocketParts-based vessel construction or Sandcastle's Ore-based vessel construction. It depends on your play style.

So do you select a launchpad or does each ship-printer have a fixed spawn point?

Link to comment
Share on other sites

On 7/27/2024 at 11:49 PM, KspNoobUsernameTaken said:

So do you select a launchpad or does each ship-printer have a fixed spawn point?

Each printer has a fixed point. One thing I've noticed about EL is that the survey stakes can be a challenge to use and get set up right. Sandcastle's fixed point just ahead of the print nozzle bypasses that issue.

Currently I'm working on getting the Shipbreaker (vessel recycler) working. The basic mechanics are almost there. then I need to work up a user interface for it. I have an intense week at work this week so things are slow as a result...

Link to comment
Share on other sites

9 hours ago, Angelo Kerman said:

Each printer has a fixed point. One thing I've noticed about EL is that the survey stakes can be a challenge to use and get set up right. Sandcastle's fixed point just ahead of the print nozzle bypasses that issue.

Currently I'm working on getting the Shipbreaker (vessel recycler) working. The basic mechanics are almost there. then I need to work up a user interface for it. I have an intense week at work this week so things are slow as a result...

So how would it work with super-massive vessels being printed? Like ships big enough to clip the printer. 

 

You also mentioned transforms. Will that work out of the box with the pathfinder template system? Or will the transforms need to be added in an update?

 

Ship printing is a different partmodules from the standard printer right?

Link to comment
Share on other sites

1 hour ago, KspNoobUsernameTaken said:

So how would it work with super-massive vessels being printed? Like ships big enough to clip the printer. 

 

You also mentioned transforms. Will that work out of the box with the pathfinder template system? Or will the transforms need to be added in an update?

 

Ship printing is a different partmodules from the standard printer right?

Right. The Shipwright is a different part module than the print shop. While the print shop can only print and store items into an available inventory slot, the Shipwright can print an entire vessel. It does so by  pretending to print each part that comprises the vessel- that's how I can get away with taking an existing part from the inventory (assuming you had a big enough space for it), and using it instead of consuming more resources.

For large vessels like this one:

0NnkQFR.png

I calculate the dimensions of the vessel and offset the spawn point to avoid the collisions you're rightfully concerned with. And since we're talking about a craft file, the templates will already be set up. In the above case, the boxed parts that comprise the domes are pre-assembled in the SPH, and the Shipwright knows that and adds the additional required mass. Ideally that would work for any part but the truth is that I can't account for every part mod out there, so there are bound to be some issues. But if the part uses the stock ModulePartVariants, and the selected variant has additional mass, then the Shipwright can account for it. It's also already set up to handle the part variants found in Buffalo 2 and SunkWorks.

Side Note: The Storage Depot can only hold 50,000 liters of stuff (or, it will once I get some bug fixes done). I can imagine a certain someone *cough* @JadeOfMaar *cough* creating a huge warehouse part for storing those big 5m fuel tanks and such... ;)

Link to comment
Share on other sites

36 minutes ago, Angelo Kerman said:

I calculate the dimensions of the vessel and offset the spawn point to avoid the collisions you're rightfully concerned with.

Ah, good. That was what I guessed, but never hurts to be sure. 

 

36 minutes ago, Angelo Kerman said:

And since we're talking about a craft file, the templates will already be set up.

What I meant was, configuring pathfinder parts to have the shipwright module via template. Since they don't have pre-made spawn transforms, I wanted to know if you'd need to update Pathfinder to give those transforms to the parts.

 

E.g, a shipwright template for the Hacienda. Since the Hacienda probably doesn't have a transform for ship spawning yet, would you need to add that in. 

Link to comment
Share on other sites

29 minutes ago, KspNoobUsernameTaken said:

Ah, good. That was what I guessed, but never hurts to be sure. 

 

What I meant was, configuring pathfinder parts to have the shipwright module via template. Since they don't have pre-made spawn transforms, I wanted to know if you'd need to update Pathfinder to give those transforms to the parts.

 

E.g, a shipwright template for the Hacienda. Since the Hacienda probably doesn't have a transform for ship spawning yet, would you need to add that in. 

Ah, yes, you'd need to change them to have a spawn transform in order to print vessels. For the print shop you wouldn't need a transform. I think the Rangeland pad's EL spawn transform could work though, but I haven't tested it yet.

Link to comment
Share on other sites

59 minutes ago, Angelo Kerman said:

Ah, yes, you'd need to change them to have a spawn transform in order to print vessels. For the print shop you wouldn't need a transform. I think the Rangeland pad's EL spawn transform could work though, but I haven't tested it yet.

Ok, so the transform CANT be defined by cfg, correct? You'd have to import the mu file and do Unity stuff to it?

Link to comment
Share on other sites

7 hours ago, KspNoobUsernameTaken said:

Ok, so the transform CANT be defined by cfg, correct? You'd have to import the mu file and do Unity stuff to it?

The easier thing to do is produce a .mu which exists just for the dedicated transform. Then you weld this to the target part by placing an additional MODEL{} in the target's config. Then  you can name its transform like normal. I've done this for some scoops and for early models for my KFS-compatible anti-grav engines.

Link to comment
Share on other sites

19 minutes ago, JadeOfMaar said:

The easier thing to do is produce a .mu which exists just for the dedicated transform. Then you weld this to the target part by placing an additional MODEL{} in the target's config. Then  you can name its transform like normal. I've done this for some scoops and for early models for my KFS-compatible anti-grav engines.

I thought of that previously but discarded it because I'm not familiar with MODEL nodes. Good to know it's possible. So with this, I could create my own transforms for mod parts without editing the mod's files.

Very helpful.

Link to comment
Share on other sites

I guess the other way to make it work would be to allow the option to use the host part's origin point along with an offset. That is doable, but it would be up to the config writer to do a lot of testing to make sure that spawned vessels don't collide with the host part. Plus, the recycler would not function as it needs a special collider set as a trigger. @JadeOfMaar's technique of adding additional MODEL objects would help with that.

I can add a couple of basic .mu files for exactly that purpose, but the config writer would need to incorporate them into the desired host part(s).

Link to comment
Share on other sites

Next update will add some help to setup other parts as printers. Here's a draft of "Adding Printers To Parts.txt"

Spoiler

Sandcastle provides the Sandcastle 3D Print Shop and Quicksand 3D Print Shop that prints parts and places them into the vessel's inventory. They can also recycle parts in your inventory, turning them into raw resources.
Similarly, the Sandcaster 3D Printer and the EL-OCD Konstruction Manipulator can print entire vessels and recycle them into raw resources.
But what if you'd like to give your own parts those abilities? Read on!

Sandcastle's printers use Ore to print their parts and vessels, but you can easily customize that for other resources if desired. That customization is beyond the scope of this document. Instead, please refer to MaterialsList.cfg for a detailed description of what you can customize and how. This document just shows you how to add the require part modules to your part config.

CONTENTS

*** Adding a print shop ***
*** Adding a recycler ***
*** Adding a vessel printer ***
*** Adding a vessel recycler ***

*** Adding a print shop ***

To add the print shop part module, just cut and paste the following, and change the parameters to your liking:

    MODULE
    {
        name = WBIPrintShop

        // The maximum volume that the printer can print, in liters. Set to less than 0 for no restrictions.
        // This number corresponds to the packedVolume field of the ModuleCargoPart part module config.
        maxPrintVolume = 11000

        // The number of resource units per second that the printer can print.
        printSpeedUSec = 0.25

        // Flag to indicate whether or not to allow specialists to improve the print speed.
        // Exactly how the specialist does that is a trade secret.
        UseSpecialistBonus = true

        // Per experience rating, how much to improve the print speed by.
        // The print shop part must have crew capacity.
        SpecialistBonus = 0.05

        // The skill required to improve the print speed.
        ExperienceEffect = "ConverterSkill"

        // Name of the effect to play from the part's EFFECTS node when the printer is running.
//        runningEffect =

        // Name of the animation to play when the printer is running.
        animationName = PrinterAnim

        // The printer itself may require one or more resources in order to operate.
        // You can also use INPUT_RESOURCE in place of RESOURCE, but the other fields remain the same.        
        // It's possible to have some kind of OUTPUT_RESOURCE as well, but we just use the stock resources.
        RESOURCE
        {
            name = ElectricCharge
            rate = 10
        }

        // Normally, 3D printers can print from any category, but you can create specialized printers
        // that can only print from one or more categories. To do so, simply specify a CATEGORY_WHITELIST
        // and one or more whitelistedCategory entries.
//        CATEGORY_WHITELIST
//        {
//            whitelistedCategory = Pods
//            whitelistedCategory = Electrical
//            whitelistedCategory = none
//        }

        // Normally, 3D printers can print any part that fits in its maxPrintVolume, but you can create specialized printers
        // that can only print one or more parts. To do so, simply specify a PARTS_WHITELIST and one or more whitelistedPart entries.
        // Parts on the whitelist can be printed even if they show up on the global PARTS_BLACKLIST.
//        PARTS_WHITELIST
//        {
//            whitelistedPart = batteryPack
//            whitelistedPart = probeCoreCube
//        }

        // Normally, 3D printers can print any part that fits in its maxPrintVolume, but you can create specialized printers
        // that are incapable of printing parts on this list. To do so, simply specify a PARTS_BLACKLIST and one or more blacklistedPart entries.
//        PARTS_BLACKLIST
//        {
//            blacklistedPart = whoopieCushions
//            blacklistedPart = boomerangFish
//        }
    }


*** Adding a recycler ***

To add the part recycler part module, just cut and paste the following, and change the parameters to your liking:

    MODULE
    {
        name = WBICargoRecycler
        
        // The number of units of a resource to recycle per second.
        recycleSpeedUSec = 0.5

        // What percentage of the resources that can be recycled.
        recyclePercentage = 0.45

        // Flag to indicate whether or not to allow specialists to improve the recycle speed.
        // Exactly how the specialist does that is a trade secret.
        UseSpecialistBonus = true

        // Per experience rating, how much to improve the recycle speed by.
        // The recycler part must have crew capacity.
        SpecialistBonus = 0.05

        // The skill required to improve the recycling speed.
        ExperienceEffect = "ConverterSkill"

        // Name of the effect to play from the part's EFFECTS node when the recycler is running.
//        runningEffect =

        // Name of the animation to play when the printer is running.
        animationName = PrinterAnim

        // The recycler itself may require one or more resources in order to operate.
        // You can also use INPUT_RESOURCE in place of RESOURCE, but the other fields remain the same.        
        // It's possible to have some kind of OUTPUT_RESOURCE as well, but we just use the stock resources.
        RESOURCE
        {
            name = ElectricCharge
            rate = 5
        }
    }

*** Adding a vessel printer ***

To add a vessel printer to your part, you'll need two entries in your part config file: a MODEL config node for the vessel spawn points, and the SCShipwright part module.
The vessel printer needs to know where to spawn the vessel. To do that, add the following MODEL config node to your part's config file:

    MODEL
    {
        model = WildBlueIndustries/Sandcastle/Parts/Utility/SharedAssets/spawnPoints
    }

The above should go right after the existing MODEL object. Next add the following, adjusting parameters as desired:

    MODULE
    {
        name = SCShipwright
        printSpeedUSec = 0.25
        UseSpecialistBonus = false
//        debugMode = true

        // Spawn transform
        //   +Y
        //    |
        // +Z | +X
        //   \|/
        spawnTransformName = VesselSpawnPoint

        // In meters how far along the X, Y, and Z axis to offset the spawn transform. YOU NEED TO EXPERIMENT WITH THIS to avoid spawned vessels from colliding with the printer part.
        spawnTransformOffset =

        // Maximum possible craft size that can be printed: Height (X) Width (Y) Length (Z)
        // Leave empty for unlimited printing.
//        maxCraftDimensions =

        RESOURCE
        {
            name = ElectricCharge
            rate = 10
        }
    }

*** Adding a vessel recycler ***

To add a vessel recycler to your part, you'll need two entries: a MODEL config node for the vessel spawn points, and the SCShipbreaker part module.
The vessel recycler needs to know what triggers the recycler to activate. To do that, add the following MODEL config node to your part's config file:

    MODEL
    {
        model = WildBlueIndustries/Sandcastle/Parts/Utility/SharedAssets/spawnPoints
    }

The above should go right after the existing MODEL object. Next add the following, adjusting parameters as desired:

    MODULE
    {
        name = SCShipbreaker
//        debugMode = true
        recycleSpeedUSec = 0.25
        recyclePercentage = 0.4
        UseSpecialistBonus = false

        // In meters how far along the X, Y, and Z axis to offset the recycler's activation trigger. YOU NEED TO EXPERIMENT WITH THIS to avoid spawned vessels from colliding with the printer part.
        // As a good rule of thumb, use the same values that you use for the spawnTransformOffset found in the SCShipwright.
        spawnTransformOffset =

        // The recycler itself may require one or more resources in order to operate.
        // You can also use INPUT_RESOURCE in place of RESOURCE, but the other fields remain the same.        
        // It's possible to have some kind of OUTPUT_RESOURCE as well, but we just use the stock resources.
        RESOURCE
        {
            name = ElectricCharge
            rate = 5
        }
    }

*** (Advanced) Adding a part-vessel printer ***

You can print a single part and spawn it just like a vessel. To do that, you'll need two entries in your part config file: a MODEL config node for the vessel spawn points, and the WBIPrintShop part module.
The printer needs to know where to spawn the part. To do that, add the following MODEL config node to your part's config file:

    MODEL
    {
        model = WildBlueIndustries/Sandcastle/Parts/Utility/SharedAssets/spawnPoints
    }

The above should go right after the existing MODEL object. Next add the following, adjusting parameters as desired:

    MODULE
    {
        name = WBIPrintShop

        // Prints parts of any size
        maxPrintVolume = -1

        printSpeedUSec = 0.25

        UseSpecialistBonus = false

        // Spawns the part into the world instead of placing it into an inventory
        enablePartSpawn = true

        // Where to spawn the printed part.
        spawnTransformName = VesselSpawnPoint

        // In meters how far along the X, Y, and Z axis to offset the spawn transform. YOU NEED TO EXPERIMENT WITH THIS to avoid spawned vessels from colliding with the printer part.
        spawnTransformOffset =

        // Axis upon which to displace the part during spawn in. X, Y, Z
        offsetAxis = 0,1,1

        // What to show on the button that opens the printer
        printShopGUIName = #LOC_SANDCASTLE_printAPart

        // Custom group name of the part printer
        printShopwGroupDisplayName = #LOC_SANDCASTLE_partPrinter

        // Name the print shop something other than "Print Shop"
        printShopDialogTitle = #LOC_SANDCASTLE_partPrinter

        RESOURCE
        {
            name = ElectricCharge
            rate = 10
        }
    }

 

Link to comment
Share on other sites

25 minutes ago, KspNoobUsernameTaken said:

Can multiple vessel-printers work together to speed up building super-large ships?

Only one vessel printer can print a single vessel, but you can have multiple print shops printing parts for you (if you have enough room to store the parts).

Link to comment
Share on other sites

17 minutes ago, Angelo Kerman said:

Only one vessel printer can print a single vessel, but you can have multiple print shops printing parts for you (if you have enough room to store the parts).

A nice feature might be a button to "use all printers", which will make all part printers print the correct parts for the vessel printer to use.

Does the vessel printer check for stored parts continuously, or at the start of a print job? E.g, if a part printer finished a part while a vessel printer was running, could the vessel printer use that part?

Link to comment
Share on other sites

4 minutes ago, KspNoobUsernameTaken said:

A nice feature might be a button to "use all printers", which will make all part printers print the correct parts for the vessel printer to use.

Does the vessel printer check for stored parts continuously, or at the start of a print job? E.g, if a part printer finished a part while a vessel printer was running, could the vessel printer use that part?

When the Shipwright starts a print job it sends out a request to all available printers to print parts. Each time the Shipwright begins to print a part, it first checks the inventory. If a part is already available, then it will use it. Otherwise it will "print" the part using raw resources.

Link to comment
Share on other sites

3 minutes ago, Angelo Kerman said:

When the Shipwright starts a print job it sends out a request to all available printers to print parts. Each time the Shipwright begins to print a part, it first checks the inventory. If a part is already available, then it will use it. Otherwise it will "print" the part using raw resources.

Ah, ok, you already thought of that. This sounds good, I'm looking forward to trying it out.

Link to comment
Share on other sites

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