# VOS CREATIONS & GUIDES

 1 2
I'm writing several posts on Ryzom crafting, this one will be about the crafting mechanics. Alot of information can already be found over at the Wiki (link), I try to fill some blind spots and have a more detailed look at the topic. Feel free to discuss the article in this thread, point out errors etc.

Navigation Crafting and Colors | Crafting and Materials | Crafting and Math | Online Recipe Generator | Offline Crafting Simulator

arc

# Crafting and Math

Big spoiler alert! The following article contains a step by step guide to recreate and understand the crafting mechanics of the game. While all of this information is available to the public via the game’s source code, it is still a mystery to many. If you want to keep this mystery, don't read on!

This article explains how to get from individual raw materials to the stats shown in the craft preview window. A big thanks to all who helped in the creation of this article and to robplus for editing.

## 0. Definitions

We need to agree on the following three things to talk about crafting. To quote my favorite character from another game: "Numbers, Numbers, Math, Math, Math!"

(Example for average, maximum and delta)

Average
Sum up the given numbers and divide the sum by their count.

Maximum
The largest number in a set is called maximum.

Delta
The difference between two numbers is called a delta value. (It can also be negative, depending on the perspective.)

## 1. Theory

There have been some myths about the crafting mechanic floating around the community. Let us begin with some facts:

• Crafting is the same for all items, plans and recipes. A magic amplifier is processed in the same way as a long axe.
• Neither individual materials nor specific item parts influences the crafting mechanic; they are all equal. Only the result of all combined materials has an impact.
• Raw materials don't have any hidden stats.
• The origin of a raw material does not matter. A piece of excellent forest beng amber is equal to its prime roots counterpart.

Crafting in general happens in two phases, these are:

(Flowchart of crafting steps)

1. calculate the values for the individual item stats based on the used raw materials

2. apply a stretch or a bonus to these values, if applicable

We are going to use a magic amplifier recipe as an example and have a look at a light armor recipe in the second phase as well. The recipes are as follows:

Basic Quality Magic Amplifier
5x Basic Mitexi Bark
5x Basic Shu Fiber
10x Choice Zun Amber

Basic Quality Light Boots
2x Choice Shu Fiber
2x Choice Moon Resin
1x Choice Gulatch Oil
1x Choice Visc Sap

### Phase 1, calculate the values for the individual item stats

To calculate the values for each stat of the resulting item, every single material contributing to this stat has to be taken into account. The first stat is durability and it appears in all 3 materials with different values.

5x basic mitexi bark for shaft, with a durability of 0
5x basic dzao fiber for grip, with a durability of 20
10x choice zun amber for magic focus, with a durability of 30

The amount of materials used and their actual value for durability has to be taken into account for the calculation. For our magic amplifier the average durability value is:

(5x0 + 5x20 + 10x30) divided by (5+5+10) = 400 / 20 = 20

The other stats are calculated in the same way. Take care not to include materials which don't contribute to a stat in the resulting item! Damage, for example, is only influenced by the shaft material. Neither grip nor magic focus contribute to damage in any way. The resulting stat is calculated like this:

(5x 0) divided by 5 = 0

If we repeat this for all stats, the resulting stats for our magic amplifier look like this:

20 Durability
35 Lightness
0 Damage
20 Speed
40 Dodge Modifier
20 Parry Modifier
50 Elemental Cast Speed
50 Elemental Power
50 Offensive Affliction Cast Speed
50 Offensive Affliction Power
30 Defensive Affliction Cast Speed
50 Defensive Affliction Power
50 Heal Cast Speed
50 Heal Power

Phase 1 ends here. The stats look quite different from the values shown in the item preview window, we will address this issue in phase 2.

Edité 5 fois | Dernière édition par Arcueid (il y a 6 ans).

---

### Phase 2, apply a stretch or a bonus

There are 2 different mechanics which can be applied to the stats of an item. To decide which one is used, we need the average and the maximum of the item stats. The average for the magic amplifier is:

