Knuckle Cracker

Particle Fleet => Map Makers, Ship Builders, and Coders => Topic started by: kajacx on December 04, 2016, 05:10:02 AM

Title: Proof of concept: merging ships
Post by: kajacx on December 04, 2016, 05:10:02 AM
Last week I wrote about how to create custom ships in PRPL (https://knucklecracker.com/forums/index.php?topic=22454.0) and now I have expanded on that and created a script that will take your ships and merge them into a lerger one, in-game! How it looks:

(http://image.prntscr.com/image/01d3b5b44fd843d1ab0b904853c8361a.png)

This is how it currently works: You move 5 ships you want to merge together into the highlighted area. Then, you go to the script menu and hit "Compile" (it only works in level editor for now) and if you have your ships aligned properly (I reccomend sliding ships with E pressed to avoid any rotation), then the merged ship will be added to yout stock (make sure you have room there). You can then build it and have fun with it.

Now for the problems, as there are many: I have not found many PRPL functions that i needed to make this work as I wanted (for example, how to insta-build your ship, or how to get what modules are on a ship and where), so I will be making a suggestion post, asking for addition of these functions. If those functions are added, I will remake the script so it isn't so terrible.

However, I said last week that I will make merging of ships, so there you go! By the way, you can create ships with size larger than 35x25 with this!
Title: Re: Proof of concept: merging ships
Post by: GoodMorning on December 04, 2016, 06:42:27 AM
Interesting.

I think that we may need ExtractPlanFromShip, and a function or two to set the build state of hull/modules.
Title: Re: Proof of concept: merging ships
Post by: Oblivion on December 04, 2016, 07:01:45 PM
Someones going to make a huge command ship now with this. Im counting on it.
Title: Re: Proof of concept: merging ships
Post by: GoodMorning on December 04, 2016, 07:12:07 PM
Thought: PRPL (Custom Module) Joint

Place two joint modules together, and the ships will fuse. Both CMs must remain operational. If the joint is broken, the ships divide. Possibly each CM continues to request power.
Title: Re: Proof of concept: merging ships
Post by: Oblivion on December 05, 2016, 06:46:36 AM
Wouldn't the new Joint ship just have one CM after the merge?
Title: Re: Proof of concept: merging ships
Post by: GoodMorning on December 05, 2016, 06:54:09 AM
I am suggesting a new module, probably PRPLed (at least to begin with). I was envisioning a Joint as some sort of coupling module, which could be used/reused mid-game.
Title: Re: Proof of concept: merging ships
Post by: kajacx on December 05, 2016, 07:47:51 AM
If you want to create uber large ships, this is not yet the way to go, since the merging unfortunately works only for the in-game ships for now.

The reason for that is the lack of GetShipModules and GetShipCMLocation functions, so you cannot read what modules does a ship have with PRPL. Instead I used the front center hull piece to distinguish between different ships, with the module lists and CM locations hardwired into the code.

The same can be said for the joits idea: a good idea, but it would be too much work to program now.

If you want to create a supidly large ship, use the Java code I add here instead, it has examples for Lathe and Cruiser, so it should be pretty straight-forward, just keep in mind that the first line of the hull (in the code) is acctually the bottom line of the hull (on the ship), and the module coordinates are 0-index from the bottom-left of the ship. After you get the base64-encoded string, just feed it into the "AddCustomShipToInventory" PRPL function and there you go.
Title: Re: Proof of concept: merging ships
Post by: TonnyT on December 05, 2016, 02:41:26 PM
So if one command module goes, what happens? Does the whole ship go? Or does the particulate need to destroy all 5?
Title: Re: Proof of concept: merging ships
Post by: planetfall on December 05, 2016, 02:50:31 PM
If you look at the example screenshot, it appears all CMs except the center one are replaced with energy tanks.
Title: Re: Proof of concept: merging ships
Post by: GoodMorning on December 05, 2016, 04:20:39 PM
Perhaps I wasn't clear. This was a related concept, not the one already under discussion.