Reduce json forest (and others ?) files precision.

Discussion in 'Ideas and Suggestions' started by DePains, Nov 3, 2018.

  1. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    Hi there,

    I'm making a map and while I'm not finished putting up my forest, I've realized that my forest json files alone take 178 Mo. And then I remembered that those files do have a lot of decimal numbers.

    So I went and look how much they do have and generally there is between 7 and 12 numbers. Those mean that when I'm placing forest items, I'm doing so with a precision ranging from 100 nanometres and 1 picometre. According to Wikipedia, the smallest nucleus of an atom is the one from helium and supposed to have a diameter of 62 picometres of diameter... And with that you have the rotationMatrix and its 4 parameters with 15 decimal numbers. I'm not even sure that could be defined as an approximation.

    Capturedcran94.png

    I won't speak for everyone, but 1 millimetre is largely precise enough for me in a game in which I rarely go below 50 Km/h. And in my mind nothing in-game would require a placement precision beyond 1 mm and 1/100th of degree of rotation.

    So I tried using regex in notepad++ on a copy of the file above, searching for :
    Code:
    (\d+\.\d{4})\d*
    And replacing by :
    Code:
    \1
    to limit decimals to 4 numbers.
    N.B. : this also works on scientific notation number such as "1.931190490722656e-05" which become "1.9311e-05".

    Capturedcran95.png

    That file went from taking 9.04 Mo to 5.93 Mo (a 34.4% reduction in weight). My forest could be reduced from 178 Mo to 117 Mo. All maps are concerned with this "over-precision". I"m almost sure this would also have an impact on loading times (maybe even in-game performance ?).

    So the suggestion is : could forest editor be tweaked to limit its precision or do we reduce them afterward ?
    Or is that a bad idea ?

    Thanks for reading !
     
  2. tdev

    tdev
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 3, 2012
    Messages:
    3,031
    Thanks for your input, we are working on a new format but no promises yet
     
    • Informative Informative x 2
  3. DePains

    DePains
    Expand Collapse

    Joined:
    Nov 27, 2017
    Messages:
    105
    Thanks for the answer !
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice