Jump to content


Photo

So the Infinity Animation update..


  • Please log in to reply
190 replies to this topic

#101 Insomniator

Insomniator
  • Modder
  • 358 posts

Posted 14 May 2022 - 12:14 AM

skellytz,

 

test version (not tested on all animtypes)

1) TobExCore.ini: Externalise Animation Config Override=1 (next TobEx will set it to 1)
2) RESREF overrides sound 2da filename, use ANISNDEX.2DA to override

3) RESREF overrides RESREF_PAPERDOLL, change RESREF_PAPERDOLL if separate prefix need
4) if game crash at 0x9ca8a8, it means it can not found animation BAM files

 

https://anonfiles.co...x_resref_v1_zip



#102 skellytz

skellytz
  • Staff
  • 550 posts

Posted 14 May 2022 - 08:30 AM

Thanks! I'll test everything and report back.



#103 Insomniator

Insomniator
  • Modder
  • 358 posts

Posted 14 May 2022 - 08:35 AM

Thanks! I'll test everything and report back.


OK, just to remember, RESREF= * and  RESREF_PAPERDOLL= * skip overriding



#104 skellytz

skellytz
  • Staff
  • 550 posts

Posted 14 May 2022 - 08:01 PM

I've tested all available vanilla classic BG2 and IA animation ranges.
 

RESREF_PAPERDOLL override final sPrefix for BODY paperdoll, ignores any calculation, filename = RESREF_PAPERDOLL + "INV", support any animid range (useless for Human Playable Chars with many *INV BAMs per one animid)

RESREF_PAPERDOLL seems to work as intended!
 

RESREF override sPrefix for animation BAMs [and soundset 2DA], keep original suffix calculation, injects to most animation type, except:
 
0xxx ignored, non-pc animation
4xxx ignored, non-pc animation
6xxx ignored, original BG2 and BG1 animation
Bxxx ignored, non-pc animation
Dxxx ignored, non-pc animation

RESREF seems to work nicely. You didn't mention it in the exceptions, but the 12xx (dragons) range apparently also doesn't support the resref override? As I said earlier, this range doesn't need resref override, because of buggy implementation, so that was expected. I'm just checking if you intended it to be supported anyways.

 

Some more suggestions:

Now that we can override the footcircle (personal space) size, we could also add FALL_SND to EXTANIM, because the fall sounds (called by GetSndDeath(), eg FAL_01B, FAL_02B, FAL_03B) are hardcoded to animation subranges.

 

These aren't very important, but would be useful (details on IESDP):

light_source = boolean
When this attribute is set (=1) then environmental lighting such as day/night, weather or shadows do not affect the creature animation. (bLightSource)

 

detected_by_infravision = boolean
This attribute indicates whether a red tint is applied to the creature when it is spotted by infravision. (bDetectedByInfravision)

 

brightest = boolean
This attribute defines a blending mode when the sprite is rendered onto the screen. If set without the "multiply_blend" attribute then GL_ONE_MINUS_DST_COLOR blending is performed. If both "brightest" and "multiply_blend" are set then GL_SRC_COLOR blending is performed. (bBrightest)

 

multiply_blend = boolean
This attribute defines a blending mode when the sprite is rendered onto the screen. If set without the "brightest" attribute then GL_DST_COLOR blending is performed. If both "brightest" and "multiply_blend" are set then GL_SRC_COLOR blending is performed. (I think this could be bBrightestDesired in the classic engine?)


Edited by skellytz, 15 May 2022 - 07:16 AM.


#105 Insomniator

Insomniator
  • Modder
  • 358 posts

Posted 15 May 2022 - 07:23 AM

skellytz,

RESREF override sPrefix for animation BAMs [and soundset 2DA], keep original suffix calculation, injects to most animation type, except:
 
0xxx ignored, non-pc animation
4xxx ignored, non-pc animation
6xxx ignored, original BG2 and BG1 animation
Bxxx ignored, non-pc animation
Dxxx ignored, non-pc animation

RESREF seems to work nicely. You didn't mention it in the exceptions, but the 12xx (dragons) range apparently also doesn't support the resref override? As I said earlier, this range doesn't need resref override, because of buggy implementation, so that was expected. I'm just checking if you intended it to be supported anyways.

12xx is supported but not tested, i dont see any special "care" in 12xx code
 

