Skip to the bottom to skip the math.
Object stability has two values: the displayed value and the actual value. Here's how the actual value is calculated: (calculations done on the server)
- Let's call the actual value 'A' and our object 'build'.
- First, we run through a list of objects that physically support 'build'.
- Then, we multiply the stability of each supporting object by a preset factor. Let's call this multiplied value 'B'.
- Finally, we add each value of 'B' back into 'A'.
- 'A' is returned as a value between 0.0 (0%) and 1.0 (100%).
If that was confusing, stop here and skip to the bottom.
However, the actual value and displayed value (what you see when you hover over an object) are not the same... all the time. They are only the same when the actual value's distance from 100% is negligible. Here's how the displayed value is calculated: (calculations done on the client)
- Value 'A' is received from the server.
- First, we assign to a value 'C' by doing something called "Mathf.InverseLerp", a function from Unity. If given a range (minimum and maximum) and a value within that range, Mathf.InverseLerp will return the percent of the range that represents that value. In this case: minimum = .3, maximum = 1, value = stability. Wow, pretty confusing.
- Second, 'C' is set to a "Clamped" version of 'C' between 0 and 1: If 'C' is greater than 1, 1 is returned. If 'C' is less than 0, 0 is returned. Otherwise, 'C' is returned. Your head hurt yet?
- Finally, 'C' is rounded to 2 decimal places and converted to a percentage - the one that is displayed.
== Bottom ==
The displayed stability isn't the same thing as the actual stability because more calculation goes on behind the displayed than behind the actual... for some unknown reason. The math has no purpose other than making up a displayed value :S.
More facts:
- Objects "die" if their actual stability is calculated at any time to be below 40%.
- Supporting objects don't need to be below the supported object to, well, support it. Remember, stability is proportional to the stability of the objects around it MINUS some. Free standing ceilings aren't as stable as ceilings with support directly underneath it.
- When you place an object, it is given an initial stability (the % you first see). Then, it's stability is re-calculated based on its supporting objects (the % suddenly changes). Stability is re-re-calculated every second after the first re-calculation to readjust to any changing supporting objects. Too many re-'s.
- Actual stability is used in physics. It depends on objects supporting it.
- Displayed stability is only displayed on your screen. It has meaningless math behind it based on the actual value.
- Displayed stability does not equal actual stability.
- Actual stability > Displayed stability.
- The farther actual stability is from 100%, the farther the displayed stability is from the actual stability.
- This explanation is directly based off the code from both the server and client.
If this wasn't TOO confusing, I hope this helps you guys understand more of what's going on with your buildings falling apart.

Register
Events
Popular
More
Post #1


Informative x 4
Useful x 1
Winner x 1
Agree x 1
Artistic x 1
Zing x 1