Jump to content
Miloch

Animation 2da files

Recommended Posts

This is something DLTCEP does with anim.2da files that NI doesn't, so I'm guessing it's intentional but it could be a bug. I'm wondering why it does it though.

 

If you load a BG2 anim.2da file in DLTCEP, you get the message "2da loaded with some errors (minor inconsistency)." It then loads the 2da with the ATTACK etc. labels in the first column and SOUND references in the second. But (and this is the difference between DLTCEP and NI) DLTCEP loads only the first such reference in the second column.

 

So for example, NI loads rows from mmar.2da as:

ATTACK   maril01 nosound nosound
ATTACK   2 0 0
DAMAGE   maril07 maril08
DAMAGE   0 0

DLTCEP loads the same rows as:

ATTACK   maril01
ATTACK   2
DAMAGE   maril07
DAMAGE   0

Does the engine ignore values after the first? Also, what is the significance of the numbers in the row after the .wav references?

Edited by Miloch

Share this post


Link to post

No, DLTCEP is probably looking for it to be structured more like a 2DA file, but it really isn't much of a table.

 

For Sounds.ini, ResData.ini, and all these 2DAs, the sounds are set to play every time this sequence of the corresponding animation plays, and the numbers indicate at which frame of the sequence to initiate playback. "nosound" and "blank" and similar are simply nonexistent sound references (the engine will try to play it, but there is no such sound, so nothing happens). In BG2, the row labels are designer-only (which row corresponds to which sequence is hardcoded) and I think the header is similarly ignored.

 

The probability of any sound playing should be 100 / # "columns" (rather, # space-delimited entries in the list on line N, but whatever), but in BG2, the engine actually will only look at the first and last sound resource IIRC. So if you have 3 columns, you actually have a 33% chance the engine will play the first sound and a 67% chance that the engine will play the sound in the last column only. The engine will never play the sound in the middle column(s) even though this column still influences the probability. So unless you're using "nosound"s to keep the engine from playing a sound every single time the sequence runs, you need to limit yourself to two (you can place any number of "nosound"s in the middle to influence the probability for the first sound playing, however).

 

It's been a couple years, but I think that's everything worthwhile about these.

Edited by devSin

Share this post


Link to post
Also, what is the significance of the numbers in the row after the .wav references?

At which frame of the sequence the sound should play.

 

Depressing details on multiple sounds. But multiple columns should be supported.

 

Haha. I am slow.

Edited by Nythrun

Share this post


Link to post

You probably wasted that time looking for my old post. I was just like "Shoot, I can type it up again faster than trying to find it." ;-)

Share this post


Link to post

I guess this is a DLTCEP bug then.

 

Thanks for the info - it makes converting just about every entry in the IWD sounds.ini files to BG2 .2da format a fairly cut-and-dry task. Unfortunately, I think it all has to be done manually due to the fudge factors involved. (And don't get me started about NWN unless you want to hear a nasty rant, but luckily I only had to convert a few of those soundsets... so far.)

 

Just one other related thing: in the IWD sounds.ini there are usually noises set for "fidget" and "fall" sequences. PST also has "fidget" sounds in resdata.ini under Cf1Sound. They sound like what you'd expect. What, if anything, would these map to in the BG2 engine? The only things remotely similar I see are HEAD_TURN or TWITCH or perhaps WALK, which are never set to anything in BG2 .2da files, though the engine must hardcode at least walking sounds or something.

 

And now that I'm actually looking at mmar.2da, what the hell is it for? Just a junk file? There's no mmar*.bam files, nor are there maril*.wav files, and for that matter the marilith and balor share the mtan*.bam series (one in IWD format, the other in BG). Not sure how the engine works out one is supposed to be female and the other male, if it does. You'd think the mariliths would have sounds manually set on the CRE files or something, but they don't all (icmarili.cre and melsum05.cre have no sound clips - only demosum1.cre has something resembling a proper soundset).

Share this post


Link to post

MMAR is unused (she maps to MTAN); hey, at least they tried, right? :-) As you note, the ToB marilith has sounds (snakes and the cool Generic Super Evil Chick soundset "Now has come the time for you to pay.") in the CRE; this doesn't really work (I do the same things for like minotaurs and shambling mounds and others that share a tag, but you'll rarely get the CRE sounds per sequence). Also note that the ATTACK_* slots are inoperable (IIRC); the ATTACK entry is the only one that the engine will play (I believe it was the same with the CRE sounds, where only ATTACK1 would play, or maybe it was that they would all play simultaneously every attack sequence); SHOOT does work.

 