Some more suggestions:
Now that we can override the footcircle (personal space) size, we could also add FALL_SND to EXTANIM, because the fall sounds (called by GetSndDeath(), eg FAL_01B, FAL_02B, FAL_03B) are hardcoded to animation subranges.

it is possible, each animation has dedicated field for storing FallingSound filename
 

These two aren't very important, but would be useful (details on IESDP):
light_source = boolean
When this attribute is set (=1) then environmental lighting such as day/night, weather or shadows do not affect the creature animation. (bLightSource)

Used for few anims in 73xx(Monster) range
0x7F3B MSOL, use additional GLOW aimation
0x7F3C MASL, use additional GLOW aimation
0x7310 MFIE     ELEMENTAL_FIRE
0x7311 MFIS     ELEMENTAL_FIRE_SMALL
0x7312 MFIE
0x7313 MFIS
0x7314 MFIE

and many effects:
0x0Bxx
0x0C0xx
...
is light_source really usefull ?
 

 detected_by_infravision = boolean
This attribute indicates whether a red tint is applied to the creature when it is spotted by infravision. (bDetectedByInfravision)

OK, if animations supports it variability, many anim types force it to 1(4xxx) or 0(Dxxx)

 

brightest = boolean
This attribute defines a blending mode when the sprite is rendered onto the screen. If set without the "multiply_blend" attribute then GL_ONE_MINUS_DST_COLOR blending is performed. If both "brightest" and "multiply_blend" are set then GL_SRC_COLOR blending is performed. (bBrightest)
multiply_blend = boolean
This attribute defines a blending mode when the sprite is rendered onto the screen. If set without the "brightest" attribute then GL_DST_COLOR blending is performed. If both "brightest" and "multiply_blend" are set then GL_SRC_COLOR blending is performed. (I think this could be bBrightestDesired in the classic engine?)


bBrightest and bBrightestDesired are tricky, each animation has fields for both, but field configured after creating animation in some other place later, need more investigating


Edited by Insomniator, 15 May 2022 - 07:52 AM.


#106 skellytz

skellytz
  • Staff
  • 550 posts

Posted 15 May 2022 - 07:48 AM

is light_source really usefull ?

For animations like ghosts, elementals and other "glowing" magical creatures that shouldn't be affected by lighting conditions.

 

Left: light_source=0 | Right: light_source=1

Baldr000.png
 

 

Also these two:

brightest = boolean
This attribute defines a blending mode when the sprite is rendered onto the screen. If set without the "multiply_blend" attribute then GL_ONE_MINUS_DST_COLOR blending is performed. If both "brightest" and "multiply_blend" are set then GL_SRC_COLOR blending is performed. (bBrightest)

 

multiply_blend = boolean
This attribute defines a blending mode when the sprite is rendered onto the screen. If set without the "brightest" attribute then GL_DST_COLOR blending is performed. If both "brightest" and "multiply_blend" are set then GL_SRC_COLOR blending is performed. (I think this could be bBrightestDesired in the classic engine?)

 

If multiply_blend GL functions aren't supported by the classic engine, then brightest alone (GL_ONE_MINUS_DST_COLOR) will be enough.

 

From left to right: 1. no blending (black outlines) | 2. GL_ONE_MINUS_DST_COLOR (brightest) | 3. GL_SRC_COLOR (brightest+multiply_blend) | 4. GL_DST_COLOR (multiply_blend)

Baldr003.png

 



#107 Insomniator

Insomniator
  • Modder
  • 358 posts

Posted 15 May 2022 - 08:15 AM

skellytz,
 
Seems bBrightest and bBrightestDesired has limited usage in BG2 engine for usual animation, engine has two methods CAnimation::SetBrightestDesired() and CAnimation::SetBrightest() but they never called after loading game to area screen (i tried load BG1 city and BG2 dungeon)
 
bBrightest staticaly setted only for one animation 0x7F39 MMST
bBrightestDesired don't setted staticaly for any animation
 
This is not problem, we can override both fields,  i dont sure what is visual difference on classic engine (it has safe 2D mode based on DirectDraw)
 
You can temporarly hack engine to force bBrightest and bBrightestDesired for all animation (including statics and effects), patch bgmain.exe
0x3f92E6 C6 82 D4 03 00 00 00 -> C6 82 D4 03 00 00 01 bBrightest
0x3f92F0 C6 80 D5 03 00 00 00 -> C6 80 D5 03 00 00 01 bBrightestDesired
if game will crash, this hack is useless


