Jump to content

Ship Scaler (rescale your ships and change armor material)


Mangomania

Recommended Posts

Hey guys,

I wrote myself a little script in JavaScript to rescale my Ships and decided to share it with you.

I'm pretty sure there is an easier way, but this is how I solved it for me.

 

You can find it here: www.seven-parsec.net/index.php?site=avorionscaler

 

It is completely on your end, no data is transmitted.

 

How to:

[*]Click on "choose file" and select the savefile of your ship.

Your ships savefiles are located at "%appdata%/Avorion/ships".

You can paste that address into the address bar of the explorer that opens up.

[*]Insert your desired scale.

[*]Click on "Scale".

[*]Click now on "Save File" and it should download a file.

[*]Paste the downloaded file into the savefile folder.

 

If your file selection doesn't work:

 

 

 

 

Important notes:

[*]Never override an old file. Scaling doesn't always work when below or above certain sizes.

[*]You may have to restart your Game to see the new ship in the "Saved ships".

[*]The code is written "quick and dirty". Take it as it is.

 

Greetz,

Mango

 

Edit:

Now also supports changing the material type of armored blocks!

[*]Go to the savefile folder at "%appdata%/Avorion/ships".

[*]Open the ships savefile with your favorite text editor.

[*]Select all the text and copy it to your clipboard.

[*]Paste the text in the "Input" text area.

[*]Insert your desired scale.

[*]Click on "Scale".

[*]Select all the text in the Output text area and copy it to your clipboard.

[*]Create a new file in your savefile folder, open it with your text editor and paste the text into it.

[*]Save the file. Give it a name you like. Important: Save it as "myfilename.xml"

 

Link to comment
Share on other sites

Nice one, Mango! It's looking good, even if I can't test it right now :)

 

On a technical note: I have skimmed your code and I saw that you do scale the durabilities. Have you investigated whether the durability falloff is just depending on the distance from the root block in the tree structure or if it is dependent on the actual distance to the root block? I would assume its the former, but in case it's the latter you should also have to account for that.

Link to comment
Share on other sites

Has anyone made, or can someone make, an app to let you build a ship outside of the game to import into the game? Or just to practice builds.  I ask because I get bored at work sometimes and it would be nice to try out build ideas.

Link to comment
Share on other sites

This! THIS!!! You, dear sir, deserve a full glass of cookies! Comes as if i had ordered it, right at hand... just thought "Oh, damn, i think i overdid it with the new ship...", and the ingame-scaling is... lets say i try to avoid it where i can, better build anew on a smaller/bigger scale...

But those times are over now!

 

A THOUSAND THANKS for sharing!!!

 

Worked like a charm! Look for yourself, the bigger one in the background is what i used for input, made on a basic block size of 2x2x2, while the output in the middle (scaled with 0.5) was as wished for all fine with all blocks rezized to a basic size of 1x1x1, just like the others - no strange odd numbers, no decimals where not needed, all blocktypes respected accordingly... just wow:

 

4BD3A709A5DA98AC657CFCF044D1A1799A3830F3

 

Has anyone made, or can someone make, an app to let you build a ship outside of the game to import into the game? Or just to practice builds.  I ask because I get bored at work sometimes and it would be nice to try out build ideas.

Have you taken a look at this? Click me hard!

Its koonschi's "Ship Building Contest Official Build Tool" from this thread! Its outdated, yes, and wont be updated soon as there are other things to come first, but its pretty much a standalone version of the games editor... played around with it, liked some points (safe sector to build in, exporting into maingame was np,...), disliked others (some functions missing, some QoL Stuff, ...), so i sticked to the game itself, but maybe its enought for your workplace?

Link to comment
Share on other sites

Has anyone made, or can someone make, an app to let you build a ship outside of the game to import into the game? Or just to practice builds.  I ask because I get bored at work sometimes and it would be nice to try out build ideas.

 

I am working on a 'thing', but I am not yet ready to release it. The first thing I am trying to do is converting ships from avorion to Wavefront OBJ. It's been a fun thing to do so far, but there is still some parts missing and some bugs I need to fix first. It's quite a learning experience.

 

