[Fixed] Char Animation Layer Problem

This is the place to discuss all issues relating to the manipulation of graphics/animations, sounds, music and cinematics within Diablo 2.

Moderators: Necrolis, Nefarius

User avatar
jetaman
Hosted Forum Moderator
Champion of the Light
Posts: 318
Joined: Sat Jul 18, 2015 7:00 pm
Location: Ukraine
Ukraine

Hand-picked

[Fixed] Char Animation Layer Problem

Post by jetaman » Thu Aug 25, 2016 10:38 pm

While working with new characters I faced a problem which I can't solve. So, when the animation is played the layers overlap and as you can see in the gif below the right hand sometimes disappears behind the shield. The same happens in wallk and run animation. The "weirdness" of this problem is that it only happens in 2 or 3 directions.
This is what I tried:
In .cof file creation ini there are offsets. This parameters define a rectangular bounding box that allow selection of the sprites.
# xmin is the horizontal displacment from the sprite pivot for the left border
# xmax is the horizontal displacment from the sprite pivot for the right border
# ymin is the vertical displacment from the sprite pivot for the upper border
# ymax is the vertical displacment from the sprite pivot for the bottom border
xmin = -512
xmax = 512
ymin = -512
ymax = 512

In vanilla cof files these offsets are very different. For example in BATNHTH.cof the offsets are:
xmin = -34
xmax = 34
ymin = -90
ymax = 8

Maybe I'm wrong but after some testing it seems that they don't do anything. I've found a few similar topics in the forums where people had the same problem some time ago, but it was never fixed. I really need help in fixing this. There's something I'm missing. I'm ready to send my.dcc and .cof files for check. This will be very disappoiting if I don't finish this project.


EDIT (25.08.2016 ):
After a lot of thinking I realized that the only possible problem could be in chars_cof.d2. This file has something to do with characters' cof files and this is the only file that I didn't modify. But I don't know what is this file for and how can I modify it. Is there a tool like Animdata.d2 editor? Can someone forward me to some resources about chars_cof.d2? Thanks

EDIT (26.08.2016):
I think I found the big problem!!!! Like I thought it was in Chars_cof.d2. I found D2_cof tool by Paul Siramy and created a .txt file of Chars_cof.d2. In there I found "Layer Priority" and guess what - it's different for EVERY DIRECTION AND EVERY FRAME! That's why layers on my character overlap only in a few direction and a few frames. Now that I know the problem - how do I fix this? I think it's not possible to change the info in the .txt version of Chars_cof.d2 and repack it (or am I wrong?). So i guess the only way to modify Chars_cof.d2 is to hexedit it.Since I don't understand programming at all - can someone give me a hand in this? I would really appreciate this. Thanks.

Code: Select all

=============
chars_cof.d2
=============

record 0...
tag1 & tag2      = -1 0
record size - 24 = 1906
cof name         = soscbow
tag3             = -1
# layers         = 8
# frames / dir   = 14
# directions     = 16
unknown 2        =  20
unknown bytes    =   0 240 253 127
unknown dword    = -82  54 -92   6
unknown bytes    =   0   1   0   0
   layer   0 : LG 01 01 00 00 hth 00 
   layer   1 : LA 01 01 00 00 bow 00 
   layer   2 : RA 01 01 00 00 bow 00 
   layer   3 : TR 01 01 00 00 hth 00 
   layer   4 : HD 01 01 00 00 hth 00 
   layer   5 : S1 01 01 00 00 hth 00 
   layer   6 : S2 01 01 00 00 hth 00 
   layer   7 : LH 01 01 00 00 bow 00 

(frames / dir) unknown data : 00 00 00 00 00 00 00 01 00 00 00 00 00 00

layers priority :

direction 0
   frame   0 : LG TR RA HD S1 LH LA S2
   frame   1 : LG TR RA HD S1 LH LA S2
   frame   2 : LG TR RA HD S1 LA S2 LH
   frame   3 : RA LG TR LA HD S1 S2 LH
   frame   4 : RA LG TR LA HD S1 S2 LH
   frame   5 : RA LG TR LA HD S1 S2 LH
   frame   6 : RA LG TR LA HD S1 S2 LH
   frame   7 : RA LG TR LA HD S1 S2 LH
   frame   8 : LG TR HD S2 S1 RA LA LH
   frame   9 : LG TR HD S2 S1 RA LA LH
   frame  10 : LG TR HD RA LA S1 S2 LH
   frame  11 : LG TR HD RA LA S1 S2 LH
   frame  12 : LG TR HD RA LA S1 S2 LH
   frame  13 : LG TR HD RA LA S1 S2 LH

