Sorry, we don't support your browser.  Install a modern browser
This post is closed.

Round off numbers in the JSON save file#716

I’m really glad you use JSON as the save format, as it makes it easy to use Unix commands like “diff” to compare versions and see what’s changed. Except for the fact that all the numbers are different, like this:

       "Name": "Custom_Tile",
       "Transform": {
         "posX": -19.55,
-        "posY": 1.15998363,
-        "posZ": -17.25,
-        "rotX": -0.00032046737,
-        "rotY": 179.98555,
-        "rotZ": -0.000471320673,
+        "posY": 1.15996635,
+        "posZ": -17.2499981,
+        "rotX": -0.00149185373,
+        "rotY": 179.985565,
+        "rotZ": -0.000435872353,
         "scaleX": 1.0,
         "scaleY": 1.0,
         "scaleZ": 1.0

Nothing has really changed here, but the numbers are being rounded off differently when the JSON file is produced.

My suggestion would be to round off all the numbers to a sensible precision. For degrees (rotation values) just integers should be fine, or maybe tenths. For other coordinates, maybe hundredths or thousandths. But as long as the numbers are consistently rounded, each save will produce the same values in the JSON file.

Thanks!

5 years ago

It’s especially irritating when there are infinitesimal numbers represented as scientific notation, when it should just be 0.0. LIke this:

-        "rotX": 8.775293E-05,
+        "rotX": 3.01966211E-05,
5 years ago