I would look into the other direction after I finish the first one. My solution would most likely be a blender plugin/script, but it's going to take a while. Also, please do not get your hopes up. It would most likely be an adaption of the ingame build menu, because of the games limitations.

 

Anyways, this will be stuff for its own thread and that's it from me on my project for now. I don't want to derail this thread any more :)

Link to comment
Share on other sites

Nice one, Mango! It's looking good, even if I can't test it right now :)

 

On a technical note: I have skimmed your code and I saw that you do scale the durabilities. Have you investigated whether the durability falloff is just depending on the distance from the root block in the tree structure or if it is dependent on the actual distance to the root block? I would assume its the former, but in case it's the latter you should also have to account for that.

 

That's where the "Quick and Dirty" Programming kicks in :D

I have just multiplied the "currentDurability" and "maxDurability" with the cubic scale to address the relation between volume and durability. This works fine, as long as all blocks stay the same.

 

 

TLDR: Only volume affects scaling and falloff affects all blocks in different ways depending on distance to the root block of the tree.

 

 

To come back to your question, the durability falloff depends on the distance to the root block in the tree structure.

I need to take a few more looks, but it seems, that there is a limit at how many blocks receive the falloff. After I placed a few blocks of the same type, material and size in line, the falloff stopped. The lowest durability for an iron block with the size 2X2X2 was 32. This is also the amount of the falloff for each subsequent block. For a 4X4X4 Block, the min. durability was 256.

After this min. durability is reached, all blocks above this (in the tree) increase their durability by the min. durability.

 

Example 1:

I got 4 blocks of 4X4X4 in a row, the durability is as follows (nearest to farthest): 1024, 768. 512, 256.

 

Example 2:

I got 9 blocks of 4X4X4 in a row, the durability is as follows (nearest to farthest): 2304, 1792, 1536, 1280, 1024, 768, 512, 256.

 

Result: The durability has a min. amount. The falloff also affects already placed blocks but instead increases their durability. For the process of scaling only the volume is of interest. At some point, the blocks direct to the root block seem to get even more than the min. durability per block.

 

Greets,

Mango

Link to comment
Share on other sites

I just tried it and I forgot about cubed scale, so I ended up with 0.2bt mass. Oops. Anyways, it works fine, but replace armor hangs for me.

 

Scaling something to a desired size can be tricky, as the cubic expansion is bigger than often thought :D

 

To the armor problem: What material did you choose to be the new armor?

 

Mango

Link to comment
Share on other sites

I selected ogonite. I tried it again and it hung again, but I clicked "wait" on the firefox warning a few times and it finished. The output window was empty after that, but I was still able to copy the file. I didn't try that ship anyway because I wasn't sure it wasn't corrupted.

 

If I may suggest a methodology for your script/page. Instead of filling output window after scale pass immediately, do scale pass then replace pass (or replace pass then scale pass), then fill output window. You'd have to use click boxes for scale and replace instead of buttons, then add a proceed button. This way, we can select scale and replace individually or together.

 

On my current ship, I use framework as ablative armor in a layered/spaced template so it's cheap to replace and light so it barely affect maneuverability. Spaced/layered armor looks really cool. Anyways, I'd like to be able to replace the material for the framework.

Link to comment
Share on other sites

I selected ogonite. I tried it again and it hung again, but I clicked "wait" on the firefox warning a few times and it finished. The output window was empty after that, but I was still able to copy the file. I didn't try that ship anyway because I wasn't sure it wasn't corrupted.

 

If I may suggest a methodology for your script/page. Instead of filling output window after scale pass immediately, do scale pass then replace pass (or replace pass then scale pass), then fill output window. You'd have to use click boxes for scale and replace instead of buttons, then add a proceed button. This way, we can select scale and replace individually or together.

 

On my current ship, I use framework as ablative armor in a layered/spaced template so it's cheap to replace and light so it barely affect maneuverability. Spaced/layered armor looks really cool. Anyways, I'd like to be able to replace the material for the framework.

 

I have to tweak a lot. The reason that there was no armor replaces is simply, that I forgot there is actually ogonite armor. The script simply doesn't allow ogonite as armor which is an error on my side. Will fix that asap.

 

And thanks for the feedback!

 

Mango

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...