Jump to content

MDR bam files - how to add dragon animation sequences


Acifer

Recommended Posts

MDR1 - BAM sequences

I am trying to figure out how the dragon animation sequences work. I have read the explanations in the Infinity Animations readme but I do not understand what is exactly going on and how to create the split bam files. I usually just keep trying, but this is too nasty. I do not want to create 405 separate bam files just to realize it is not working how it's supposed to be.

What I figured out so far:

As a baseline, we have 9 sequences for each of the 9 "west" directions (S, SSW, SW, WSW, W, WNW, NW, NNW, N). There are no "east" animations as they are generated (mirrored) by the engine.

Each dragon has 5 animation types that contain all animations: XDRX1xxx  - XDRX5xxx

Each animation block is divided into 9 files (e.g. XDRX11xx - XDRX19xx) which itself has 9 files (e.g. XDR11110-XDR11118). Each animation block therefore has 9x9 animation files = 81 files.

The animation blocks consist of:

MDR11xxx - 9 cycles: walk (9 cycles; 12 frames)

MDR12xx - 27 cycles: Sequence ready/combat (SC) / stand down(SD) (27 cycles)

                1-9:                   SC: 9 cycles (Seq ready)  (9 cycles; 8 frames)

                10- 18:              SD: 9 Cycles (Seq pause / idle)  (9 cycles; 14 frames)

                19-27:               SC(?) 9 Cycles (8 frames)

MDR13xx - 27 cycles: attack (27 cycles)

              A1: 9 cycles attack1 (13 frames)

              A2: 9 cycles attack2 / wing buffet? (13 frames)

              A3?: (same as A2?): 9 cycles attack2 / wing buffet? (13 frames)

MDR14xxx - 45 cycles: get hit, fall asleep (SL), sleep, dying / dead(tw)

              1-9: GH gethit (6 frames)

              10-18: SL (Seq fall asleep)(11 frames)

              19-27:  (Seq sleeping) (2 frames)

              28-36: DE (Seq dying)(11 frames)

              37-45: DE? (Seq dying)(11 frames)

MDR15xxx - breath fire (cast spell) (18 cycles)

              1-9: CA Cast Spell (13 frames)

              10-18: CA Cast Spell long / breath fire (21 frames)            

My questions so far:

-Is there no getup (GU) animation?

- Is there no Spell prepare (SP) animation?

- how does the MDRX4xxx Animation block work?

 

OK, now the hardest part:

Since the animation graphics are too large to handle for the engine as a whole, each frame is split into 9 separate frames.

An example of 3 of the MDR11xxx animation sequences (S, SSW, SW):

1585304220_1x00-MDR1Cycle0-WalkS.jpg.8bab0aab6533a65186b48f8e43294e6c.jpg 345236090_1x01-MDR1Cycle1-WalkSSE.jpg.bcddc7ab4d0cd223cda2fd6d469080f8.jpg 1292200355_1x02-MDR1Cycle2-WalkSE.jpg.f52f8a2400721a46d4c572cbc74bcb92.jpg

So the last number of each file is indicating which of the 9 directions we need.

0=S; 1=SSW; 2=SW, 3=WSW; 4=W; 5=WNW; 6=NW; 7=NNW; 8=N (creature orientation is similar as in script files)

This last number also indicates which one of the 9 cycles contains the graphics. The other 8 cycles only contain transparent (empty), 1x1px frames. So the SW animations can be found in the files #2 (MDR1xxx2) in the cycles #2 while the cycles #0,#1,#3,#4,#5,#6,#7 and #8 only contain empty frames.

The first number (MDR11100) is part of the 4-digit creature animation name (Red Dragon = MDR1 animation).

The second number (MDR11100) indicates the type (walk animation in this case)

The third number (MDR11100) indicates the number of the split frames. So all "S" walk animation files (100, 200, 300, 400, 500, 600, 700, 800, 900) merged together build one whole, large image of the red dragon walking south. The "SSW" walk animations (101, 201, 301, 401, 501, 601, 701, 801, 901) do the same etcpp.

 

So how should I prepare my animation for the MDR-file?

I created a large, 750x750 animation file. How should I name it? Next part will be to split each frame into 9 separate frames. Near Infinity has a cool feature of splitting the animations.

Should I create the bam files including the blank cycles and split it - or should I split only the cycle containing the animation and add the blank files afterwards?

If someone is still reading this I would appreciate any help on this subject as this animation is haunting me for years. 🙂

 

Edited by Acifer
Link to comment

