# Preparing Spritesheets

To generate the format of assets used by this project, we will be using an external project, which can be obtained in this [repository](https://github.com/slavidodo/opentibiaunity-datspr-converter/tree/v1-pipeline).

{% hint style="info" %}
If you are using a typical tibia client, there are pre-built assets for different client versions, they can be found [here](https://drive.google.com/open?id=1ViBcijSJEFTSLdbQiJTP1rp4-cUVpi-z).
{% endhint %}

{% hint style="danger" %}
The pre-built assets are built using a specified version. In order to use them, you should use the same version.
{% endhint %}

## Compiling the Project

To compile the **opentibiaunity-datspr-converter**, the only supported way is using window. If you don't use windows, you should use the pre-built assets aforementioned.

Start the solution(**.sln**) using Visual Studio (2017+). It should manage installing the required packages automatically, however if for some reason this didn't happen. Start **Nuget Package Manager Console**,

![Nuget - Package Manager Console](https://1692658658-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ln51w-ZUaSWAGQxO54_%2F-Lnm6466WDW29URZwGnl%2F-Lnm86M5veZV0n2vAoHw%2Fnuget-package-manager-console.png?alt=media\&token=faf2c545-cf4e-47c9-a2b2-0b9dbe3eec1d)

then execute the following commands

```
Install-Package Google.Protobuf -Version 3.8.0
Install-Package LZMA-SDK -Version 18.1.0
Install-Package Newtonsoft.Json -Version 12.0.2
```

finally, compile the project and open the folder where the project is built.

## Processing Sprites

Within **opentibiaunity\_datspr\_converter.exe**, create a new folder and name it to the client version you are trying to build (e.g 860 or 1200).

{% tabs %}
{% tab title="Tibia 7, 8, 9 and 10" %}
Simply put **Tibia.dat** and **Tibia.spr** inside the created folder.

![](https://1692658658-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ln51w-ZUaSWAGQxO54_%2F-Lnm6466WDW29URZwGnl%2F-LnmC_hrg7NAYQsSSnGe%2Fdatspr-conveter-860.png?alt=media\&token=842c6ee8-380b-4268-9d1d-f4fd57b58cf0)
{% endtab %}

{% tab title="Tibia 11, 12, ...etc" %}
Create an additional folder in the folder you just created and name it after the specified build version. Then put your assets folder inside that folder. You can obtain these assets from Tibia's directory (**packages/Tibia/assets**)

![](https://1692658658-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ln51w-ZUaSWAGQxO54_%2F-Lnm6466WDW29URZwGnl%2F-LnmHPaKslz_CCJbx3he%2Fdatspr-conveter-1200.7695.png?alt=media\&token=431dbbee-73a4-48e1-8382-9d70118b2456)
{% endtab %}
{% endtabs %}

in the folder that contains the **.exe**, shift+right click and choose **Open Powershell window here** or **Open command prompt here** depending on your windows version and your preferences, then execute the following command

{% tabs %}
{% tab title="Tibia 7, 8, 9 and 10" %}

```
./opentibiaunity_datspr_converter --version=860
```

{% endtab %}

{% tab title="Tibia 11, 12, ...etc" %}

```
./opentibiaunity_datspr_converter --version=1200 --build-version=7695
```

{% endtab %}
{% endtabs %}

The parameter **--version** indicates the client version you want to process. These are all the available parameters to use as of writing this tutorial.

| Parameter       | Help                                                                                                                                         |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| --version       | specify the client version                                                                                                                   |
| --build-version | specify the build version for tibia 11 sprites. defaults to 0                                                                                |
| --alpha         | specify if the sprite loader should use alpha channel or not. defaults to false                                                              |
| --convert-to    | <p>conversion between two client versions.</p><p>this option is not explained here as it has nothing to do with processing spritesheets.</p> |

{% hint style="warning" %}
If you are processing sprites for Tibia 11 or later, you should specify the build version.
{% endhint %}

Once done, the result should look like that in either cases

<div align="left"><img src="https://1692658658-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ln51w-ZUaSWAGQxO54_%2F-Lnm6466WDW29URZwGnl%2F-LnmIT1MzvpKzEL4wkO7%2Fdatspr-conveter-860-result.png?alt=media&#x26;token=017c3a05-be6a-4219-9b39-34d4d1487f41" alt=""></div>

## Processing Sprites AssetBundle

Open the **SpritesConverter** Unity project and add the **sprites** folder to the **Assets** folder.

![](https://1692658658-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ln51w-ZUaSWAGQxO54_%2F-LnmKsalQPU4h6Ry8bWT%2F-LnmMcMHmdwfLoY6xQPK%2Funity-editor-sprites-folder.png?alt=media\&token=5ee493b5-4d6b-4ef4-92d1-1ba03a136770)

inside that folder, select all textures and modify their settings as the following and hit **Apply**

![](https://1692658658-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ln51w-ZUaSWAGQxO54_%2F-LnmKsalQPU4h6Ry8bWT%2F-LnmMvWadEjIqvfnYy13%2Funity-editor-sprites-textures.png?alt=media\&token=bb88bef6-67a2-413a-b88d-8fadab08cbd5)

![](https://1692658658-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ln51w-ZUaSWAGQxO54_%2F-LnmKsalQPU4h6Ry8bWT%2F-LnmMvWbNBmYzBePm7Uz%2Funity-editor-sprites-texture-settings.png?alt=media\&token=14702eda-a6f4-477e-a7c8-55439b07407e)

then, change the asset bundle of these textures

![](https://1692658658-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ln51w-ZUaSWAGQxO54_%2F-LnmKsalQPU4h6Ry8bWT%2F-LnmMvWgItfxhbD1hHq8%2Funity-editor-sprites-assetbundles.png?alt=media\&token=a158ddac-fc1d-4e72-b12c-fa6ebd828fd8)

finally, build these asset bundles, from **Assets** menu, select **Build AssetBundles**!

![](https://1692658658-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ln51w-ZUaSWAGQxO54_%2F-LnmKsalQPU4h6Ry8bWT%2F-LnmMvWhTsehyXzBZ56u%2Funity-editor-sprites-build-assetbundles.png?alt=media\&token=8b58dd3d-8700-4ce1-8a54-339a9f2a903c)

After this is done, you will find a new folder called **AssetBundles**, in that folder there are several files, the ones of our interest is:

* sprites
* sprites.manifest

Pick these files and store them alongside with **appearances.dat** and **catalog-content.jso**n that were generated earlier.
