Author Topic: Making formulas - what is so hard about it?  (Read 1421 times)

LigH

  • Forum Legend
  • *
  • Posts: 7096
    • View Profile
Making formulas - what is so hard about it?
« on: January 16, 2011, 05:07:56 pm »
Being a programmer, a "Graduated Computer Scientist (College)", I wonder why it seems so hard to make credible formulas for crafting. I have seen many people who wonder about the development of the skill related crafting / resource production success probabilities, I have heard even from developers that they don't agree wholeheartedly to all of those we currently use.

So I wonder: What makes them so hard to make convenient?

Are they mainly table or formula based? And if they are always immediately calculated: Which kind of module formulas are available? Where are the limits?

And what are the side conditions a Rules prospect would be asked for? Like: A static minimum and a static maximum? A linear / polynomial / exponential curve through several grid points?

I would like to know if I could be able to solve such issues.
« Last Edit: January 16, 2011, 05:10:17 pm by LigH »

Gag Harmond
Knight and Ambassador
The Royal House of Purrty

weltall

  • Moderator
  • Veteran
  • *
  • Posts: 1671
    • View Profile
    • http://weltall.heliohost.org
Re: Making formulas - what is so hard about it?
« Reply #1 on: January 16, 2011, 05:32:06 pm »
Being a programmer, a "Graduated Computer Scientist (College)", I wonder why it seems so hard to make credible formulas for crafting. I have seen many people who wonder about the development of the skill related crafting / resource production success probabilities, I have heard even from developers that they don't agree wholeheartedly to all of those we currently use.

So I wonder: What makes them so hard to make convenient?

Are they mainly table or formula based? And if they are always immediately calculated: Which kind of module formulas are available? Where are the limits?

And what are the side conditions a Rules prospect would be asked for? Like: A static minimum and a static maximum? A linear / polynomial / exponential curve through several grid points?

I would like to know if I could be able to solve such issues.
people with time and will to tackle it. they are scripted so it needs to write an algorithm or a formula to calculate results. people with degree in cs or math/physics or similar ones should be able to do it fine

LigH

  • Forum Legend
  • *
  • Posts: 7096
    • View Profile
Re: Making formulas - what is so hard about it?
« Reply #2 on: January 17, 2011, 12:25:15 am »
Would you be allowed to give any public sample of the structure of such side conditions? Don't need to be the exact used values; but I believe even the naked formula (which describes the sequence of probabilities per skill) won't tell most people enough to be a spoiler -- just make the purpose anonymous.

Gag Harmond
Knight and Ambassador
The Royal House of Purrty

weltall

  • Moderator
  • Veteran
  • *
  • Posts: 1671
    • View Profile
    • http://weltall.heliohost.org
Re: Making formulas - what is so hard about it?
« Reply #3 on: January 17, 2011, 02:21:22 am »
they are on svn or still in c++ code too. it depends mostly on what you want because there isn't one for all skills but only per type (like one for combat, one for crafting)

LigH

  • Forum Legend
  • *
  • Posts: 7096
    • View Profile
Re: Making formulas - what is so hard about it?
« Reply #4 on: January 17, 2011, 02:47:13 am »
OK ... a guessing example from me then:

Let's say you expect a specific crafting ability (e.g. "smelting lumium-steel alloy") to be available with a minimum skill of 30, and have its maximum probability/quality of 80% with level 50.

Which kind of ramp is suitable between the minimum level of 30 and the maximum level of 50 for the development of the probability/quality?

a) a linear progression from 0% to 80%?
b) a square-root or cubic-root curve like between 0.0 and 1.0, scaled to skill 30-50 and probability/quality 0%-80%? (*)
c) a polynomial curve which must go through 50% probability at level 35 and 70% probability/quality at level 40?

Summed up: Which kind of side conditions to you ask for in a Rules task?


(*) If you just need any kind of curve starting at a specific 0 point and progressing with a saturation to a given maximum: I had such a problem in my programming life before, when I created an audio dynamic compressor. I used the following functions here: hyperbolic tangens (can be translated to natural exponents / logarithms), arcus tangens (similar translation possible), x : abs(x+1).

Especially the hyperbolic tangens is a nice function, it progresses quite linearly at first, then saturates early close to the maximum.
« Last Edit: January 17, 2011, 02:53:27 am by LigH »

Gag Harmond
Knight and Ambassador
The Royal House of Purrty