(20 + 35 + 50 + 0 + 20 + 40 + 20 + 40 + 10 + 50 + 50 + 50 + 50 + 30 + 50 + 50 + 50) divided by 17 = 36.18

The maximum value of 50 occurs several times.

The game looks at how much the best stat stands out from the rest. In mathematic terms, we need the delta between the maximum and the average. With this delta, the course of action is chosen as follows:

• delta is below 30 All stats are stretched by a certain amount. Good stats get better, bad stats get worse. (Phase 2-1)
• delta is 30 or above but still below 35 No changes are applied. (Phase 2-2)
• delta is 35 or above The highest stat will receive a bonus of +10. If there are multiple stats eligible for this bonus, only the first one is considered. (Phase 2-3)

Our magic amplifier has a delta of 50 - 36.18 = 13.82. The first mechanic will be applied.

### Phase 2-1 (a stretch to all stats)

(Magic Amplifier preview with added average)

The Stretch
All stats are stretched in relation to the average of the item. Stats below the average get worse, stats above it get better. The only variable left is the amount by which these values are stretched. It is the same for all stats and is calculated as the ratio of 30 and the delta between the maximum and the average. Let's call it the Stretch Factor and calculate it for our magic amplifier:

Stretch Factor = 30 divided by (50 - 36.18) = 2.17

So we have a Stretch Factor of 2.17. However there are limitations on how high or low this value can get. It has a lower limit of 1 and an upper limit of 2. In this case the upper limit is exceeded, so the Stretch factor is set to exactly 2.

Now it is time to apply this stretch to the actual values. The values aren't multiplied directly with this factor, but instead their delta with the item average is. After the stretch, the average is added back to the delta, to get the actual value for the stat.

Example
The first stat is durability with a value of 20. The item average is 36.18. The delta is (20 - 36.18) = -16.18. Now it is multiplied with the Stretch Factor of 2: (-16.18) * 2 = -32.36. The average is then added back to it, to get the actual value: (-32.36) + 36.18 = 3.82. This calculation can also be written in a single line:

Stretched Stat = (Original Stat - Average) * Stretch Factor + Average

For durability it looks like this:

durability = (20 - 36.18) * 2.0 + 36.18 = 3.82

For damage we encounter a problem:

damage = (0 - 36.18) * 2.0 + 36.18 = -36.18

The value is negative. The craft preview does not have negative numbers. In fact it only allows values between 0 and 100. This is similar to the values on raw materials and material grades. We will deal with these values in another step, but for now the stretched stats are as follows:

3.82 Durability
33.82 Lightness

-36.18 Damage

3.82 Speed
43.82 Dodge Modifier
3.82 Parry Modifier

63.82 Elemental Cast Speed
63.82 Elemental Power
63.82 Offensive Affliction Cast Speed
63.82 Offensive Affliction Power
23.82 Defensive Affliction Cast Speed
63.82 Defensive Affliction Power
63.82 Heal Cast Speed
63.82 Heal Power

Cut Off Values
The game cuts off values below 0 and above 100. In both cases the resulting item is deformed - it loses or gains stats depending on the amount of negative and positive stats cut off. To correct this, the missing amount needs to be reintroduced to the item again. It has to be distributed among the remaining stats. In case one of the adjusted stats ends up cut off again, the process simply repeats.

If we look at our magic amplifier, there are two stats getting cut off. Damage with -36.18 and Adversary Parry Modifier with -16.18. They are both below zero and will be changed to zero. The total amount cut off has a value of:

(-36.18) + (-16.18) = -52.36

This amount has to be distributed equally among the 15 non cut off values, which is a change of (-52.36) divided by 15 = -3.49 per value. After applying these corrections, the magic amplifier stats for the preview window are as follows:

0.33 Durability
30.33 Lightness

0 Damage

0.33 Speed
40.33 Dodge Modifier
0.33 Parry Modifier

60.33 Elemental Cast Speed
60.33 Elemental Power
60.33 Offensive Affliction Cast Speed
60.33 Offensive Affliction Power
20.33 Defensive Affliction Cast Speed
60.33 Defensive Affliction Power
60.33 Heal Cast Speed
60.33 Heal Power

Final Display
The item preview window only displays the integer part of these stats and removes all the decimals (it doesn't round the numbers!). 0.33 becomes 0, 40.33 becomes 40, and so on. And that's it! Your first item crafted with pencil and paper. Congratulations!

Side Note
The item kept its original average value of 36.18 roughly the same. It didn't get better or worse. The new average is:

(0.33 + 30.33 + 60.33 + 0 + 0.33 + 40.33 + 0.33 + 40.33 + 0 + 60.33 + 60.33 + 60.33 + 60.33 + 20.33 + 60.33 + 60.33 + 60.33) divided by 17 = 36.17

### Phase 2-2 (no changes)

The values stay the same.

### Phase 2-3 (single bonus to the highest stat)

(Light Armor Boots with a +10 bonus)

Back to Phase 1
This time we use Basic Quality Light Boots as example. The first step is again to calculate the individual item stats according to phase 1. They are:

43.33 Durability
50 Lightness
90 Dodge Modifier
46.67 Parry Modifier
33.33 Protection Factor
36.67 Max Slashing Protection
50 Max Smashing Protection
50 Max Piercing Protection

We then determine which course of action the game will take. The item average and maximum stats are used again to calculate the delta value. The average is (43.33 + 50 + 90 + 46.67 + 33.33 + 36.67 +50 +50) divided by 8 = 50, which is not surprising, as only materials of the Choice grade were used. The maximum is 90, which leads to a delta of (90 - 50) = 40.

The Bonus
In this case no stretch is applied to the stats; instead, a one-time bonus of +10 is given to the first occurrence of the highest stat. For our light boots, Dodge Modifier is the highest stat with a value of 90. It gets a bonus of +10 and becomes 100 in the item preview. If this bonus leads to cut off stats (e.g., 96 + 10 = 106), the cut off amount is neglected and no correction is applied to the other stats.

Side Note
This time, the item got better. The average has changed from 50 to 51.25!

Edité 2 fois | Dernière édition par Arcueid (il y a 8 ans).

---

## 2. Reality (Ingame)

The theory has proven itself to be valid countless times and has been confirmed by an examination of the game's recently available source code. However, there are still some mysteries for the adventurous homin to solve!

One of them is the following recipe:

(Jewel Recipe preview window)

The delta is above 35 so only a one-time bonus of +10 is applied, yet Poison Protection is at 69 instead of 70 and Forest Resistance at 59 instead of 60. Forest Resistance is only influenced by the Caprice Seed in Jewel Setting with a value of 60. For the individual item stat we have (3x 60) divided by 3 = 60. It does not get a bonus being the second stat with the maximum of 60, so those values in the preview window must be the ones from the first Phase...

Edit: It has been confirmed to be a rounding error by the old client, new one is just fine!

Another observation is an exception to the rule for material grades. It seems a durability of 0 is not allowed. Any other stat can be 0, but durability can't. It is set to 1 in the game client for all cases it would be 0. This may or may not be the same for the game server. Yet another mystery to solve...

To sum it up, the game still surprises even the most veteran crafter and has its own little quirks which keep crafting challenging and fun!

Dernière édition par Arcueid (il y a 8 ans).

---

Nice! Thank you for the information. I will now go repair the hole in my head. Have a nice day.
Another great article, thanks Arc :)

---

Will this be on the exam?? :O
Would you be willing to give private math lessons to Binarabi?  Lost Girls will pay whatever rate you want:P

And thanks for another great article.:)

---

love you Arcueid, do you want to marry me ?

---

Phileur
love you Arcueid, do you want to marry me ?

Thank you for the offer, please get in line :D

---

*Bookmarked*

---

It's bad luck to be superstitious . . .

