Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Talk about the mods or features you'd like to see in Daggerfall Unity. Give mod creators some ideas!
Narf the Mouse
Posts: 743
Joined: Mon Nov 30, 2015 6:32 pm

Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse » Wed Dec 26, 2018 7:10 am

v0.3 is now out: 03/01/2019

So I made a little mod that does a few things:

1) Makes playing a low-level mage less painful.
2) Makes it viable to play a mage without taking 3X Int in Magicka. (really!)
3) Makes high-level mage PCs even more powerful. (sorry! not intentional - I don't even know if spell point cost reduction for magicka skills can be changed)
4) It doesn't affect magicka regeneration when resting. (I'll have to investigate this. :) )
5) NPCs will also regenerate magicka. :twisted: But you can turn this off in the mod settings.

It does this by allowing you and NPCs to, as you may guess, regenerate magicka. ;)

What does this do?

1a) You regenerate magicka a lot slower when your current magicka is low, relative to your maximum magicka. (Your regeneration will never be 0, although it can get very close...)
1b) NPCs regenerate magicka as if their current Magicka was 65% of their maximum magicka. (You can change the rate in the mod settings) This is because current NPC AI doesn't know about Magicka Regeneration or how it works, and would otherwise cripple itself. You can also toggle NPCs to use the same magicka regeneration as you do. (Toggle "Use Simplified NPC Regeneration off" in the mod settings)
2) You/NPCs regenerate magicka faster, the lower your maximum magicka.
3) You/NPCs regenerate magicka faster with more willpower.

What are the intended implications?

Magicka exhaustion encourages a "run-and-cast" style of gameplay. Up to 50% of your maximum magicka is "fungible", and the remaining 40% is essentially emergency reserves, or for long-duration spells.
Willpower is more valuable, but not a lot more. At 100 Willpower, you regenerate Magicka twice as fast as at 50 Willpower. (I may increase this in the future)
A character with a maximum of 50 magicka regenerates magicka 6 times as fast as a character with 300 magicka. OTOH, it's a lot harder to exhaust 300 magicka...

The math: Magicka regeneration is based on the following formula:

Per second = max((CurrentMagicka / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplierPercent )

Simplified NPC magicka regeneration is instead based on this formula:

Per second = max(((simplifiedMagickaPercent * MaximumMagicka) / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplier)

lowerCase names are variables, and can be changed in settings.

Defaults:
dividentMaximumMagicka = 150
magickaPercentExponent = 200%
minimumMagickaPercent = 1%
willpowerMultiplierPercent = 15%
_NPCsRegenerateMagicka = True
useSimplifiedNPCRegeneration = True
simplifiedMagickaPercent = 65%

Warning! The code has received very minimal testing. I cannot be held responsible for anything it does to your character(s), your computer, or anything else, and I highly recommend making a test character. That being said, it should be well-behaved, but I cannot guarantee that.

Installation:

Copy the "Magicka Regeneration.dfmod" file for your platform into your "StreamingAssets/Mods" folder.

Uninstallation:

It should uninstall by removing the "Magicka Regeneration.dfmod" file from your "StreamingAssets/Mods" folder. However, see the warning above.

Changes in v0.2:

* Hardcoded constants are now variables.
* Added settings so you change the variables in the formula.
* Formula is now: Per second = max((CurrentMagicka / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplierPercent )
* lowerCase names are variables.

Changes in v0.3:

* NPCs can now regenerate magicka.
* Two new toggles. Both toggles default to True.
** "NPCs Regenerate Magicka" controls whether or not NPCs regenerate magicka at all.
** "Use Simplified NPC Regeneration" determines which formula NPCs use; the same as the player, or the simplified formula. The simplified formula is recommended for AI which does not take magicka regeneration into account.
* New slider: "Simplified Magicka Percent", which defaults to 65%.
* The simplified NPC magicka regeneration formula calculates magicka regeneration as if their current magicka was always equal to the "Simplified Magicka Percent" of maximum magicka. This should allow NPCs to regenerate magicka, without favouring them.

New NPC magicka regeneration formula:

Per second = max(((simplifiedMagickaPercent * MaximumMagicka) / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplier)

Magicka Regeneration.zip
(11.55 KiB) Downloaded 49 times
Last edited by Narf the Mouse on Fri Jan 04, 2019 5:42 am, edited 7 times in total.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

User avatar
Interkarma
Posts: 4234
Joined: Sun Mar 22, 2015 1:51 am

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Interkarma » Wed Dec 26, 2018 10:58 pm

Thanks Narf! I hope you get some good testing results soon.

When you're happy, I can move into released mods.

Narf the Mouse
Posts: 743
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse » Thu Dec 27, 2018 4:35 am

Interkarma wrote:
Wed Dec 26, 2018 10:58 pm
Thanks Narf! I hope you get some good testing results soon.

When you're happy, I can move into released mods.
Thanks. :) Not sure what to do about a picture, though.

And it does need settings, so people aren't stuck with my hardcoded values. Just no time today. :)
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Narf the Mouse
Posts: 743
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse » Sun Dec 30, 2018 12:05 am

...Does anyone else download their own mods? Because I just did. :D Seems more reliable than "Whatever state the mod is in development." Heh.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

User avatar
Jay_H
Posts: 2070
Joined: Tue Aug 25, 2015 1:54 am

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Jay_H » Sun Dec 30, 2018 12:40 am

That seems to suggest you're not holding the original copy on your computer for testing like I do with my quests :D
Come join the Unofficial Daggerfall Unity Discord.
Try the first Daggerfall Unity Quest Pack with roughly 210 all-new quests.
I write quests but have no technical knowledge.

Narf the Mouse
Posts: 743
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse » Sun Dec 30, 2018 12:46 am

Jay_H wrote:
Sun Dec 30, 2018 12:40 am
That seems to suggest you're not holding the original copy on your computer for testing like I do with my quests :D
I do have version control - But I don't generally go all-in with tagged releases... which I probably should.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Narf the Mouse
Posts: 743
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse » Mon Dec 31, 2018 12:16 am

Version 0.2 is now out; the download link in the first post has been updated. Changes:

* Hardcoded constants are now variables.
* Added settings so you change the variables in the formula.
* Formula is now: Per second = max((CurrentMagicka / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplierPercent )
* lowerCase names are variables.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Narf the Mouse
Posts: 743
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse » Tue Jan 01, 2019 9:31 pm

Request for comment - If you find you like a different set of settings better, what were they, and why?

Provided there are no major complaints by, say, January 8th, I'll submit this to Interkarma as a proper mod. :)
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Narf the Mouse
Posts: 743
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse » Fri Jan 04, 2019 5:39 am

Version 0.3 is now out; the download link in the first post has been updated. Changes:

* NPCs can now regenerate magicka.
* Two new toggles. Both toggles default to True.
** "NPCs Regenerate Magicka" controls whether or not NPCs regenerate magicka at all.
** "Use Simplified NPC Regeneration" determines which formula NPCs use; the same as the player, or the simplified formula. The simplified formula is recommended for AI which does not take magicka regeneration into account.
* New slider: "Simplified Magicka Percent", which defaults to 65%.
* The simplified NPC magicka regeneration formula calculates magicka regeneration as if their current magicka was always equal to the "Simplified Magicka Percent" of maximum magicka. This should allow NPCs to regenerate magicka, without favouring them.

New NPC magicka regeneration formula:

Per second = max(((simplifiedMagickaPercent * MaximumMagicka) / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplier)
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Narf the Mouse
Posts: 743
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse » Wed Jan 09, 2019 10:07 am

...Um, I appear to be late with my mod submission.

...Yeah, my bad.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Post Reply