direction 1
   frame   0 : LG TR RA HD S1 LH LA S2
   frame   1 : LG TR RA HD S1 LH LA S2
   frame   2 : LG TR RA HD S1 LA S2 LH
   frame   3 : RA LG TR LA HD S1 S2 LH
   frame   4 : RA LG TR LA HD S1 S2 LH
   frame   5 : RA LG TR LA HD S1 S2 LH
   frame   6 : RA LG TR LA HD S1 S2 LH
   frame   7 : RA LG TR LA HD S1 S2 LH
   frame   8 : LG TR HD RA S1 LA S2 LH
   frame   9 : LG TR HD RA S1 LA S2 LH
   frame  10 : LG TR HD RA S1 LA S2 LH
   frame  11 : LG TR HD RA S1 LA S2 LH
   frame  12 : LG TR HD RA LA S1 S2 LH
   frame  13 : LG TR HD RA LA S1 S2 LH

direction 2
   frame   0 : LG TR RA S1 HD LH LA S2
   frame   1 : LG TR RA HD S1 LH LA S2
   frame   2 : LG TR RA HD S1 LA S2 LH
   frame   3 : RA LG TR LA HD S1 S2 LH
   frame   4 : RA LG TR LA HD S1 S2 LH
   frame   5 : RA LG TR LA HD S1 S2 LH
   frame   6 : RA LG TR LA HD S1 S2 LH
   frame   7 : RA LG TR LA S1 HD S2 LH
   frame   8 : LG TR RA S1 HD LA S2 LH
   frame   9 : LG TR RA S1 HD LA S2 LH
   frame  10 : LG TR RA S1 HD LA S2 LH
   frame  11 : LG TR RA S1 HD LA S2 LH
   frame  12 : LG TR RA LA S1 HD S2 LH
   frame  13 : LG TR RA LA S1 HD S2 LH

direction 3
   frame   0 : RA LG TR LH LA S1 HD S2
   frame   1 : RA LG TR LH LA S1 HD S2
   frame   2 : RA LG TR LH LA S1 HD S2
   frame   3 : RA LG TR LH LA S1 HD S2
   frame   4 : RA LG TR S1 HD LH LA S2
   frame   5 : RA LG TR LH LA S1 HD S2
   frame   6 : RA LG TR S1 HD LA S2 LH
   frame   7 : RA LG TR S1 HD S2 LA LH
   frame   8 : LG TR RA S1 HD LA LH S2
   frame   9 : LG TR RA S1 HD LH LA S2
   frame  10 : LG TR RA S1 HD LH LA S2
   frame  11 : LG TR RA S1 HD LH LA S2
   frame  12 : RA LH LG TR LA S1 HD S2
   frame  13 : RA LH LG TR LA S1 HD S2

direction 4
   frame   0 : RA LH LG TR LA S1 HD S2
   frame   1 : RA LH LG TR LA S1 HD S2
   frame   2 : RA LH LG TR LA S1 HD S2
   frame   3 : RA LH LG TR LA S1 HD S2
   frame   4 : RA LG TR S1 HD LH LA S2
   frame   5 : RA LG TR S1 HD LH LA S2
   frame   6 : RA LG TR S1 HD LH S2 LA
   frame   7 : LG TR RA S1 HD S2 LH LA
   frame   8 : LG TR RA S1 HD LA LH S2
   frame   9 : LG TR RA S1 HD LH LA S2
   frame  10 : LG TR RA S1 HD LH LA S2
   frame  11 : LG TR RA S1 HD LH LA S2
   frame  12 : RA LH LG TR LA S1 HD S2
   frame  13 : RA LH LG TR LA S1 HD S2