Also note that most the default derivative slots don't get custom tags (only MSLM, MSPI, and MWLF, and I think two of the wolves share one); these animations will all use the same tag (e.g., MDOG.2DA is always used whether it's the base _WILD or the external-palette _WAR or _MOON). To make it worse, the carrion crawler gets sent to MCWL for some inexplicable reason (you know, to show you that they CAN do it right but just chose not to).

 

There is no periodic fidget in BG2 (the closest you can get and what I personally use are the CRE existence sounds at 0x1b8, which is how they did it in BG/TotSC; the ExistanceDelayOverride effect allows you to influence how often these play, but you probably wouldn't care to bother); fidget very well could be HEAD_TURN, but I don't remember that ever fires in BG2 (TWITCH is the couple frames that play with a new corpse). Fall is probably sleep, but you don't want to set these (the engine has all these in hardcode, so it's already playing sounds, and IWD is just generic small/medium/large anyway). Walking is the same boat (most of the hardcode IWD slots are set to use that loud-ass stomp LAZY, but I guess the IAs slots let you pick your own?), although if you wanted to have a little remote-control car dealy, you could probably use the slot to great effect and have the little thing buzz around buzz buzz buzz (i.e., the walk frames are rarely one complete step only, so you're never going to get anything that actually sounds like footsteps).

 

Also note that sequence sounds get automatic random pitch adjustments; the variance is pretty small, and it also get done for the CRE soundset slots (not all, I don't think, but it does for the ATTACK slots). Additionally, I believe that the existence of certain weapons (by category or tag or whatever) wielded by the creature will completely override the ATTACK sequence sound (whether it changes the avatar or not), so you'll get an axe swoosh instead of your set sound (this is all done in hardcode).

 

Your biggest problem is the two-sound limitation. It leads to a lot of angsty moments where you have to pick the two best out of the four or five that are hooked up in Sounds.ini.

Edited by devSin

Share this post


Link to post

Those files are not .2da's. For example, there is no file header and no column header.

Their extension is 2da, but the content is better edited by a regular text editor.

Next time you pick the book "War and Peace" and want to edit it in an area editor?

Why torture yourself :)

Share this post


Link to post
depressing stuff
Maybe we are better off going the Tutu route with this, which was to blank all the anim.2da files (or not bother doing them for new slots) and assign the sound clips directly on the CREs. A fair amount of work, but probably not much more than typing up a bunch of custom 2da files, and we are already modding affected CREs. At least on the CREs we have more than 2 options (4 ATTACKs and 5 BATTLE_CRYs I think... edit: nevermind if they all fire at the same time though... guess I'll have to do some actual testing *gulp*). We'd have to do this anyway for clips that have text strings associated, since I don't think there's a way of setting that in the 2DAs.

 

I vaguely recall reading somewhere the CRE sound slots aren't equally weighted (like the first ATTACK tends to fire more than the others or something) but I suspect it's trivial, considering the alternatives with 2DAs.

As you note, the ToB marilith has sounds (snakes and the cool Generic Super Evil Chick soundset "Now has come the time for you to pay.") in the CRE; this doesn't really work (I do the same things for like minotaurs and shambling mounds and others that share a tag, but you'll rarely get the CRE sounds per sequence).
I thought CRE sounds would override those in a .2da? Wouldn't they at least if the 2da was blank?
There is no periodic fidget in BG2 (the closest you can get and what I personally use are the CRE existence sounds at 0x1b8, which is how they did it in BG/TotSC
This is also PICKED_POCKET isn't it? But I guess that's ok for non-joinables who won't be picking any pockets.
Those files are not .2da's. For example, there is no file header and no column header. Their extension is 2da, but the content is better edited by a regular text editor.
Well, obviously I'm using a text editor to edit them, but they're biffed by default on most of my games, so I need a game editor to view them (initially anyway). And using a Java-based editor (or several instances of it when I'm looking at BG2, IWD1, IWD2, PST etc.) is a bit overkill too, but that's what I'm using. Why not just fix the glitch in DLTCEP? :) Edited by Miloch

Share this post


Link to post

Because it is not a glitch? These files are a different format and i'm not going to take the efforts to create a new editor just for these, when they are better edited by a plain text editor.

Share this post


Link to post
Well, obviously I'm using a text editor to edit them, but they're biffed by default on most of my games, so I need a game editor to view them (initially anyway). And using a Java-based editor (or several instances of it when I'm looking at BG2, IWD1, IWD2, PST etc.) is a bit overkill too, but that's what I'm using.
Just extract all 2DAs?

Share this post


Link to post
Because it is not a glitch?
Sure it is. They have a .2da extension. They are, for all practical purposes, two-column 2da files. They are not really a "different format." The only real difference perhaps is the second column can contain whitespace, which should not be taken for a column delimiter, and certainly not one that strips out any data after it. Hell, I'm sure it'd still work if you did parse the second column into multiple columns, as long as you weren't stripping out the data.

 

Who said anything about a "new editor"? I'm talking about a viewer, as I said. I'm sure some kind of simple check can be put in the existing one. But whatever. Not wanting to bother with it is one thing. Not recognising it as a bug is another thing entirely.

Share this post


Link to post

There is no way to ignore whitespaces on the whim. And i couldn't think of a way to tell apart whitespaces that separate columns from whitespaces that are not separators. Even if there is such an algorithm, it is thousand times easier to just extract the file and edit it.

Share this post


Link to post
I vaguely recall reading somewhere the CRE sound slots aren't equally weighted (like the first ATTACK tends to fire more than the others or something) but I suspect it's trivial, considering the alternatives with 2DAs.
That sounds familiar.

 

I thought CRE sounds would override those in a .2da? Wouldn't they at least if the 2da was blank?
Unfortunately, they don't override. But if there is no 2DA, then they should play correctly.

 

This is also PICKED_POCKET isn't it? But I guess that's ok for non-joinables who won't be picking any pockets.
Yes, these behave differently for NPCs than party members (I don't remember if all five "EXISTANCE" slots work in BG2, or just the one; probably all five, which is probably the real reason clones are so chatty "The trap is set!").

 

And using a Java-based editor (or several instances of it when I'm looking at BG2, IWD1, IWD2, PST etc.) is a bit overkill too, but that's what I'm using.
Well, F U 2. What if it was written in C#. Or OCaml. Would you be snarky then, majesty? :p

Share this post


Link to post
There is no way to ignore whitespaces on the whim. And i couldn't think of a way to tell apart whitespaces that separate columns from whitespaces that are not separators.
Ok. Feel free to move this out of your forum then - I've changed the title to reflect the conversation better.

 

I did some testing that only seems to confuse things a bit more. The ATTACK sounds on CRE files seem to do nothing, whether a 2da exists or not. If the CREs have weapons equipped, you'll hear the weapon sounds, otherwise you'll hear bugger all. Maybe it does something for PCs but not other CREs? Then again, the NPCs I looked at do not have ATTACK sounds set on their CRE files either.

 

On the other hand, the ATTACK sounds in a 2da will fire, in addition to weapon sounds. This can work out, depending on what sounds you have (Something like "Die!" *swoosh* for a short ATTACK sound coupled with a sword swing, added by a *splat* if the swing actually hits :D). The other ATTACK_* 2da sounds don't seem to fire, as you suggested. Now I suppose it could get annoying if the CRE said "Die!" (or whatever) with every swing, so padding the 2da with nosounds does make sense.

 

Other CRE soundclips seem to work, and they do seem to override 2da sounds, at least SELECT and BATTLE_CRY. These don't fire all at once - if you have 5 BATTLE_CRYs they'll fire pseudo-randomly each time the CRE attacks a new CRE. It actually seems weighted toward the *last* soundclip but I couldn't tell conclusively whether it's weighted at all. It didn't sound like the 2da sounds were also firing at the same time (but some clips I tested were louder than others).

 

HEAD_TURN does seem to do something like PICKED_POCKET, which is fire a semi-random "fidget" type of sound every once in a while. It may have a marginal advantage over PICKED_POCKET in that it doesn't seem to fire during combat. Still not quite sure how WALK sounds are handled exactly, since a marilith seem to emit slithering sounds when it moves without any special handling (at least the default BG2 marilith).

 

So in summary, it makes sense to use 2DAs rather than CRE-assigned sounds unless at least of the following is true:

1) You have more than 2 BATTLE_CRYs or SELECT sounds

2) You have sound clips that are assignable on a CRE file but not a 2DA (MORALE failure or something I guess)

3) You have multiple CREs sharing the same BAM slot who wouldn't make sense to share 2DA sounds (such as the marilith and balor tanar'ri)

 

In the first 2 cases, you could conceivably combine both 2DA and CRE sounds if you did it sensibly. This is at least true if you want to hear ATTACK sounds at all (other than generic weapon swishes). In the third, you probably want to blank out the 2DA and assign proper sounds to the relevant CREs.

And using a Java-based editor (or several instances of it when I'm looking at BG2, IWD1, IWD2, PST etc.) is a bit overkill too, but that's what I'm using.
Well, F U 2. What if it was written in C#. Or OCaml. Would you be snarky then, majesty? :p
Who's getting snarky? :p I'm not trashing Java or NI, I'm just saying it is indeed overkill to fire up multiple applications just to look at text files, but so is extracting all the 2DAs from BIFFs just to consult them occasionally (and then I'd have to dig for wherever I put them later on). But whatever, NI works, and I'm using it anyway for WAVs, searching, etc. (something DLTCEP doesn't handle as well) but several instances tend to bog down my machine, which isn't exactly top-of-the-line (several instances of DLTCEP don't seem to cripple it as much, for what that's worth).

Share this post


Link to post
I did some testing that only seems to confuse things a bit more. The ATTACK sounds on CRE files seem to do nothing, whether a 2da exists or not. If the CREs have weapons equipped, you'll hear the weapon sounds, otherwise you'll hear bugger all.
They *should* work (at least ATTACK1) on NPCs. Jack the volume way up, and make sure you have voices and effects and ambients turned up (I can't recall if the CRE and 2DA assignments use the same setting).

 

Other CRE soundclips seem to work, and they do seem to override 2da sounds, at least SELECT and BATTLE_CRY.
Select and Battle Cry are state events. Try it with actual animation sequences. All the non-sequence entries in the soundset should work pretty much as you expect.

 

The hesitance I have about HEAD_TURN is that BG2 animations are much better, and their ready states are smooth (IWD has animations where the creature will animate for maybe 15-30 frames and then be completely still for ~100, which is why something like fidget makes sense--in BG2, they chopped out those 100 frames of stupid to have the monster continuously animate even while "at rest"). PST, as you noted, actually has special fidget sequences for its animations, so it doesn't matter there.

 

Still not quite sure how WALK sounds are handled exactly, since a marilith seem to emit slithering sounds when it moves without any special handling (at least the default BG2 marilith).
Walk sounds are hardcoded. The sound is hardcoded for each of the slots. You could simply be hearing imaginary sounds at this point (but it's been a long time since I've fired up BG2; I know the yuan-ti do stomp around).

 

Make sure you're trying audio-only (~~[sOUND]) strings when doing the CRE soundset (of course, WeiDU doesn't set the flags right, so the engine may not even be able to tell).

 

Otherwise, you're probably right about most of it; likely be another several months before I can look at BG2 again. :(

Edited by devSin

Share this post


Link to post
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...