Diablo II Animation Conversion Extended Tutorial

by Joel Falcou, Alkalund and Nefarius
for The Phrozen Keep

Chapter Four : Animation Conversion - Part One :

Now that we have extracted and converted our beloved goblin animations, we are going to start the trickiest part
of the process : Offset adjustment. First, we'll see what are exactly the offsets system and how to easily
find them. Then we'll see how to use CV5 to save our gif into DCC with correct offsets, framecount etc ...

4.1 Discussion about DCC offsets :

This part is a bit technical and is extracted from the Billian Belchev comprehensive DCC Format documentation.
If you don't feel confident with such tricks, you can skip this part. However, a bit of knowledge on the subject helps
a bit for the next section.

When Diablo II loads a DCC file and decompresses it, it uses some lossy compression algorithm.
It reads a stream of data called bitstreams that are stored by directions and frames.

Since there is no dependence between the direction data bitstreams of different directions in one and the same Dcc file,
those bitstreams can be processed independently. In fact that is actually the case. The game decompresses the data for a
particular direction from a particular Dcc file only if it needs the frames that direction contains. For example if the player
enters the game, shoots only once in a particular direction and exits the game probably the game will decompress the frames
for the arrow only for that direction. So below except if otherwise noted, we will look at the frames for a particular direction only.

In general all the frames of one direction are of different sizes and have different offsets. The X offset (from the frame header
in the Dcc file) always specifies how many pixels right of the base point, the left edge of the frame is. If the frame is a
top-down frame the Y offset (the one from the frame header) specifies how many pixels down from the base point,
the bottom edge (or the bottom-left corner, if you prefer) of the frame is. Here is an example:


The red axes are the axes for rendering on the screen. The point that they intersect is the base point on the screen.
However these taken directly from the frame headers per frame offsets are not the ones used for rendering on the
screen. They must not be misidentified with the offsets for the different directions that have to be passed to the
cvdcc add-on for Cv5 when saving Dcc files. These offsets are used for frame alignment during the decompression
and also to calculate the offsets for rendering on the screen.

4.2 Conversion from GIF to DCC format :

Now we are more confident on the signification of the offsets, we'll start to look at how tp fix them to have an animation that is
properly aligned in game. So we take one of our freshly converted goblin GIF and open it with our beloved CV5. Then click on the
"Save" button which is the lower right corner of the dialog box :

There we arrive on the classic Windows "Save As ..." dialog box. Here type in the dcc filename and choose "Blizzard Compressed
Images/Animations (*.dcc)". This step is very important and can be the fatal error many newbies do and make them wonder
for a long time. If you don't specify this , CV5 will refuse to do anything.

So, now we have a screen that looks like that :


We have on the left a big chunk of edit boxes filled with zeroes and at the right a little preview of our animation.
As you may have seen (remember chapter 2), the CV5 DCC plug-in allows you to save a dcc with a given number of directions.
For classic monster animations, this value is 8, so we click on the radio button labelled "8 Directions x 32 Frames".
After doing that, 8 edit boxes are activated, one for each direction in fact. Quite easy isn't it ?

Now we have to find the offset for these eight directions. How ?
Easy ! Thanks to Billian Belchev we now have a preveiw of the offset in the shape of a cross-hair on the preview.
But if we want to save some time, here's some tricks.

We have to find the X and Y values of the offset to center the animation in a virtual 3D isometric space.
First, we'll try to find the X Offset. The X value is sometimes the easiest offset to find. We remember that the original gif was
65 x 65. As it seems that our little goblin is somewhat centered, we enter a value of 33 for the X offset.

We so have this preview now :

Quite good, now we have to find the Y offset. Here again we have to be smart. If you look closely at the animation, you'll see that it
could be cut into six slices :

The optimal position for the Y offset will be near the top of the last slice. So as the animation is 65 pixels height, we could guess that the
Y offset is near 50. Some trials will give an optimal position at around 53 :

Now, as an exercice, I'll let you find the offsets for the seven other directions. Keep in mind those little tricks. Don't be afraid to use papers and pencils, it
sometimes helps to find some symmetry or slicing tricks.

Now, before saving, just select the "Units" palettes in the Palettes combo box. This palette is well suited for animations as it's designed
to be the same whatever act you are in. That's avoid some pink or grey dotted animations problems. REMEMBER, use the Units palette !

Now, after finding the offsets for the other modes, our Goblin is finally ready, hop to the Chapter Five to perform the last tricks before
having our green friend rock'n'rolling in the Wilderness ...