direction 5
   frame   0 : RA LH LG TR LA S1 HD S2
   frame   1 : RA LH LG TR LA S1 HD S2
   frame   2 : RA LH LG TR LA S1 HD S2
   frame   3 : RA LH LG TR LA S1 HD S2
   frame   4 : RA LG TR LH LA S1 HD S2
   frame   5 : RA LG TR LH LA S1 HD S2
   frame   6 : LG TR RA S1 HD S2 LH LA
   frame   7 : LG TR RA S1 HD S2 LH LA
   frame   8 : LG TR RA S1 HD LA LH S2
   frame   9 : LG TR RA S1 HD LH LA S2
   frame  10 : LG TR RA S1 HD LH LA S2
   frame  11 : LG TR RA S1 HD LH LA S2
   frame  12 : RA LH LG TR LA S1 HD S2
   frame  13 : RA LH LG TR LA S1 HD S2

direction 6
   frame   0 : RA LH LG TR LA S1 HD S2
   frame   1 : RA LH LG TR LA S1 HD S2
   frame   2 : RA LH LG TR LA S1 HD S2
   frame   3 : RA LH LG TR LA S1 HD S2
   frame   4 : RA LG TR LH LA S1 HD S2
   frame   5 : RA LG TR LH LA S1 HD S2
   frame   6 : LG TR RA S1 HD S2 LH LA
   frame   7 : LG TR RA S1 HD S2 LH LA
   frame   8 : LG TR RA S1 HD LA LH S2
   frame   9 : LG TR RA S1 HD LH LA S2
   frame  10 : LG TR RA S1 HD LH LA S2
   frame  11 : LG TR RA S1 HD LH LA S2
   frame  12 : RA LH LG TR LA S1 HD S2
   frame  13 : RA LH LG TR LA S1 HD S2

direction 7
   frame   0 : RA LH LG TR LA S1 HD S2
   frame   1 : RA LH LG TR LA S1 HD S2
   frame   2 : RA LH LG TR LA S1 HD S2
   frame   3 : RA LH LG TR LA S1 HD S2
   frame   4 : RA LG TR LH LA S1 HD S2
   frame   5 : RA LG TR LH LA S1 HD S2
   frame   6 : LG TR RA S1 HD S2 LH LA
   frame   7 : LG TR RA S1 HD S2 LH LA
   frame   8 : LG TR RA S1 HD LA LH S2
   frame   9 : LG TR RA S1 HD LH LA S2
   frame  10 : LG TR RA S1 HD LH LA S2
   frame  11 : LG TR RA S1 HD LH LA S2
   frame  12 : RA LH LG TR LA S1 HD S2
   frame  13 : RA LH LG TR LA S1 HD S2

direction 8
   frame   0 : LH LA LG S2 TR RA S1 HD
   frame   1 : LH LA LG S2 TR RA S1 HD
   frame   2 : LH LA LG S2 TR RA S1 HD
   frame   3 : LH LA LG S2 TR RA S1 HD
   frame   4 : LA LG TR LH RA S2 S1 HD
   frame   5 : LG TR LH LA S2 S1 RA HD
   frame   6 : LG TR LH LA S2 S1 RA HD
   frame   7 : LG TR LH LA S2 RA S1 HD
   frame   8 : LG LH LA S2 TR RA S1 HD
   frame   9 : LG LH LA S2 TR RA S1 HD
   frame  10 : LG LH LA S2 TR RA S1 HD
   frame  11 : LG LH LA S2 TR RA S1 HD
   frame  12 : LH LA LG S2 TR RA S1 HD
   frame  13 : LH LA LG S2 TR RA S1 HD

direction 9
   frame   0 : LA LH LG S2 TR RA S1 HD
   frame   1 : LA LH LG S2 TR RA S1 HD
   frame   2 : LA LH LG S2 TR RA S1 HD
   frame   3 : LA LH LG S2 TR RA S1 HD
   frame   4 : LA LG TR RA LH S2 S1 HD
   frame   5 : LG TR LA LH S2 S1 RA HD
   frame   6 : LG TR LA LH S2 S1 RA HD
   frame   7 : LG TR LA LH S2 RA S1 HD
   frame   8 : LG LA LH S2 TR RA S1 HD
   frame   9 : LG LA LH S2 TR RA S1 HD
   frame  10 : LG LA LH S2 TR RA S1 HD
   frame  11 : LG LA LH S2 TR RA S1 HD
   frame  12 : LA LH LG S2 TR RA S1 HD
   frame  13 : LA LH LG S2 TR RA S1 HD

