I've discovered a bug with the math in the game with using vizzy output statements, and it leads me to believe this is why we have so many issues with modification of the weight.

Here's what's happening:

We use percentage to modify a base weight value. If we go less than 100%, we in facet use a less than 1 decimal number.

By using a floating point integer to first modify an original weight, we start getting smaller numbers. Once we start floating around .00004e*-7, somehow the math changes the "-7" to a "+7", and in a matter of a few milliseconds, the tiny number blows out to be in the trillions. I noticed this with the atomic timer script, where I was doing multiple calculations in one line. Breaking the line into several lines fixed the issue (also manually doing a floor by round/truncation), but I noticed through console somehow the tiny number got switched from negative to positive, why I don't know.

But that is the exact reason why I suspect that when you modify a spinning piece's weight, you go from 2m/s to 6982m/s in in 2.3 milliseconds.

To solve the issue, instead of using float point math to adjust a parts weight, just replace the weight with a full number custom input. This way you use full integers, and not micron sized float numbers that confuse the math calculations in the computer.

I could be wrong, but that makes total sense putting it all together, because it not only causes issues with spinning pieces, but I'm also seeing that it disrupts the collision detection (as in the modification of the weight of a part breaks the collision detection to where it doesn't work at all except for with the ground)

Tags
Idea

2 Comments

  • Log in to leave a comment
  • Profile image

    Maybe this isn't so much a wrong math issue so much as it's a positive or negative number issue in general.

    Weight has to be 0 or any positive number...
    Easiest way to do that is by using an "unsigned" variable, so it will always be positive weight. When you get a calculation and type cast as unsigned, even though 0.7 * e^-9 is a positive number, it has a sign in it, and typecast maybe literally removing the sign in the exponent....

    And that's how you go from an output number of 0.000000007 to 700.000000, causing the physics to throw you from 2m/s to flaming 900m/s in half a second, and why collisions and movement are wonky when you alter mass scale.

    Just some thoughts about it because I know it's been a long time issue

    1.9 years ago
  • Profile image

    So, for example, if I have a part that is 10kg, and I want it to be 1.3kg, now I have to make it 13% on mass scale, now the comp has to go 10*0.13= then move on, where it can just replace the "10" with 1.3 and move on

    1.9 years ago

No Upvotes

Log in in to upvote this post.