Daggerfall Mechanics thread: Volunteers welcome

Discuss Daggerfall Unity and Daggerfall Tools for Unity.
Post Reply
ifkopifko
Posts: 170
Joined: Thu Apr 02, 2015 9:03 am

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by ifkopifko » Fri Jun 24, 2016 10:40 am

Hi again, thanks for the explanation Jay_H. :-)

I have been messing around with the spells, and the good news is, that I have been able to figure out the values needed to calculate gold cost and magicka cost for most of the spells in the first excel sheet... not the complete one... I'll try to look at that one sometime next week.

When you open it, you will see these values "a, b, factor, offset_gold" in green. You can also see the skill_level in blue. These alone should be needed, or so it seems up to now. The bad news is, that these values differ for duration, chance and probably for magnitude as well.
There are also some small discrepancies in some of the spells (seems like a hardcoded lower limit for magicka cost, but it must have some special conditions I do not know yet).
And there are larger discrepancies for a particular spell (comprehend languages), please rechceck the observed values for errors.

P.S.: I have converted the file to .xlsx, hope it's not a problem.
Attachments
Spells edited 4.zip
(121.49 KiB) Downloaded 109 times

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

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by Jay_H » Fri Jun 24, 2016 5:24 pm

Interesting. I understand the broad idea of what's going on in the file, though I can't reach any helpful conclusion. Hopefully your efforts will clear this up, since it is really fairly strange -- but it'll be a big help once it's finished. I'll check Comprehend Languages when I get a chance, and for now I'll try to offer some observations in case they could help.

1. In Spellmaker, during spell calculation the spell cost could be as low as 0 magicka in some cases (Chameleon Normal at skill 100, 1-1-20, for example). The game never allows you to create a zero-magicka spell, though; anything lower than 5 will default to 5 once it's purchased.

2. Comprehend Languages is a spell where the Incremental Magicka Increase value, for both Duration and Chance, ends in something other than an integer; in my results, the Duration incremental magicka was 10.2033898, and the Chance incremental magicka was 10.202020. Due to the frequency of those specific strange decimals, I feel as if there's some constant at work here. Maybe it would help if I went back in and got values for 25 and 50 for each of these from Daggerfall directly. This could be causing the irregularity you're referring to, or interfering with your calculations.

Al-Khwarizmi
Posts: 177
Joined: Sun Mar 22, 2015 9:52 am

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by Al-Khwarizmi » Sat Jun 25, 2016 10:11 pm

I've been travelling this week and couldn't look into this, but the progress you guys have made with the spells is amazing! I like how c and d (M2 and N2) are derived from a and b (J2 and K2). This was the piece I was missing to get a simple explanation for the magicka costs. I wonder why the programmers used that weird 550 number - a magic constant or derived from something else? Anyway, the model is now parsimonious enough to be believable for magicka too.

Is Comprehend Languages the only spell where both Duration and Chance seems configurable? Because if it is (as it seems from the Excel), that is likely to be the reason for the problems there...

PS: For water breathing, 1 starting duration + 1 increase per 20 levels costs 20 gold and 0 (!!!) magicka, and 1 starting duration + 1 increase per 1 levels (which is better) costs 28 gold but 5 magicka? This is right? Understanding extreme cases like this may be useful to figure out the remaining wrinkles.

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

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by Jay_H » Sat Jun 25, 2016 10:53 pm

Aahh, I see what you're saying. I had a worry that having two starting values would cross-contaminate their results, but I guess I just put it in the back of my mind and forgot about it. Here's a list of every spell with more than one modifier, which I think is accurate:

Charm: Duration, Chance.
Comprehend Languages: Duration, Chance.
Continuous Damage: Duration, Magnitude.
Fortify Attribute: Duration, Magnitude.
Paralyze: Duration, Chance.
Regenerate: Duration, Magnitude.
Shield: Duration, Magnitude.
Silence: Duration, Chance.
Soul Trap: Duration, Chance.
Spell Absorption: Duration, Chance.
Spell Reflection: Duration, Chance.
Spell Resistance: Duration, Chance.

I decided to look through the spreadsheet, and there's a very high occurrence of decimals happening where there are two modifiers present, but it isn't universal. Silence and Spell Resistance had no decimals.

Among spells with one modifier, Cure Disease/Poison 50; Detect Enemy/Magic/Treasure 50; Drain 50; Free Action 50; Heal Attribute 50; Heal Fatigue; Heal Health 50; Jumping 50; Light 50; and Lock 50 all had decimals. I was hoping (and sort of not hoping) that was the key behind why the incremental values would be irregular, but it isn't strictly happening there. There must be something else at work.

And yes, Water Breathing 100 can reduce down to 0 in the formula under the right circumstances. The same was true of Chameleon Normal 100, and I believe a few others would achieve it if I tested them under skill 100 as well. I've seen Daggerfall round down in other instances, such as determining the healing rate per hour rested, so my makeshift theory right now is that's what's happening here.

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

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by Narf the Mouse » Sun Jun 26, 2016 2:48 am