direction 10
   frame   0 : LA LH LG S2 TR RA S1 HD
   frame   1 : LA LH LG S2 TR RA S1 HD
   frame   2 : LA LH LG S2 TR RA S1 HD
   frame   3 : LA LH LG S2 TR RA S1 HD
   frame   4 : LA LG TR RA LH S2 S1 HD
   frame   5 : LG TR LA LH S2 HD S1 RA
   frame   6 : LG TR LA LH S2 HD S1 RA
   frame   7 : LG TR LA LH S2 RA S1 HD
   frame   8 : LG LA LH S2 TR RA S1 HD
   frame   9 : LG LA LH S2 TR RA S1 HD
   frame  10 : LG LA LH S2 TR RA S1 HD
   frame  11 : LG LA LH S2 TR RA S1 HD
   frame  12 : LA LH LG S2 TR RA S1 HD
   frame  13 : LA LH LG S2 TR RA S1 HD

direction 11
   frame   0 : LA LH LG S2 TR HD RA S1
   frame   1 : LA LH LG S2 TR HD RA S1
   frame   2 : LA LH LG S2 TR HD RA S1
   frame   3 : LA LH LG S2 TR HD RA S1
   frame   4 : LA LG TR RA LH S2 HD S1
   frame   5 : LG TR LA LH S2 HD S1 RA
   frame   6 : LG TR LA LH S2 HD S1 RA
   frame   7 : LG TR LA LH S2 HD S1 RA
   frame   8 : LG LA LH S2 TR HD S1 RA
   frame   9 : LG LA LH S2 TR HD RA S1
   frame  10 : LG LA LH S2 TR HD RA S1
   frame  11 : LG LA LH S2 TR HD RA S1
   frame  12 : LA LH LG S2 TR HD RA S1
   frame  13 : LA LH LG S2 TR HD RA S1

direction 12
   frame   0 : LG LA LH S2 TR HD RA S1
   frame   1 : LG LA LH S2 TR HD RA S1
   frame   2 : LG LA LH S2 TR HD RA S1
   frame   3 : LG LA LH S2 TR HD RA S1
   frame   4 : LA LG TR RA LH S2 HD S1
   frame   5 : LG TR LA LH S2 HD S1 RA
   frame   6 : LG TR LA LH S2 HD S1 RA
   frame   7 : LG TR LA LH S2 HD S1 RA
   frame   8 : LG LA LH S2 TR HD S1 RA
   frame   9 : LG LA LH S2 TR HD RA S1
   frame  10 : LG LA LH S2 TR HD RA S1
   frame  11 : LG LA LH S2 TR HD RA S1
   frame  12 : LG LA LH S2 TR HD RA S1
   frame  13 : LG LA LH S2 TR HD RA S1

direction 13
   frame   0 : LG TR RA HD S1 LA S2 LH
   frame   1 : LG TR RA HD S1 LA S2 LH
   frame   2 : LG TR RA HD S1 LA S2 LH
   frame   3 : LG TR RA LA HD S1 S2 LH
   frame   4 : LG TR LA HD S1 RA S2 LH
   frame   5 : LG TR LA HD S1 RA S2 LH
   frame   6 : LG TR LA HD S1 RA S2 LH
   frame   7 : LG TR LA HD RA S1 S2 LH
   frame   8 : LG TR LA S2 HD S1 RA LH
   frame   9 : LG TR LA S2 HD RA S1 LH
   frame  10 : LG TR LA S2 HD RA S1 LH
   frame  11 : LG TR LA S2 HD RA S1 LH
   frame  12 : LG TR HD RA LA S1 S2 LH
   frame  13 : LG TR HD RA LA S1 S2 LH

direction 14
   frame   0 : LG TR RA HD S1 LA S2 LH
   frame   1 : LG TR RA HD S1 LA S2 LH
   frame   2 : LG TR RA HD S1 LA S2 LH
   frame   3 : LG TR RA LA HD S1 S2 LH
   frame   4 : LG TR LA HD RA S1 S2 LH
   frame   5 : LG TR LA HD RA S1 S2 LH
   frame   6 : LG TR LA HD RA S1 S2 LH
   frame   7 : LG TR LA HD RA S1 S2 LH
   frame   8 : LG TR LA S2 HD S1 RA LH
   frame   9 : LG TR LA S2 HD RA S1 LH
   frame  10 : LG TR LA S2 HD RA S1 LH
   frame  11 : LG TR LA S2 HD RA S1 LH
   frame  12 : LG TR HD RA LA S1 S2 LH
   frame  13 : LG TR HD RA LA S1 S2 LH

direction 15
   frame   0 : LG TR RA HD S1 LH LA S2
   frame   1 : LG TR RA HD S1 LH LA S2
   frame   2 : LG TR RA HD S1 LA S2 LH
   frame   3 : RA LG TR LA HD S1 S2 LH
   frame   4 : LG TR LA HD RA S1 S2 LH
   frame   5 : LG TR LA HD RA S1 S2 LH
   frame   6 : LG TR LA HD RA S1 S2 LH
   frame   7 : LG TR LA HD RA S1 S2 LH
   frame   8 : LG TR LA S2 HD S1 RA LH
   frame   9 : LG TR LA S2 HD RA S1 LH
   frame  10 : LG TR LA S2 HD RA S1 LH
   frame  11 : LG TR LA S2 HD RA S1 LH
   frame  12 : LG TR HD RA LA S1 S2 LH
   frame  13 : LG TR HD RA LA S1 S2 LH
You do not have the required permissions to view the files attached to this post.
Last edited by jetaman on Sun Sep 04, 2016 9:09 pm, edited 1 time in total.

User avatar
Ogodei
Senior Moderator
Angel
Posts: 516
Joined: Thu Mar 10, 2016 8:31 am
Italy

Hand-picked

Re: Char Animation Layer Problem

Post by Ogodei » Thu Aug 25, 2016 11:48 pm

Hmm....

I have an idea about it, but it's only my guess. I could be wrong

Take a look at the GIF you posted there. The fact that the arm appears and then disappears might be related to the order in which body parts are written in Direction 6 (which is the one in ur gif)... now, what if the order in which they're written states the priority of in-game drawing? and what if, for example, the fix could be setting every direction and every frame to the same order? I tried to open the char's cof with an hex editor, and this is the result :

http://it.tinypic.com/view.php?pic=v7fj ... 791mSiLSM8


I highlighted the hex output part in red... there is no way to tell which frames is a body part or whatever it could be, due to the fact that the only displayed things are cofs (such as ama1hth) or modes (hth , etc.) . The only viable option is finding a tool which can modify and then recompile character COF's. I'm not an expert in fact of animations, but I can't see another way of solving it.

User avatar
jetaman
Hosted Forum Moderator
Champion of the Light
Posts: 318
Joined: Sat Jul 18, 2015 7:00 pm
Location: Ukraine
Ukraine

Hand-picked

Re: Char Animation Layer Problem

Post by jetaman » Sat Aug 27, 2016 8:48 pm

Going deeper in D2's character animation: What do we have? We have 3 files that control character animation. The .cofs, animdata.d2 and chars_cof.d2. What is the order of these files reading in game? I mean, what does the game read first?

User avatar
jetaman
Hosted Forum Moderator
Champion of the Light
Posts: 318
Joined: Sat Jul 18, 2015 7:00 pm
Location: Ukraine
Ukraine

Hand-picked

Re: Char Animation Layer Problem

Post by jetaman » Sun Sep 04, 2016 9:07 pm

Attention Please:
As it turns out - chars_cof.d2 is not read by the game :cry: . I don't know how it works, but it seems that this file is just for informational purposes. It tells you what is in each character cof file, but it doen't actually work in game. I hired a programmer to write a small program for editing chars_cof.d2, and after the editing process nothing happened. The layer priority is again wrong in my animation. I also know that the information about priorities are not in the character cof files. It's not in the animdata either. So where is it? So PLEASE if know or can help me find where can I edit the layer priorities - I would be very grateful.

EDIT:
I figured it out! The information about layer priorities was actually inside the cof file. It led to the creation of "Coffee", a tool for editing cof files. Check it out here!

Return to “Multimedia”