User:Torsion

User:Torsion

From BeamNG

Beam Scale Normalizer

This tool was provided by the BeamNG team without support. For support please post in this forum thread: xxxxx_forum_thread_here_xxxxx

Purpose of the tool

Using beam scaling values is no longer recommended. Old vehicles have beam scaling values and this tool helps finalize those and remove them.

Using the tool

  1. The first step is to make a backup copy!
  2. Make sure that you are working with your vehicle unpacked to an appropriate location.
  3. Download the tool.
  4. Run the tool like so: C:\Users\User\Downloads\BeamScaleNormalizer.exe "C:\Users\User\Documents\BeamNG.drive\mods\unpacked\example\vehicles\example"
  5. Examine the log file the tool generates. The last line will indicate a number of errors: if the number of errors is "0" then the tool was successful. Otherwise look for lines which start with "E:" to find the errors.

What to do if you get errors

You probably have a vehicle which includes mismatched scale values. Some vehicles may contain many mismatched values and it can be difficult to guess which values are being used by the game. In order to fix this we'll need to do 2 things: first we'll need to find the correct values to use and second we'll need to remove all other values.

  1. To determine the values currently being used by the game when loading the vehicle we'll need to temporarily modify part of the game. C:\Program Files (x86)\Steam\SteamApps\common\BeamNG.drive\lua\vehicle\jbeam\jbeam_main.lua
    1. Replace: --log_jbeam('D', "jbeam.scaleValuesRecursive","scaled key "..tostring(key).." with factor "..tostring(data['scale'..key]).." to "..data[key])
    2. With: log('D', "jbeam.scaleValuesRecursive","scaled key "..tostring(key).." with factor "..tostring(data['scale'..key]).." to "..data[key])
  2. Save your changes.
  3. Open the game.
  4. Load gridmap.
  5. Load your vehicle.
  6. Exit the game.
  7. Examine C:\Users\User\Documents\BeamNG.drive\beamng.log
    1. Search for "scaled key" in your text editor
    2. Ignore duplicate entries for the same type of "scaled key" - there will be many of these and they will all use the same "with factor". The factor used for that type of key is the important part.
    3. Make note of every type of "scaled key" along with it's factor.
  8. Using the beamscalenormalizer.exe log locate files which have scale values. Don't forget to include both the ones called out with an "E:" for being mismatched as well as the first jbeam file which includes scale values. The first one will be denoted by having "Reading scaling values" written on the line below where it loads in the log.
  9. Open all of these files in Notepad++ and remove all of the conflicting scaling values.
  10. Choose one file and insert the scaling values you extracted from the game earlier.
  11. Save your changes.
  12. Run the tool again.

More information

Here are some example results demonstrating a bad run and a good run. The code blocks below tend to wrap text, so you may wish to use a big/fullscreen window to view them or copy them into a text editor which does not wrap.

Example Error Results

Note:

  1. The 4th line shows that we've loaded scaling values from the file above (example.jbeam)
  2. The first "E:" on line 8 tells us about another jbeam file which contains conflicting scaling values. It also tells us which value to look at (example_body.jbeam)
I: Processing folder: 
I: Got 22 jbeam files to process
I: Processing file: C:\Users\User\Documents\BeamNG.drive\mods\unpacked\example\vehicles\example\example.jbeam
I: Reading scaling values...
I: Replacing old scaling values with 100%...
I: Processing file: C:\Users\User\Documents\BeamNG.drive\mods\unpacked\example\vehicles\example\example_body.jbeam
I: Reading scaling values...
E: Found different values for the same scale! Name: beamSpring, value 1: 0.84, value 2: 2, File: C:\Users\User\Documents\BeamNG.drive\mods\unpacked\example\vehicles\example\example_body.jbeam
I: Processing file: C:\Users\User\Documents\BeamNG.drive\mods\unpacked\example\vehicles\example\example_brakes.jbeam
I: No scaling values found!
I: Processing file: C:\Users\User\Documents\BeamNG.drive\mods\unpacked\example\vehicles\example\example_bumper_F.jbeam
I: No scaling values found!
E: Aborting processing due to mismatched scale values in different jbeam files! No files have been changed...
I: Processing finished!
I: 0 Warnings, 2 Errors encountered


Example Success Results

I: Processing folder: 
I: Got 3 jbeam files to process
I: Processing file: C:\Users\User\Documents\BeamNG.drive\mods\unpacked\example\vehicles\example\example.jbeam
I: Reading scaling values...
I: Replacing old scaling values with 100%...
I: Processing file: C:\Users\User\Documents\BeamNG.drive\mods\unpacked\example\vehicles\example\example_brakes.jbeam
I: No scaling values found!
I: Processing file: C:\Users\User\Documents\BeamNG.drive\mods\unpacked\example\vehicles\example\example_bumper_F.jbeam
I: No scaling values found!
I: Scaling values:
I: beamSpring: 1.2
I: beamDamp: 0.5
I: beamDeform: 1.5
I: beamStrength: 1.7
I: beamSpring: 353505.6 -> 424206.7
I: beamSpring: 0 -> 0
I: beamSpring: 7762306 -> 9314768
I: beamSpring: 3528706 -> 4234448
I: beamSpring: 3528706 -> 4234448
I: beamSpring: 4234306 -> 5081168
I: beamSpring: 8467905 -> 1.016149E+07
I: beamDamp: 507 -> 253.5
I: beamDamp: 0 -> 0
I: beamDamp: 253.5 -> 126.75
I: beamDamp: 2028 -> 1014
I: beamDamp: 507 -> 253.5
I: beamDamp: 845 -> 422.5
I: beamDamp: 845 -> 422.5
I: beamDamp: 845 -> 422.5
I: beamDamp: 760.5 -> 380.25
I: beamDamp: 845 -> 422.5
I: beamDeform: 270000 -> 405000
I: beamDeform: 540000 -> 810000
I: beamDeform: 33750 -> 50625
I: beamDeform: 51750 -> 77625
I: beamDeform: 90000 -> 135000
I: beamDeform: 24750 -> 37125
I: beamDeform: 76500 -> 114750
I: beamDeform: 24750 -> 37125
I: beamDeform: 33300 -> 49950
I: Saving modified file: C:\Users\User\Documents\BeamNG.drive\mods\unpacked\example\vehicles\example\example.jbeam
I: Saving modified file: C:\Users\User\Documents\BeamNG.drive\mods\unpacked\example\vehicles\example\example_brakes.jbeam
I: beamSpring: 988545.6 -> 1186255
I: beamSpring: 0 -> 0
I: beamSpring: 212385.6 -> 254862.7
I: beamSpring: 106545.6 -> 127854.7
I: beamSpring: 212385.6 -> 254862.7
I: beamSpring: 0 -> 0
I: beamDamp: 101.4 -> 50.7
I: beamDamp: 0 -> 0
I: beamDamp: 169 -> 84.5
I: beamDamp: 169 -> 84.5
I: beamDamp: 0 -> 0
I: beamDamp: 0 -> 0
I: beamDeform: 55125 -> 82687.5
I: beamDeform: 14625 -> 21937.5
I: beamDeform: 14625 -> 21937.5
I: beamDeform: 2250000 -> 3375000
I: beamDeform: 12375 -> 18562.5
I: beamDeform: 10125 -> 15187.5
I: beamDeform: 5850 -> 8775
I: beamDeform: 191250 -> 286875
I: beamStrength: 3.1684E+07 -> 5.38628E+07
I: beamStrength: 31367.16 -> 53324.17
I: beamStrength: 31367.16 -> 53324.17
I: beamStrength: 253472 -> 430902.4
I: beamStrength: 1584200 -> 2693140
I: Saving modified file: C:\Users\User\Documents\BeamNG.drive\mods\unpacked\example\vehicles\example\example_bumper_F.jbeam
I: Processing finished!
I: 0 Warnings, 0 Errors encountered