weltall

  • Moderator
  • Veteran
  • *
  • Posts: 1671
    • View Profile
    • http://weltall.heliohost.org
Re: Making formulas - what is so hard about it?
« Reply #5 on: January 17, 2011, 03:02:33 am »
OK ... a guessing example from me then:

Let's say you expect a specific crafting ability (e.g. "smelting lumium-steel alloy") to be available with a minimum skill of 30, and have its maximum probability/quality of 80% with level 50.

Which kind of ramp is suitable between the minimum level of 30 and the maximum level of 50 for the development of the probability/quality?

a) a linear progression from 0% to 80%?
b) a square-root or cubic-root curve like between 0.0 and 1.0, scaled to skill 30-50 and probability/quality 0%-80%? (*)
c) a polynomial curve which must go through 50% probability at level 35 and 70% probability/quality at level 40?

Summed up: Which kind of side conditions to you ask for in a Rules task?


(*) If you just need any kind of curve starting at a specific 0 point and progressing with a saturation to a given maximum: I had such a problem in my programming life before, when I created an audio dynamic compressor. I used the following functions here: hyperbolic tangens (can be translated to natural exponents / logarithms), arcus tangens (similar translation possible), x : abs(x+1).

Especially the hyperbolic tangens is a nice function, it progresses quite linearly at first, then saturates early close to the maximum.
depends what you mean by probability the amount of quality over the total?
right now we multiplicate by two the starting quality value at this point (depending if you are in training phase, or not) we remove some quality by a linea bias iirc defined by the skill "weight". This for either the primary and secondary skill. At this point if you are above training range nothing is done to your item quality.
At the end a logarythmic distribution based random value is calculated and subtracted. Technically the infinite values are admitted with the current code. the result is then what you see.
rlydontknow thought about using a gaussian distribution bent in order to give better result to higher ranked ones, with maybe also bonus for above skill limit for the particular object being crafted (while not giving experience anymore) so people can see a progression. Right now as soon as you get no more experience in a procedure progression is not applied anymore. (in other words skilling met to 100 is useless if you do only bronze)

LigH

  • Forum Legend
  • *
  • Posts: 7096
    • View Profile
Re: Making formulas - what is so hard about it?
« Reply #6 on: January 17, 2011, 03:38:42 am »
You see, we miss each other while talking.

I have no clue about which values are at all related to the skill level. So what may I possibly mean? Well, just guesswork from someone who does not know the server code by rote. So I imagine:

While producing resources, there seems to be a minimum skill level per resource, so if your character with a skill below the minimum tries to produce this resource (by mining / fishing / harvesting ...), the result will be 0% probability to be successful. With the minimum skill and a whole level of theory training, one will have a low probability to produce this resource successfully. This probability will raise with the skill level until it saturates to a maximum probability.

While crafting materials or items, there seems to be a minimum skill level per result, so if your character with a skill below the minimum tries to craft, the result will certainly be waste, the probability of success will be 0% (e.g. a Pile of Dust, some inedible food, etc.). With the minimum skill and a whole level of theory training, there will be success to produce the expected result, but with a gradual quality, based on the skill level and some random factor.

In relation with the progression of the probability of producing a resource or the degression of the loss of quality while crafting, there is a degression of the experience earned as well, so if your skill level is above a maximum skill (per resource or result), the resource production probability and the maximum crafting result quality (before subtracting a random value) will stagnate, and the earned experience will be 0.

Are my guesses correct so far? Or am I really wrong at some point?

And where is the point where support is welcome - for the development of the value between min and max skill, or for the distribution of the random malus, or ...?
« Last Edit: January 17, 2011, 03:40:50 am by LigH »

Gag Harmond
Knight and Ambassador
The Royal House of Purrty

novacadian

  • Hydlaa Notable
  • *
  • Posts: 960
    • View Profile
Re: Making formulas - what is so hard about it?
« Reply #7 on: January 17, 2011, 04:31:41 am »

LigH, you could probably get a lot of insight by just loading the database of the Open Source release into MySQL. No need to compile anything. Perhaps they are not exactly what is used in PS, The Game; yet it should get your head pointed in the right direction should you wish to explore the code in more detail. Perhaps a look through the math_scripts table might give you some ideas. It contains the following records:

| Calc Bank Fee
| Calc Char Account Level
| Calc Guild Account Level
| Calc Item Merchant Price Buy
| Calc Item Merchant Price Sell
| Calc Item Price
| Calc Item Sell Price
| Calc Player Sketch Limits
| Calculate Damage
| Calculate Decay
| Calculate Dynamic Experience
| Calculate Fall Damage
| Calculate Mining Experience
| Calculate Mining Odds
| Calculate Repair Experience
| Calculate Repair Quality
| Calculate Repair Rank
| Calculate Repair Result
| Calculate Repair Time
| Calculate Skill Experience
| Calculate Trasformation Experience
| CalculateChanceOfCastSuccess
| CalculateChanceOfResearchSuccess
| CalculateConsumeQuality
| CalculateFamiliarAffinity
| CalculateManaCost
| CalculateMaxCarryAmount
| CalculateMaxCarryWeight
| CalculateMaxHP
| CalculateMaxMana
| CalculateMaxPetRange
| CalculateMaxPetTime
| CalculatePetReact
| CalculatePowerLevel
| CalculateSkillCosts
| CalculateStatCosts
| Lockpicking Time
| LootModifierCostCap
| MaxRealm
| SpellPractice
| StaminaBase
| StaminaCombat
| StaminaMove
| StaminaRatioSit
| StaminaRatioStill
| StaminaRatioWalk
| StaminaRatioWork

- Nova

RlyDontKnow

  • Associate Developer
  • Hydlaa Citizen
  • *
  • Posts: 403
    • View Profile
Re: Making formulas - what is so hard about it?
« Reply #8 on: January 17, 2011, 11:21:36 am »
While crafting materials or items, there seems to be a minimum skill level per result, so if your character with a skill below the minimum tries to craft, the result will certainly be waste, the probability of success will be 0% (e.g. a Pile of Dust, some inedible food, etc.). With the minimum skill and a whole level of theory training, there will be success to produce the expected result, but with a gradual quality, based on the skill level and some random factor.

In relation with the progression of the probability of producing a resource or the degression of the loss of quality while crafting, there is a degression of the experience earned as well, so if your skill level is above a maximum skill (per resource or result), the resource production probability and the maximum crafting result quality (before subtracting a random value) will stagnate, and the earned experience will be 0.

Are my guesses correct so far? Or am I really wrong at some point?

And where is the point where support is welcome - for the development of the value between min and max skill, or for the distribution of the random malus, or ...?

for crafitng there are various inputs.
first there's a minimum and maximum level for both the primary and secondary skill. (note that you cannot perform the task if you don't meet the minimum requirements, so the script doesn't have to handle it)
second there are process specific data (2 values that shall influence the result's amplitude and distribution)

the script gets those process specific data together with the current quality of the object worked on and then calculates the new quality by some means. as weltall outlined this is currently a fixed calculation randomized by a logarithmic distribution, however this may be any arbitary calculation performable via mathscripts (e.g. it could as well be a product of gaussian distributions, something reduced to a linear operator, some constant value, whatever you can think of that's performable with numerical primitives and the given inputs).

for quality stagnating: that's a consequence of the current formula, however it's by no means required to be like that
for experience I'm not 100% sure without re-checking whether this is dynamic, yet, but if it's not, it's prone to be changed to a script in the future

finally, for some examples of how those scripts look like - as nova outlined - just take a look at the math_scripts.sql in svn that holds the sample scripts (of which calculate damage shows most features available in math scripts, but is also a little over-complex for most applications)

Gilrond

  • Hydlaa Notable
  • *
  • Posts: 764
    • View Profile
Re: Making formulas - what is so hard about it?
« Reply #9 on: January 17, 2011, 11:39:41 am »
So does the amount of practical progress depend on stats at present or not? You mentioned before that theory training requires less PPs with higher mental stats, but most of the time PPs are a lesser problem comparing to a very slow practical progress. Should stats affect the practice as well?
« Last Edit: January 17, 2011, 12:05:21 pm by Gilrond »

weltall

  • Moderator
  • Veteran
  • *
  • Posts: 1671
    • View Profile
    • http://weltall.heliohost.org
Re: Making formulas - what is so hard about it?
« Reply #10 on: January 17, 2011, 11:49:17 am »
yes they do too

Gilrond

  • Hydlaa Notable
  • *
  • Posts: 764
    • View Profile
Re: Making formulas - what is so hard about it?
« Reply #11 on: January 17, 2011, 12:04:33 pm »
Good to know, thanks.