Cloning/remapping with S3D

Goal

This document describes how to clone one or more files with S3D while keeping id references intact. This method is used by modders when they want to create a copy of an existing file. It allows modders to reuse the structure and objects in the file, and make them unique to the game by assigning new id's. Both the original as the clone can then coexist in the game as seperate objects.

↑ Top

What the hell is remapping...?

Well, I've decided to label the function in S3D 'Remap' instead of 'Clone' (as Pack3D does), because cloning (in my book) involves more than just reassigning all the id's in a file. For instance, to clone a ship, you not only have to reassign id's in the .dat-file, but you also have to do this in the other related files (like .sim, .zon, etc.). Also, you have to change all sorts of other attributes (rename labels in the files, change materials/textures), create new folder structure and file names, update config files etc. I like to see 'cloning' as the process and 'remapping' as part of the process. This document will only explain the exact workings of the 'Remap' function in S3D.

↑ Top

Remap in S3D

The Remap-function in S3D requires just one parameter: the base value. This value can be any value of type UInt64 except 0 (zero). The range is 1 to 2^64-1 (0xFFFFFFFFFFFFFFFF).

A 'Random' button is available for generating a random value in that range. You can choose any value, but you can use that value for one clone only. If you want to clone the same ship multiple times, you will have to use a new value for each clone.

Once chosen a value, click 'OK' and the entire file is 'remapped' as outlined by these rules:

  • If a chunk supports an id and the id is not 0 (zero), add the base value to the id.
  • If a chunk supports a parent id and the parent id is not 0 (zero), add the base value to the id.
  • If a chunk of type 4 (node) has a model id, and the model id is not 0 (zero), add the base value to the id.
  • If a chunk of type 4 (node) has a material id, and the material id is not 0 (zero), add the base value to the id. Repeat for additional material id's.
  • If a chunk of type 11 (placement) has a node id, and the node id is not 0 (zero), add the base value to the id.
Note: If you feel these rules can be improved please let me know.

↑ Top

Thinks to consider when remapping

  • You run the risk of ending up with id's that already exist in another file throughout the entire game structure. This can cause CTD's, and they may be hard to track. If you experience such problems, try remapping the file again with a new base value.
  • The remap rules may result in id's being changed that shouldn't be changed (id's that point to chunks in other files). Manual post-processing is required to correct this.
  • Id's in properties data (childs of controllers) are not considered by the remap function. This has to be done manually.

↑ Top

Example: remap a ship

Let's take the Yamato as an example.

  1. Navigate to \Data\Sea\NBB_Yamato and open the file NBB_Yamato.dat
  2. Go to menu Tools > Remap id's...
  3. The Remap dialog should appear (see figure 1)
  4. Click the 'Random' button to generate a new base value (or type in one yourself)
  5. As best practice, note down the base value or copy it to a notepad document and save it with your personal instructions (for future use).
  6. Click 'OK' to close the dialog and remap the file.
  7. Save the file in your personal modding location (don't overwrite the original!)
  8. Repeat the same steps for every other file (.dsd, .sim, .val, .zon), and use the same base value noted down earlier.

That's it. You've now remapped all files for the Yamato and can start modifying the files to make it a real clone.

↑ Top

Tips

  • To only clone a part of a file, copy the file to a new file, open the new file with S3D, remove any chunk that you don't want to clone and then run the remap function. If you want the cloned chunks back in the original file you can use the export and import functionality of S3D.

↑ Top