We are going to see how to change the texture of a building,
this with the intention of duplicating this object with SGBIN Unpak / Repak.
SGBIN Tutorial

For this tutorial, we will use GIMP to edit textures.

First stage : Download GIMP here, and the DDS plugin.
To install the DDS plugin, copy the content of the downloaded folder in : C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins

Second stage : use PakUnpak to uncompress whole game if it is not already done (see : Uncompress all Cities XL), then with the SGBIN Unpak function, uncompress the desired *.sgbin file you want to modify. You can also uncompress a SGBIN file from CXL Data Explorer with a right click / SGBIN UNPAK.

Source file > Choose the *.sgbin file > Open


Destination folder > Choose where the file will be uncompressed


Here is what you should get :

A folder named like the original SGBIN was created with all files inside.
The textures files are those who begin with (DXT1) or (DXT5), who represents their compression format.

Third stage : Load GIMP and open a *.dds file.

You can also go through your textures to have a preview with CXL Data Explorer, and open the one who interests you by a right click / Edition (external Editor).

A window opens, uncheck "Load mipmaps".



Fourth stage : modify, do what you have to do, but you need to know that you can't change textures positions, and pay attention to keep texture continuity in some textures.

Fifth stage : the recording, File > Save. By default Gimp will keep the same directory as the original file, you have to choose to "Save " at the bottom of the window.

Another window appears : this one is very important :

The compression format must be the same that the one pointed out in the texture name you just modified, which is DXT1 or DXT5. Then check "Generate mipmaps" and at least save the file.

Notice that it is very important to not change the filename !


Sixth stage : do the same with the other textures if you whish it.


Seventh and last stage : re-compress the folder with the aid of SGBIN Repak. Choose the folders which contains the textures you have just changed, then the folder where will be create the new *.sgbin.

Enter the new name



NOTICE :

If you enter the same name as the original file, as you put this SGBIN in a file Patch (always by respecting the same tree-like aspect of folders) then as you put this Patch file in the Paks folder of the game, the original object will be replaced with your object.

 

 

If you enter a name different from the original...

Then you want to duplicate the object! But for it, it is not enough to change textures and to recreate the SGBIN file under another name! There are several files to modify and to add in the Patch file that you must create.

In our example, we used the following file :

  • data\gfx\buildings\b_park01_t3.sgbin

We need 3 other files :

  • data\design\buildings\civicservice\park\b_park01_t3.class
  • data\design\layout\b_service\b_park01_t3.layout
  • data\interface\ddstexture\buildings\b_park01_t3.dds

If you have not already created a working folder, let's create it now, let us call him "PremierSGBIN".

In this folder, create a data folder and and reproduce the tree-like aspect of the 4 files above.
Here is what you must get :

Move then the new SGBIN that you have just created in the good folder, to know data\gfx\building.

Make a COPY (never modify the original files) of the 3 necessary files and place them in their respective folder, still with the intention of keeping the same hierarchy as the original "data" folder.

You must then rename the 3 other files with the same name as your SGBIN (well on, do not change extensions of files).

Until now, we have now a folder "PremierSGBIN" which contains a "data" folder, several sub-folders and 4 files which the names are similar.

We have not more than to adapt the contents of these files. In this tutorial, I will not speak about the .layout file. Leave it as it is for the moment. Know simply that this file defines decorations of the object (trees, benches, ...) and the way the object must be connected to roads, etc. This file does not refer to our SGBIN therefore it is not necessary to change it.

We are going to concentrate on the .class file and the .dds file.

The .dds file is the thumbnail picture which appears in game when the mouse roll over the icon of the object..
You can change this picture completely. Attention : when you finished and that you record him, choose "None" as Compression and uncheck "Generate mipmaps".

The .class file is the most importantst le plus important, without this file, no object, no thumbnails nor layout file because it is this file which makes link between all, and it is it which is read in first by game.

  • Open the .class file with a text editor and search for the following tag :

<Model>

You will see that in this tag there is the name of the SGBIN file. Change the name of the file SGBIN so that it corresponds to the name which you gave him.

  • Search then this tag :

<Thumb>

You will see the name of the thumbnail .dds file. Modify it.

  • Finally, search this tag :

<LayoutFile1>

Modify it too.

  • Save and close the file.

There are lots of possible modifications in a .class file, but it is not the goal of this tutorial.

 

We have not more than to create a Mod with all this (Patch file) :

On the main interface / Compress a folder, choose the "data" folder which is in your "PremierSGBIN " folder, enter a name in "Output file", for example MOD_PREMIERSGBIN.PATCH then click on Compress.

You have just created your first duplicated object! Copy the Patch file which you have just created in the Paks folder of the game. You have not more than to go the to test him in the game.

Notice :

If game crash when loading, it is because you made an error in your files, you must double-check!


Do not hesitate to share your creations on the forum, and if you discover functions (whether it is tags inside files, or the function of a file especially), either do not hesitate to share your knowledge, it is the way you will make the community of Cities XL growing.


Thank you for having followed this tutorial.

Youcef and Arcadoli.