"10.2033898" looks like a floating- (or fixed-) point rounding error for "10.20339", if that's helpful.
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.

ifkopifko
Posts: 170
Joined: Thu Apr 02, 2015 9:03 am

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by ifkopifko » Sun Jun 26, 2016 8:12 am

Hi again. :-)
So I went through the complete excel sheet, and the only spell that does not fit into current formula is Comprehend Languages. Maybe it is also dependant on something else... speechcraft skill? personality attribute?

Another thing ... would it be possible to test some spell with "magnitude" more precisely. With differrent lower and upper bounds etc. I understood, that you set range in those cases, so the formula might be a bit different than for "duration" and "chance".

All you need to know for a spell and effect (duration, chance, magnitude) is "offset_gold", "a", "b" and "factor". Rest is derived from those values, or skill_level. "factor" defines how magicka costly a spell is.

Now a question for some programmer... I suppose the calculation for magicka cost will have to be made each time a spell is cast, so is there any reason (performance) not to use floats and try to remake the calculation so that it would run purely on integers?

I hope the equations/formulas are clear from the excel file. If not, I will try to explain a bit, but I am not good in such things in general, so I have to think about how to do it. :oops:
Attachments
Spells edited 5.zip
(60.67 KiB) Downloaded 70 times

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

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by Narf the Mouse » Mon Jun 27, 2016 4:49 am

ifkopifko wrote:Now a question for some programmer... I suppose the calculation for magicka cost will have to be made each time a spell is cast, so is there any reason (performance) not to use floats and try to remake the calculation so that it would run purely on integers?
The values could be stored, but honestly, given that the frequency with which they will be called for will rarely exceed once per second (unless spamming a magic item), it's frankly too trivial to worry about optimizing.

It's a good suggestion in general, though; just for reference, modern CPUs (in this case, anything in the last ~6 years) can easily do hundreds of millions of floating-point operations per second. So, no worries. :)

I could do a post on optimization, if anyone wants; it's a hobby of mine that I enjoy. ;)
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: 3093
Joined: Tue Aug 25, 2015 1:54 am

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by Jay_H » Mon Jun 27, 2016 7:21 am

ifkopifko wrote:So I went through the complete excel sheet, and the only spell that does not fit into current formula is Comprehend Languages. Maybe it is also dependant on something else... speechcraft skill? personality attribute?
This is odd. But if that's what the results show, that's the truth. I'll have to give these a check to see whether the speech skills and Personality could affect the casting cost.
ifkopifko wrote:Now a question for some programmer... I suppose the calculation for magicka cost will have to be made each time a spell is cast, so is there any reason (performance) not to use floats and try to remake the calculation so that it would run purely on integers?
I don't have anything to add except that Daggerfall changes magicka cost when skills increase, and that can only happen after resting; my presumption is that the magicka costs are stored latently each time the character "gains consciousness." The recalculating would occur either minutes or hours apart, making changes fairly rare. But as Narf the Mouse pointed out, either option appears to be feasible.
ifkopifko wrote:Another thing ... would it be possible to test some spell with "magnitude" more precisely. With differrent lower and upper bounds etc. I understood, that you set range in those cases, so the formula might be a bit different than for "duration" and "chance".
Entirely reasonable. One more thing to add. I'm hoping magnitude ranges don't become really, really messy as I think they could, but we'll just have to see what surprises Daggerfall gives us this time.
Narf the Mouse wrote:I could do a post on optimization, if anyone wants; it's a hobby of mine that I enjoy. ;)
I'm always curious about technology and I wouldn't mind learning more. If you write it at a layperson's level I'll read it.

ifkopifko
Posts: 170
Joined: Thu Apr 02, 2015 9:03 am

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by ifkopifko » Mon Jun 27, 2016 7:28 am

Regarding this:
Narf the Mouse wrote:The values could be stored, but honestly, given that the frequency with which they will be called for will rarely exceed once per second (unless spamming a magic item), it's frankly too trivial to worry about optimizing.
Jay_H wrote:I don't have anything to add except that Daggerfall changes magicka cost when skills increase, and that can only happen after resting; my presumption is that the magicka costs are stored latently each time the character "gains consciousness." The recalculating would occur either minutes or hours apart, making changes fairly rare. But as Narf the Mouse pointed out, either option appears to be feasible.
As I understood it, magicka cost can change due to effects (spells, potions, diseases), because "c" and "d" are dependant on skill_level, which should in turn be dependand on the governing attribute (Willpower). Correct me if I'm wrong.
But the formula could probably be simplified to allow at least partial results be stored.

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

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by Jay_H » Mon Jun 27, 2016 7:53 am

The examples you've named would affect character stats such as Willpower and Intelligence, but I don't believe they would have an effect on spell skills. Spell skills appear to be unaffected by changes in character stats. This is what I've seen thus far, at least.

Post Reply