XML essentials

An XML is a file type which documents variable and arbitrary data that is readable by both humans and machines. XMLs can be easily edited in any notepad type program, although using **notepad+** is adviseable. In terms of Daggerfall Unity, XMLs are commonly encountered when editing the paperdoll, although you may need to edit XMLs for many other types of mods. This tutorial will walk you through common troubleshooting.

## Paperdoll XMLs

When it comes to editing sprites, perhaps the most common type of mod one may tackle is a simple face replacment mod. Every single image on a paperdoll has **two attributes**, its **size** and its **position** which confine each element into a specified box on the player menu. While you can simply replace the image of every element, the size and position that image takes up can only be changed with an XML.

### A simple replacement

If the dimensions of the images being replaced are left as is, there is no need to provide the image with an XML file. One may, however, find themselves adding or removing a pixel off an image. When put ingame you might not notice much, but the image will appear oh so slightly stretched or squished. This effect is most noticeable when the dimension changes are most noticeable, like when adding a ponytail or larger hair to a face which had neither.

### A common issue to fix

You can easily fix this by providing each image with it's own XML file. the XML file needs o have the same name as the image. So if the image is 'FACE07I0.CIF\_0-0.png' the XML will have to be 'FACE07I0.CIF\_0-0.xml'

```
<?xml version="1.0"?>
<info>
 <rect scale="8">
 <x>248</x>
 <y>0</y>
 <width>400</width>
 <height>344</height>
 </rect>
</info>

```
A typical Face XML. X coordinate denots horizontal positioning, Y coordinate denotes vertical positioning.

First you need to open up your image and grab its dimensions. The example image below is 29px tall and 25px wide. DFU's image dimensions are scaled up by 8 times, so in the xml the image will be 200px wide and 232px tall.

The paperdoll element's position is the distance between the end of the background frame and the image's top left corner. Our image is positioned 9 pixels from the top side and 42 pixels from the left side, multiplied by 8 that is 72 pixels from the top and 336 pixels from the side. The position can occasionally be hard to get right. You can usually get it by assembling your paperdoll in an mage editing program and counting the pixels there.

When replacing images via loose files, you can quickly test edits by simply refreshing the paperdoll, either by closing or opening the character screen or equipping and uneqipping clothing. This way you can fine tune the face position by adding or removing 8 pixels from either the X or Y axis.

## Billboard XMLs

Daggerfall's billboards come in different scales. So when compiling an asset pack you may notice that even though you are following the dimensions of certain sprites, they may not look the same size ingame.

Animal sprites and most items in the game are true to the game size, while environmental sprites like trees are scaled to look much bigger, you will notice this by how large the pixels are compared to everything else in the game. Modded folliage may thus appear rather small. Meanwhile NPC billboards come in either the small or bigger size, though even larger unused sprites exist. If you scale your NPCs to be the same resolution as those most commonly used ingame (ignoring the smaller NPC sprites like the general store owner) they will appear as giants ingame.

This can be easily amended by providing an XML with the same name that looks like the one provided below. You may need to change the numbers to get the right scale. If the sprite is animated, you only need to provide an XML for the first frame.

```
<?xml version="1.0"?>
<info>
 <scaleX>0.65</scaleX>
 <scaleY>0.65</scaleY>
</info>

```
A typical XML for rescaling a billboards. This one makes the image smaller.

## Notes

* A comprihensive XML explenaton in regards to DFU unity can be found on the Daggerfall Workshop.
* Example images provided through Nine's Tojay-raht and Daggerfall Expanded Textures.

 GENERAL

 GRAPHICS

 WORLD EDITING