Reversing Morrowind's formulas

Everything about development and the OpenMW source code.
User avatar
Hrnchamd
Posts: 64
Joined: 11 Aug 2012, 00:48

Re: Reversing Morrowind's formulas

Post by Hrnchamd »

scrawl wrote:There is a problem with the magic resistance formula.
...
Ingame, I see something completely different. The effect is never resisted. Something is wrong here...
Updated https://wiki.openmw.org/index.php?title ... resistance with findings.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Reversing Morrowind's formulas

Post by scrawl »

Hi Hrnchamd, could you double check whether the use for iFightAttack/iFightAttacking on https://wiki.openmw.org/index.php?title ... _reactions is correct? It'd be more logical if they were swapped, the higher value iFightAttack should be used for the victim. From my game testing that is how MW is using them. And that would also make it consistent with iDispAttackMod/fDispAttacking.
User avatar
Hrnchamd
Posts: 64
Joined: 11 Aug 2012, 00:48

Re: Reversing Morrowind's formulas

Post by Hrnchamd »

Merry Christmas!

You were right, I got the victim detection wrong; the wiki is updated. The GMST names aren't consistent in this part, it mixes Attack* and Attacking* freely.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Reversing Morrowind's formulas

Post by scrawl »

Thanks!

One other problem I noticed is with pickpocket victims that have an alarm of 0 (e.g. the orc next to the entrance in Caldera, Ghorak Manor).
According to the formula, fightTerm = alarmTerm * (fightTerm + x) this makes the fightTerm 0, so the orc should not be engaging combat with the player upon detecting a pickpocket attempt. But he does attack in the original engine.
User avatar
Hrnchamd
Posts: 64
Joined: 11 Aug 2012, 00:48

Re: Reversing Morrowind's formulas

Post by Hrnchamd »

It should set the alarmTerm to 1.0 if it's <= 0. Oops, another reversed test. Updated wiki.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Reversing Morrowind's formulas

Post by scrawl »

Thanks again, updated code.
User avatar
Hrnchamd
Posts: 64
Joined: 11 Aug 2012, 00:48

Re: Reversing Morrowind's formulas

Post by Hrnchamd »

Updated enchanting and (minor change) spellmaking: https://wiki.openmw.org/index.php?title ... g_merchant and https://wiki.openmw.org/index.php?title ... enchanting

Unfortunately all the enchanting temporary variables were stored in Morrowind's UI layer, even in the cost calculation inner loop there was data exchange with the UI. That took a long time to figure out.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Reversing Morrowind's formulas

Post by scrawl »

Nice. One question, what should duration be set to for a constant effect enchantment? 1?

Code: Select all

x *= effect.duration
Do you know anything about the NPC idle voice logic? We're having some issues there, the current implementation uses fVoiceIdleOdds as a percentage and checks it each time an idle animation starts. In MW it seems to be checked much more often (every frame?), so it can't really be a percentage, I presume.
Cramal
Posts: 186
Joined: 19 Sep 2014, 13:37

Re: Reversing Morrowind's formulas

Post by Cramal »

For the duration, according to the formula here : http://uesp.net/wiki/Morrowind:Enchant (at the end)
The x duration of a constant effect seems to be 100.
User avatar
Hrnchamd
Posts: 64
Joined: 11 Aug 2012, 00:48

Re: Reversing Morrowind's formulas

Post by Hrnchamd »

scrawl wrote:Nice. One question, what should duration be set to for a constant effect enchantment? 1?

Code: Select all

x *= effect.duration
It's set by a GMST, updated the wiki page.
scrawl wrote: Do you know anything about the NPC idle voice logic? We're having some issues there, the current implementation uses fVoiceIdleOdds as a percentage and checks it each time an idle animation starts. In MW it seems to be checked much more often (every frame?), so it can't really be a percentage, I presume.
I just researched it recently for an MCP patch on creature voiceovers. It's still early research. Voice wiki page. Note that creatures can't use this in vanilla, their audios sources are SoundGens.
Post Reply