It looks like you have everything figured out. 🤔 I don't understand why naming is an issue — any prefix should do, as for the numbers, just follow the patterns.

As for the process, I'd keep comparing the files to the existing ones on each step, to lower the chance of early mistakes.

Link to comment

Some general comments:

  1. @Gwendolyne had done this several times before.  He'll be a good person to talk to.
  2. If you're adding this animation to the EE games, they can handle BAM frames of any size.  Just make it a normal (unsplit) animation instead of splitting it into the 4-part or 9-part split types.  In fact, Beamdog is looking into re-combining all split spell and creature animations to eliminate the dark lines between sections caused by zooming.
  3. Have you seen this topic:  http://www.shsforums.net/topic/57025-dragons-problems-to-create-an-animation-using-the-dragon-format-xdr/ ?
  4. There is also this old topic:  https://www.gibberlings3.net/forums/topic/24006-how-to-export-dragon/.  I have better tools now.
  5. If you get to the point where you have all of your frames done and are ready to convert them into BAMs, I can batch process them for you, or you can do it yourself with PS BAM.

 

Link to comment
On 2/4/2021 at 9:55 PM, lynx said:

It looks like you have everything figured out.

Thank you! I wasn't sure I got things right, but I'm glad I can move forward from this point. As for the naming, I didn't know how to name the master file so after splitting them all the different files share their corresponding names, but I hope I've figured it out now.

On 2/5/2021 at 12:22 AM, Sam. said:

In fact, Beamdog is looking into re-combining all split spell and creature animations to eliminate the dark lines between sections caused by zooming.

This is good to hear. I didn‘t know that. So, with no size limits in the Enhanced Editions, there could be real huge dragons? Cool.

On 2/5/2021 at 12:22 AM, Sam. said:

If you get to the point where you have all of your frames done and are ready to convert them into BAMs, I can batch process them for you

This is a very generous offer - thank you very much!
And I wasn‘t aware of how powerful and versatile PSBam really is. An impressive tool! 

If only I were a better command-line user.😉

18 hours ago, temnix said:

Is there going to be a real new dragon animation?

In some way, yes. The rendered frames are all there, they just need to be assembled. This might take some time, though.

Edited by Acifer
Link to comment

I meant that if you are not adding an actual new dragon, with new horns or without horns, or with a triceratops tail, or with four wings, or whatever, NEW, then there is no reason to care about these animations and their facing. If you only need to recolor one, it doesn't matter how they work.

Link to comment

I have recently digged into the various creature animation formats for NI. Maybe these notes about splitted bams can help:

Animation type "multi_new" 9-part variant: slot range (1200..12ff)
- naming scheme: [resref][sequence].BAM
- resref:
  - a four-letter prefix (e.g. MDR1, MDR2, ...)
- sequence: (Note: numbers behind WK/SC/SD/... indicate cycle numbers)
  - 1[segment]0[dir]: WK=[dir]
  - 2[segment]0[dir]: SC=[dir], SD=9+[dir], SC=18+[dir]
  - 3[segment]0[dir]: A1=[dir], A2=9+[dir], A3=18+[dir]
  - 4[segment]0[dir]: GH=[dir], DE/SL=9+[dir], TW=18+[dir], DE/SL=27+[dir], DE/SL=36+[dir]
  - 4[segment]1[dir]: GH=[dir], DE/SL=9+[dir], TW=18+[dir], SL=27+[dir], SL/DE=36+[dir]
  - 4[segment]2[dir]: GH=[dir], DE/SL=9+[dir], TW=18+[dir], SL=27+[dir], SL/DE=36+[dir]
  - 5[segment]1[dir]: SP=[dir], CA=9+[dir]
- segment:
  - index in range [1..9]: single digit
  - ordered left->right, top->bottom
- dir:
  - a single-digit number indicating a direction (0=S, 1=SSW, 2=SW, 3=WSW, 4=W, 5=WNW, 6=NW, 7=NNW, 8=N)
  - eastern directions are calculated by the engine
- Attributes (INI files, EE 2.0+):
  - can_lie_down: (boolean) whether creature falls down when dead/unconscious (?, tbc)
  - detected_by_infravision: (boolean) whether a red tint is applied when detected by infravision
  - false_color: (boolean) whether color replacement is enabled
  - path_smooth: (boolean) 0: pathfinding uses only 45 degrees angles
                           1: pathfinding uses arbitrary angles (probably as many angles are directions available)
  - quadrants: (int) the number of segments the animation has been split into
  - split_bams: (boolean) 0: animations are packed in G1 and G2 files
                          1: animations are spread over various subfiles
    ^^ confirmed to be working with 4-part variant (see below), might also work for 9-part variant but I don't know the encoding scheme
  - translucent: (boolean) whether animation is semi-transparent