Edited by Insomniator, 15 May 2022 - 08:26 AM.


#108 skellytz

skellytz
  • Staff
  • 550 posts

Posted 15 May 2022 - 10:04 AM

if game will crash, this hack is useless

The game doesn't crash. bBrightest seems to affect the animation similar to BGEE brightest; couldn't notice any difference with bBrightestDesired.

 

Left: brightest=1 (blends with the background slightly more) | Right: brightest=0 (uses general classic BG2 GL acceleration)
Baldr000.png



#109 Insomniator

Insomniator
  • Modder
  • 358 posts

Posted 15 May 2022 - 01:19 PM

skellytz,

if game will crash, this hack is useless

The game doesn't crash. bBrightest seems to affect the animation similar to BGEE brightest; couldn't notice any difference with bBrightestDesired.

bBrightest and bBrightestDesired used in rendering of 3 ranges

0xxx(AnimationTypeEffect)

13xx(AnimationTypeMonsterMultiNew)

73xx(AnimationTypeMonster - 73xx, 77xx, 7Fxx)

 

BG2:

bBrightest             add 0x8 to render flags

bBrightestDesired add 0x2000 to render flags

 

BG2EE:

bBrightest             add 0x8 to render flags

bBrightestDesired add 0x2200 to render flags

 

0x8 and 0x2000 are internal flags with unknow mapping, it will converted to final opengl flags in some other place

bBrightest can be fully disabled by Disable Brighten=1 in baldur.ini, disabling ignored in OpenGL



#110 Insomniator

Insomniator
  • Modder
  • 358 posts

Posted 15 May 2022 - 01:51 PM

Left to Right, elfir.cre, 0x7310, under debuger with hacking animation fields:

1) bBrightest=0 bBrightestDesired=0

2) bBrightest=1 bBrightestDesired=0

3) bBrightest=0 bBrightestDesired=1

4) bBrightest=1 bBrightestDesired=1

Baldr002.png

So default bBrightestDesired is useless in classic BG2 ?

 

When changed 0x2000 to 0x2200 BG2->BG2EE

1) bBrightest=1 bBrightestDesired=0

2) bBrightest=0 bBrightestDesired=1

3) bBrightest=1 bBrightestDesired=1

Baldr004.png


Edited by Insomniator, 15 May 2022 - 02:11 PM.


#111 skellytz

skellytz
  • Staff
  • 550 posts

Posted 15 May 2022 - 02:25 PM

So will it be possible to add BRIGHTEST override to EXTANIM? bBrightest is basically extra blending; by "brightening" some pixels it makes the animation slightly translucent. Again, useful for creatures like ghosts and elementals that should be a little see-through. I have no idea what bBrightestDesired does, so let's just skip it, because it doesn't seem to affect bBrightest effect.
 
Ascension64's notes on brightest:
with 3d acceleration on - glBlendFunc(dest: GL_ONE_MINUS_DST_COLOR, src: GL_ONE)
with 3d acceleration off - sets all palette colours less than [32.32.32] to transparent (12.5% blend), for each frame pixel chooses brightest colour from either FxSurface or BAM palette

 

So default bBrightestDesired is useless in classic BG2 ? When changed 0x2000 to 0x2200 BG2->BG2EE

Maybe it was bugged in the classic and pointing to wrong render offset. Anyways, BGEE mutliply_blend (or bBrightestDesired->0x2200) GL functions are rather ugly, they remove too much detail. Not a must-have feature.


Edited by skellytz, 15 May 2022 - 02:47 PM.


#112 Insomniator

Insomniator
  • Modder
  • 358 posts

Posted 15 May 2022 - 02:54 PM

So will it be possible to add BRIGHTEST override to EXTANIM? bBrightest is basically extra blending; by "brightening" some pixels it makes the animation slightly translucent. Again, useful for creatures like ghosts and elementals that should be a little see-through. I have no idea what bBrightestDesired does, so let's just skip it, because it doesn't seem to affect bBrightest effect.

Yes, new parameters easily to add
FALL_SND
LIGHT_SOURCE
INFRAVISION_DETECT (engine limited to 13xx, 7xxx(BG1 Monsters), 73xx, 77xx, 7Fxx, Exxx)
BRIGHTEST
 
