Daggerfall Mechanics thread: Volunteers welcome

Discuss Daggerfall Unity and Daggerfall Tools for Unity.
Post Reply
Al-Khwarizmi
Posts: 177
Joined: Sun Mar 22, 2015 9:52 am

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by Al-Khwarizmi » Sat Jun 18, 2016 11:09 am

Jay_H wrote:Does anyone recognize how a coherent formula could exist that adheres to the pattern shown here? (Click to make bigger)
AT LAST!! I don't know any programming on Unity and don't have too much time to learn it (I'm more of a Python, Java and plain C dev) but AT LAST I can do something for this project, thanks for giving my the chance!

After fiddling a bit (please post the actual spreadsheets, e.g. Google Drive, apart from images, copying everything into Excel is boring) I found the formula for the gold cost. It's:

Gold cost = 80 * ( Starting/4 + truncate(Starting/PerLevel) ).

Where truncate(a/b) would just be a/b in C (it's the C integer division, I'm writing truncate for easier reproducibility in spreadsheets).

Actually instead of Starting it might be Increase (or one instance of Starting and another of Increase - as in your examples both variables always have the same value, it's impossible to know, you would need to collect examples where both variables differ). But that formula fits perfectly all of your examples.

For the case of casting cost, I have the following formula which matches almost exactly all cases, except one (the first case of the first table, where the cost you list is 1635 and my formula gives 1636):

Casting cost = ( 60*Starting + 240*truncate(Starting/PerLevel) - 3 ) / 11

If I complicate things more, I can get an exact formula:

Casting cost = ( 60*Starting + 240*truncate(Starting/PerLevel) - 2*truncate(1/PerLevel) ) / 11

But I doubt this is the formula used in the game, as it's overly complex (if you start adding terms that correct the discrepancies, you can always make a formula that fits, but if you had to force it a lot it's a bad sign). Probably I'm missing something in this case. In the gold case I'm pretty sure the above formula was the one used, though, as it's quite simple.

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 18, 2016 2:33 pm

My amazement factor is somewhere near the roof right now. Fantastic work! I didn't post the spreadsheets since I didn't think they'd be useful yet, but I'll include them as I update them now. (I want to use Google Drive to post them but I can't find a way that doesn't disclose my name and etc, so I just upload them directly here.)

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

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by Al-Khwarizmi » Sat Jun 18, 2016 5:20 pm

Great! With that I can confirm that indeed both the "Starting" and the "Increase" variables are needed for the gold cost. In particular, the formula of the gold cost in the case of Chameleon Normal is

Gold cost = 20*Starting + 80*truncate( Increase/Levels )

You can try in your spreadsheet, the formula = 20*A4 + 80*TRUNC(B4/C4) reproduces the gold column in the first three sheets.

The 20 comes from a simplification of the previous formula to avoid using float division (probably not used for the game in this), this formula only uses integer division now.

Unfortunately this same formula doesn't work for the other spells, but by assuming that the equation will always have the form Gold cost = X*Starting + Y*truncate( Increase/Levels ) and solving a system of equations on two rows of the spreadsheet, we can obtain X and Y... and yep, it fits perfectly!

For Chameleon True, the formula is

Gold cost = 40*Starting + 120*truncate( Increase/Levels )

And for Damage Health

Gold cost = 20*Starting + 28*truncate( Increase/Levels )

So it seems there are two parameters associated with each spell that govern these things...

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

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by Al-Khwarizmi » Sat Jun 18, 2016 5:39 pm

Knowing this, I can derive a formula of the same form for magicka cost in the case of Chameleon Normal:

Magicka cost = truncate(Starting/2) + 2*truncate(Increase/Levels).

But for the rest of the spells, this linear relation seems to be a bit off. For damage health, I manage full replication with

Magicka cost = 3*Starting + 4*truncate(Increase/Levels) + truncate(Increase/(5*Levels))

but we shouldn't need that strange term at the end, it seems like an indication that there is some nuance that I haven't quite understood in the case of magicka (although who knows, maybe they did do something like that?)

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 18, 2016 6:08 pm

:| I just realized my Destruction level may have been contaminated. Right now it's actually 52 instead of 50, so it's just as likely I'm unwittingly altering the results. When I have a chance (next week-ish) I'll record the Damage Health values again. This still leaves Spell Skill as a missing variable, right?

I was worried the programming was really broken in DF, but you're making it look like cake now. I'm going to be spend some time pulling data out of Spellmaker for a few more spell effects and posting updated spreadsheets when I have time. If after maybe 5 or so we can determine a rock-solid formula I'll cut it there and move on to other things, but if not, I'm happy to bring out the full arrays for every spell effect. It'll just take more time.

EDIT: Your original formula actually appears to deliver properly on Damage Health 50, though I'll have to correct the incremental values. Here's what I put into the xls:
Image

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 20, 2016 6:08 pm

I've been toying around with it, and I'm starting to see the consistency between the end values and the starting values. I'll just record the first page of the spell results, and that should be enough to put into the formula. A more precise formula would be great, but I really think we're close enough now that it's a lesser detail. Also, it seems like the magicka cost reduction through spell level is uniform: every spell I've tested has had a 55% cost reduction from 1->50, and a 16% reduction from 50->100 (reduced to 9% from 1->100). I'll try a few more, and if it is stable, I'll just assume it from here on. I guess finding another formula to link 100%, 45%, and 29% over 100 points will be another item on the list.

One theory I had was that the formula wasn't perfect due to some smaller decimal not visible to us. Instead, I found that it actually applies differently than Daggerfall does. In this image, Daggerfall jumps after value 11, but the formula does so after value 10. So there's a more fundamental mechanism at work that is altering the results. This was on Water Breathing 1.
Image

Also, for what it's worth, the Destruction values were correct after all. Must've been due to some traveling I was doing after the fact.

EDIT: I just had a "fridge logic" moment. If 60x+y=1208, and x+60y=500, I just have to solve for the variables... And I can find out the increase of each variable by testing 1-1-1, 1-60-1, and 60-1-1. If my logic is wrong, I invite the correction. I'm including them in the spreadsheet, and things are going fairly quickly now.
Last edited by Jay_H on Mon Jun 20, 2016 11:50 pm, edited 1 time in total.

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

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by Interkarma » Mon Jun 20, 2016 11:02 pm

Just want to say how much I appreciate the work you guys are doing here. :)

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 20, 2016 11:30 pm