Animation type "multi_new" 4-part variant: slot range (1300..13ff)
- naming scheme: [resref][sequence].BAM
- resref:
  - a four-letter prefix (e.g. MDEM, ...)
- sequence: (Note: numbers behind WK/SC/SD/... indicate cycle numbers)
  - if split_bams=1:
    - G1[segment]:  SC=9-17
    - G1[segment]1: WK=0-8
    - G1[segment]2: SD=18-26
    - G1[segment]3: GH=27-35
    - G1[segment]4: GH=27-35, DE=36-44, TW=45-53
    - G1[segment]5: TW=45-53
    - G2[segment]:  A1=0-8
    - G2[segment]1: A2=9-17
    - G2[segment]2: A3=18-26
    - G2[segment]3: A4=27-35
    - G2[segment]4: A5=36-44
    - G2[segment]5: SP=45-53
    - G2[segment]6: CA=54-62
  - if split_bams=0:
    - G1[segment]: WK=0-8, SC=9-17, SD=18-26, GH=27-35, DE=36-44, TW=45-53, SL=54-62, GU=63-71
    - G2[segment]: A1=0-8, A2=9-17, A3=18-26, A4=27-35, A5=36-44, SP=45-53, CA=54-62
  - eastern directions are calculated by the engine
- segment:
  - index in range [1..4]: single digit
  - ordered left->right, top->bottom
- Attributes (INI files, EE 2.0+): same as for 9-part variant

 

Edited by argent77
typo
Link to comment
On 2/7/2021 at 10:49 PM, argent77 said:

Maybe these notes about splitted bams can help

That's very helpful! Thank you very much. 

On 2/7/2021 at 10:49 PM, argent77 said:

4[segment]0[dir]: GH=[dir], DE/SL=9+[dir], TW=18+[dir], DE/SL=27+[dir], DE/SL=36+[dir] -

4[segment]1[dir]: GH=[dir], DE/SL=9+[dir], TW=18+[dir], SL=27+[dir], SL/DE=36+[dir] -

4[segment]2[dir]: GH=[dir], DE/SL=9+[dir], TW=18+[dir], SL=27+[dir], SL/DE=36+[dir]

I wonder why there a so many doubled animation cycles. Maybe they were meant for some additional animations that had to be cut out?

On 2/5/2021 at 4:44 PM, temnix said:

Is there going to be a real new dragon animation? Why do you care how they work?

Yes, I am working on a new dragon animation, but don't expect too much as I am not a 3D modeling / animation expert at all. 😉

Edited by Acifer
Link to comment

There is no 3D modeling involved in the Infinity Engine. And animations are not very complicated, although dragons' are more so. Ask kjeron for advice on animations, I'm sure he'll want to help. What we need is someone who can DRAW. Make a dragon without wings, or a pig with them, or any new creature on the level with originals, and you'll be in the hall of fame faster than Kangaxx can blink.

Link to comment

@Acifer Thanks to Bubb's excellent reverse engineering skills I can provide a more accurate description of the dragon animation type:

Animation type "multi_new", 9-part BAM animations (slot ranges 1200..12ff):
- naming scheme: [prefix][sequence].BAM

- prefix: an arbitrary BAM file prefix (e.g. MDR1, MDR2, ...)

- sequence: (Numbers behind WK/SC/SD/... indicate cycle numbers)
  - if attribute split_bams=0:  <-- NOTE: This mode is currently ignored in EE games
    - G1[quadrant]: WK=0-8
    - G2[quadrant]: SD/SC/SP=0-8, SD(unused)=9-17, SC(unused)=18-26
    - G3[quadrant]: A1=0-8, A2(unused)=9-17, A3(unused)=18-26
    - G4[quadrant]: GH=0-8, DE/SL/GU*=9-17, TW=18-26, SL(unused)=27-35, DE(unused)=36-44
    - G5[quadrant]: SP(unused)=0-8, CA=9-17
    - *: GU (get up) sequence: frames are played back in reverse order by the engine

  - if attribute split_bams=1:
    - 1[quadrant]0[dir]: WK=[dir]
    - 2[quadrant]0[dir]: SD/SC/SP=[dir], SD(unused)=9+[dir], SC(unused)=18+[dir]
    - 3[quadrant]0[dir]: A1=[dir], A2(unused)=9+[dir], A3(unused)=18+[dir]
    - 4[quadrant]0[dir]: GH=[dir], DE(unused)=9+[dir], TW(unused)=18+[dir], SL(unused)=27+[dir], DE(unused)=36+[dir]
    - 4[quadrant]1[dir]: GH(unused)=[dir], DE/SL/GU*=9+[dir], TW(unused)=18+[dir], SL(unused)=27+[dir], DE(unused)=36+[dir]
    - 4[quadrant]2[dir]: GH(unused)=[dir], DE(unused)=9+[dir], TW=18+[dir], SL(unused)=27+[dir], DE(unused)=36+[dir]
    - 5[quadrant]1[dir]: SP(unused)=[dir], CA=9+[dir]
    - *: GU (get up) sequence: frames are played back in reverse order by the engine