Palta e decata, nan nec ilne matala.

When one goes on a journey it is not the scenery that changes, but the traveller
Me like! Bookmarked!
Thank you for your feedback! The second part has been de-mystified! I'm using the official 2.1.0 ryzom client for win32 and it seems those 59 and 69 are indeed rounding errors. A guild member tested the same recipe with a 64bit linux client and vóila, 60 and 70!

---

I like this but my head is spinning! I feel like Bones does >.<
How in the world did you ever figure this stuff out? Where you part of the original Dev team that made this?
Thanks again for explaining it.
Awesome!! You've demystified some of crafting for me. Although I'll have to reread this many times, I'm sure, to truly understand all you've said here. Thanks for taking the time to do this. :)

Dernière édition par Keyara (il y a 9 ans).

Naema
How in the world did you ever figure this stuff out? Where you part of the original Dev team that made this?

Hi Naema!

By the time ryzom was born I've been very busy learning for all these tests and lectures at school. Internet was still expensive and mmos some super advanced technology from the future. However, I sunk many hours into the game during the beta and I regret nothing ;) For the development, I was never involved. I had my private projects, but nothing officially affiliated with Ryzom.

(Ciel and Arcueid in the beta, good times)

As for the formulas and madness associated with them, I was a young homin and fascinated by the craft system and numbers. I wasn't the smartest homin around, nor had I even started studying, but I set my personal ingame goal to fully understand crafting and the magic behind it.

I started to work on a program today known as KipeeCraft back in 2006, to support my analysis. It was very crude and spit out totally wrong numbers, but it could combine materials and provide me with a learning platform! The first step, to add the numbers mathematically correct for each stat, was relatively easy - if you had the correct raw material stats... Back then we had some online material databases, but mostly incomplete or inconcistent.

So I started another sideproject and gathered raw material stats myself and built my own little database. Maybe those differences could explain the craft system madness going on? I used screenshots of the materials and wrote a small utility to count the pixel values for the bars.

(Screenshot of my stat extractor in progress)

During the same time I started to work on a public material database called RZDB which later became arcDB. It is still around today in one form or another and I added many interesting online tools to it. This web project was going along with the knowledge and understanding I had of the craft system at the time.

I worked together with many many homins over the years and added some of the tools into KipeeCraft aswell, but the formulas were still a secret to me. The +10 Bonus was relatively easy to understand, it was more difficult to find the correct conditioins to trigger the Bonus. Some constants and deltas can be tracked down with statistics, analysis etc. today, but back then I was a young homin and busy creating stuff which sometimes worked and most of the times didn't. But I never gave up :)

The formulas were pretty much accurate by the end of 2007, way before the game's source code was available to the public. Alot of trial and error, excel sheets and programming went into them. I have to give credit, where credit is due though. I met many homins and I wouldn't be here talking about crafting without them. In no particular order and I probably forgot half of you (sorry!!), I have to give a big thank you to the following awesome players: Wintermute, Loomas, Karu, Kaetemi, Zyeir, Zerotag, Kyerna, Aajolea, Talenthia, Fasinus, Kye, Riveit, Talkirc, Nuzanshi, Sir Cotare, Elvish, Azad, Fyrosfreddy and Zood.

With the release of the game's source code I was of course excited to see the real deal and how it was done by the devs. I had a big smile on my face, the moment I found the crafting code, because I didn't have to change a thing. It was spot on, even up to this day. There were some minor differences in the redistribution of the cut off stats, yes, but the basic principle was absolutely correct.

Today everyone can look the code up, but I think it is even more confusing to learn from it, that's why I decided to write this article. I hope it helps the community to better understand crafting and doesn't reveal too much. On the other hand, after roughly 10 years of unchanged crafting and recipes - what is there left to discover?

arc

Edité 3 fois | Dernière édition par Arcueid (il y a 8 ans).

---

 1 2

Last visit samedi 7 Septembre 13:27:03 UTC
P_:PLAYER