I owe a great majority of the forward progress to Al-Khwarizmi, whose work has really made it possible. Since we have a general idea of how spell formulas function, the actual work has been reduced by like 90%. Spells should be resolved within a couple of weeks at most if I can continue along this rate. Then comes combat... or merchant calculations... Excuse my involuntary shiver ;)

User avatar
LypyL
Posts: 514
Joined: Sun Mar 22, 2015 3:48 am

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by LypyL » Tue Jun 21, 2016 4:28 am

Here's a bunch of stuff that I had put together a long, long time ago. It all pretty much comes from the chronicles and wiki, and as such should be considered possibly correct, but not guaranteed :)

To-Hit chance:
The chance to hit an enemy is, according to the DF Chronicles, as follows.
Chance (%) = skill + armor_rating + ( (agil1 - agil2) ÷ 10 ) + ( (luck1 -luck2) ÷ 10 ) + swing_type + (adrenaline1 - adrenaline2) + generalMod + (career_Mod1 - career_Mod2) + misc_racial_mods - (dodging_skill ÷ 10) - 60

According to the DF Chronicles the maximum to-hit chance cannot surpass 97% and the minimum chance will never be lower than 3%.
Backstabbing and critical strike

According to the Daggerfall Chronicles, the proper formula for the damage done by a successful Backstabbing is:

3 × Base Damage

And the formula for a successful Critical Strike is:

( 1 + (critical strike skill ÷ 100) ) × Base Damage

In addition a successful critical strike adds critical strike skill ÷10to the to-hit chance.

Of course backstabbing and critical strike can be combined to do even more damage. If both are successful the combined formula for the total damage is:

( 3 + ( 3 × critical strike skill ÷ 100) ) × Base Damage

Hand-to-Hand



The damage done by hand-to-hand can be calculated as follows:
Minimum Damage = (div hand-to-hand skill 10) + 1

and

Maximum Damage = (div hand-to-hand skill 5) + 1

Once the hand-to-hand skill reaches 80, the maximum damage is:

Maximum Damage = (div hand-to-hand skill 5) + 2

One especially noteworthy aspect of Hand-to-Hand is, any type of enemy can be harmed by it, even such ones that require weapons crafted of special material to be hit. In conjunction with a high speed rate hand-to-hand is even more efficient in combat.
Leveling Equation
Level is determined by the equation
L= floor((S− S0+ 28)/15),

where S equals the sum of your three primary skills, two highest major skills, and highest minor skill, and S0 equals the sum of the starting values of each of those skills. In simpler terms, you must raise the total of these skills by 15 points in order to get a level increase. Any combination of skill increases will work as long as they total to 15 points. Increases in Miscellaneous skills do not count toward level increases, although the character will still be better at doing those things.
Training Skills
Each training session is roughly equal to 15 uses of a skill and can increase skills up to 50%.

The cost of training is 100 * your character's level

After training...9 hours and you will be able to train again.
Language check:
Humanoid enemies and some monsters are associated with a language skill which may prevent them from attacking you unless provoked (attacked or pickpocketed) in case your own skill in this language is sufficient high.

Monsters:
(player's language skill + (player's personality ÷ 10) + weapon status) ÷ 200

Humanoids:
( (player's personality ÷ 5) + (player's etiquette skill ÷ 10) + weapon status ) ÷ 200
Magicka
by default a character may only have a totality of 0.5 x Intelligence in spellpoints

There is an inverse correlation between skill in a magical school and the amount of magicka a spell from that school will cost.

The minimum amount of magicka a spell may cost is 5 spellpoints. But some magicka-heavy spells will never cost that little even with a skill of 100% in the related school.
About using google docs - I just remembered that I setup a folder on google drive for doing exactly this a very long time ago...we could use that if you want to. Just send me a PM if you want access.

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

Re: Daggerfall Mechanics thread: Volunteers welcome

Post by Jay_H » Tue Jun 21, 2016 7:08 am

LypyL wrote:Here's a bunch of stuff that I had put together a long, long time ago. It all pretty much comes from the chronicles and wiki, and as such should be considered possibly correct, but not guaranteed :)
Very good! I'll include the information in the first post once I get a chance. I won't consider it settled until we've tested it, but it'll make for good reference material. I was hoping someone had the leveling and pacifying formulas, so this is good.

I was wondering if you had heard anything more specific regarding weapon status as mentioned:
Monsters:
(player's language skill + (player's personality ÷ 10) + weapon status) ÷ 200

Humanoids:
( (player's personality ÷ 5) + (player's etiquette skill ÷ 10) + weapon status ) ÷ 200
How much does the weapon status affect the formula? I have vague memories of sheathed being +25 and unsheathed being -40 or something, but that could be entirely conjecture on my part.
About using google docs - I just remembered that I setup a folder on google drive for doing exactly this a very long time ago...we could use that if you want to. Just send me a PM if you want access.
My concern for privacy isn't for developers like yourself (you seem as decent as anyone I've met), but for further on, and I prefer to keep all my loose ends tied up. If you have valuable information in there though, keep it around. It's always good to have more leads.

As for me, I managed to finish up the spell library. Every spell effect in the game is included at least at skill level 50 (some are from the earlier stages where I was trying to get a grip on things, but the information is there, just cluttered). I have confidence that with this, spell research is mostly over. There are still a few things to find out regarding individual spell effects, but Spellmaker is now complete.

By the way, if anyone contributes something and I forget to mention it in the first post, feel free to let me know. Credit goes where credit's due.
Attachments
Spells.xls.zip
(27.76 KiB) Downloaded 79 times

Post Reply