Example BAM filename for prefix "MDR1", animation sequence CA (release spell), top-right quadrant, SW direction: MDR15312.BAM (active cycle=11)

- quadrant:
  - index in range [1..quadrants]; one digit (see quadrants attribute below)
  - ordered left->right, top->bottom

- dir:
  - a single-digit number indicating a direction (0=S, 1=SSW, 2=SW, 3=WSW, 4=W, 5=WNW, 6=NW, 7=NNW, 8=N)
  - eastern directions are calculated by the engine

- INI attributes (EE games 2.0+):  <-- NOTE: These attributes are currently overridden by harcoded values in EE games
  - double_blit: (boolean) apparently unused in EE games
  - quadrants: (int) the number of quadrants the animation has been split into
  - split_bams: (boolean) 1: animations are spread over various subfiles; 0: animations are packed in G1-G5 files (see above definitions)
  - palette1: (string) palette resref for sequences starting with "1" prefix
  - palette2: (string) palette resref for sequences starting with "2" prefix
  - palette3: (string) palette resref for sequences starting with "3" prefix
  - palette4: (string) palette resref for sequences starting with "4" prefix
  - palette5: (string) palette resref for sequences starting with "5" prefix

Many animation sequences are marked as "unused". They usually just contain duplicate cycle entries or placeholder data.

Unfortunately several features are currently hardcoded in the EE games and can't be changed. This includes the INI attributes as well as not being able to use the unsplit BAM format. I have mentioned them in case Beamdog or modders remove the hardcoded restrictions in future game patches.

Edited by argent77
improved description
Link to comment
7 hours ago, argent77 said:

Edit: I have previously mentioned that dragons use a different animation type. That type appears to be used only internally.

I don't follow these statements.  I could list all the ways I'm confused by them and the seeming inconsistencies, but maybe it would be easier if you could elaborate/explain?

Link to comment
7 hours ago, Sam. said:

I don't follow these statements.  I could list all the ways I'm confused by them and the seeming inconsistencies, but maybe it would be easier if you could elaborate/explain?

The structure information was based on reverse engineered data from the EE executable. However, after some more testing it looks like several key features I mentioned in my previous post can't be used because they are still hardcoded in the engine. I have updated the animation structure description in my previous post to make it more clear.

These features might become relevant again if Beamdog or modders can fix/patch the game executable to remove the hardcoded restrictions.

Link to comment

There's three major problems I can see with the MDR INI files:

1) They are using the wrong animation header, [multi_new], when it should be [monster_multi]. The engine ignores everything under an incorrect header, so nothing you input here will be considered without first correcting the section header.

2) split_bams is hooked up to false_color internally, most likely a copy+paste error in the source. Meaning that if you correct the section header, it is impossible to designate split_bams=1, (the engine will execute this as false_color=1), and thus dragon animations (as they stand) will be in the wrong animation format and won't render.

3) palette[1-5] requires an internal field, m_bNewPalette, to be flipped in order to function. It is impossible to set this field via the INI, and so palette[1-5] are effectively defunct.

Note that the engine hardcodes all of these fields correctly for the different dragon animations if [monster_multi] isn't defined, so that's why everything works if you don't mess with the INI files.

Link to comment
On 2/20/2021 at 12:47 AM, temnix said:

There is no 3D modeling involved in the Infinity Engine. And animations are not very complicated

Right, after all, there's only static images the game uses, so 2 dimentions, or 2D. Just Width and Height, no Time. But why is it then called animation(s) ? Yes, the 4th dimention, Depth is what you consider the 3rd in images, but in Animations, it's not. cubic-volume-height-width-depth.jpg

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...