i will upload test version after initial testing


Edited by Insomniator, 15 May 2022 - 03:03 PM.


#113 skellytz

skellytz
  • Staff
  • 550 posts

Posted 15 May 2022 - 05:38 PM

I'll test everything as soon as possible.

 

Sam, I'll then write up a summary of all the new features and expected steps to add animations using the new approach in the IA workroom thread for review, so that if the team accepts the changes, the exe patch, the slot list and the IARP can be updated.



#114 Insomniator

Insomniator
  • Modder
  • 358 posts

Posted 16 May 2022 - 03:54 AM

Hi skellytz
 
Check test version, engine limitations:
1)  bBrightest used:

0xxx(AnimationTypeEffect)
13xx(AnimationTypeMonsterMultiNew)
73xx(AnimationTypeMonster - 73xx, 77xx, 7Fxx)

 
2) bDetectedByInfravision used:

13xx
5xxx/6xxx (BG1/BG2 Playable Human)
7xxx (BG1 Monsters)
73xx(AnimationTypeMonster - 73xx, 77xx, 7Fxx)
Exxx

 
3) bLightSource used:

13xx

7F3B MSOL
7F3C MASL
7310 MFIE
7311 MFIS
7312 MFIE
7313 MFIS
7314 MFIE

many effects:
0Bxx
0C0xx
....

https://anonfiles.co...x_resref_v2_zip


Edited by Insomniator, 16 May 2022 - 04:13 AM.


#115 skellytz

skellytz
  • Staff
  • 550 posts

Posted 16 May 2022 - 04:21 PM

Check test version, engine limitations

Everything works as expected. Good job!

 

FALL_SND - supported by all animation types

 

LIGHT_SOURCE - engine support only for BG2 monster type animations (BG2 split, BG2 split 4 part, BG2 unsplit ext.)

 

BRIGHTEST - engine support only for BG2 monster type animations (BG2 split, BG2 split 4 part, BG2 unsplit ext.)

 

INFRAVISION_DETECT - engine supports on/off switch for: BG1 simple monster, IWD, BG2 split, BG2 split 4 part, BG2 unsplit ext. (other animation types forced on)

 

12xx (dragons) RESREF override still doesn't work. Did it work for you in your tests, Insomniator?



#116 skellytz

skellytz
  • Staff
  • 550 posts

Posted 17 May 2022 - 07:04 PM

I've tested the character animation ranges added by IA. Looks like the resref override could be possible for these ranges:
 

6600 - 6aff   CHARACTER BGII
6b00 - 6fff   CHARACTER BGI

 

The filename generation in the IA engine code takes the pre-set hardcoded animation prefix into account. I've changed some of the hardcoded prefixes added by IA for the character slots manually in the exe and everything still worked when I renamed all the BAM files according to the hardcoded IA engine code patterns.

 

IA engine code for WQ-supported (BG2) and WP-supported (BG1) animations, which simply use vanilla existing objects/equipment, is much simpler without complicated prefix alteration.

 

Example for BG2 WQ-supported character animation:

Override resref for 0x683d (BG2 WQL character paletted) with s@az

New anim avatar BAMs: s@az + armor level + sequence (eg s@az1g1.bam)

New anim avatar paperdoll: s@az + armor level + inv (eg s@az1inv.bam)

New anim object/equipment BAMs: uses vanilla existing WQL object BAMs (eg wqls1g1.bam)

New anim object/equipment paperdoll: uses vanilla existing object paperdoll BAMs (eg wpls1inv.bam)

 

IA engine code for non-WQ/WP character animations, which need new custom BAMs for objects/equipment, is more complicated:

 

Example for BG2 non-WQ character animation:

Override resref for 0x6600 (BG2 non-WQ character paletted) with s@az

New anim avatar BAMs: s@az + armor level + sequence (eg s@az1g1.bam)

New anim avatar paperdoll: s@az + armor level + inv (eg s@az1inv.bam)

New anim object/equipment BAMs: [IA engine code strips the 1st char] @az + object id + sequence (eg @azs1g1.bam)

New anim object/equipment paperdoll: [IA engine code strips the 1st char and then replaces the 2nd of remaining chars with p] @pz + object id + inv (eg @pzs1inv.bam)

 

So, all we need is the resref override for character animation ranges, so that IA engine code can use the new prefix in filename generation. Modders will then be instructed how to name their files properly. This will open up a lot of new animation slots.



#117 Graion Dilach

Graion Dilach
  • Modder
  • 103 posts

Posted 17 May 2022 - 08:39 PM

How does this open up new animation slots? If I read the IA docs right, it's not the filename but the hexa slot IDs which cause the bottleneck. I don't see how softcoding filenames - on which don't get me right, is always cool - helps on hexa ID allocation. I can imagine this is because I don't see what is your new proposal with the restored BG1 paletted monster variants (I've diffed the list you proposed where you moved them from unpaletted slots to paletted, so I seen those changes).



#118 Insomniator

Insomniator
  • Modder
  • 358 posts

Posted 18 May 2022 - 05:12 AM

Hi skellytz

12xx (dragons) RESREF override still doesn't work. Did it work for you in your tests, Insomniator?

12xx(MonsterMulti) animation code forget to save AnimID to proper field, e.g. animid for dragons was random, i fixed it.

Some of 12xx functions may change behaviour because now they get proper animid:
GetCastHeight()     return 144 for 12xx, return 35 for else
GetCastingOffset()  fill offsets for 12xx, skip for else
GetSndReady()       additional check for 0x10xx/0x11xx/0x13xx animid , return "WAL_77" for 0x10xx, return EMPTY for else
GetWalkingSound()   return WAL_* depending on animid

may be more 12xx functs affected...
 
https://anonfiles.co...x_resref_v3_zip


Edited by Insomniator, 18 May 2022 - 05:13 AM.


#119 Insomniator

Insomniator
  • Modder
  • 358 posts

Posted 18 May 2022 - 05:25 AM

IA engine code for non-WQ/WP character animations, which need new custom BAMs for objects/equipment, is more complicated:

 

Example for BG2 non-WQ character animation:

Override resref for 0x6600 (BG2 non-WQ character paletted) with s@az

New anim avatar BAMs: s@az + armor level + sequence (eg s@az1g1.bam)

New anim avatar paperdoll: s@az + armor level + inv (eg s@az1inv.bam)

New anim object/equipment BAMs: [IA engine code strips the 1st char] @az + object id + sequence (eg @azs1g1.bam)

New anim object/equipment paperdoll: [IA engine code strips the 1st char and then replaces the 2nd of remaining chars with p] @pz + object id + inv (eg @pzs1inv.bam)

 

So, all we need is the resref override for character animation ranges, so that IA engine code can use the new prefix in filename generation. Modders will then be instructed how to name their files properly. This will open up a lot of new animation slots.


We can come up with new scheme without shifting/swapping/patching modder's reserved name, e.g. all non-WQ anims always will start with s@az. Problem is @pzs1inv.bam, it already has 8 chars, but we can reduce suffix inv to in :)

 

Of couse this willl happy only for aniimation with custom resref in extanim.2da

Existing/Unlisted animations keep orig+IA filenaming logic



#120 Insomniator

Insomniator
  • Modder
  • 358 posts

Posted 18 May 2022 - 05:57 AM

Hi Graion Dilach

How does this open up new animation slots? If I read the IA docs right, it's not the filename but the hexa slot IDs which cause the bottleneck. I don't see how softcoding filenames - on which don't get me right, is always cool - helps on hexa ID allocation.

Currently no easy way to insert custom animation to dynamic slot id, but it is possible in weidu code
1) Parse Animate.ids/Aniwksnd.2da to look what last slot (ABCD) was assigned to target animation type+subtype
2) Insert new slot ABCD+1 to Animate.ids/Aniwksnd.2da
3) Add new line ABCD+1 with modders filename resref  to  EXTANIM.2da
4) Patch current mod's .CREs to have ABCD+1 animid
....
x) Parse Animate.ids/aniwksnd.2da for other animation type+subtype
x) Insert new slot WXYZ+1 to Animate.ids/Aniwksnd.2da
 
I think main problem is processing animation type+subtype (someone good coder has to write weidu code), there is IA's anims.list with all possible(?) slots, also engine often restrict us to use limited sub-ranges (for example limits 0x4xCx, so C can be for example only 0-4 for target sub-type)
 
if resref not used, filename still based on IA-algo (µaa/...) but helps to keep modders's naming when inserted with dynamic animid


Edited by Insomniator, 18 May 2022 - 06:01 AM.