Released All new Automation Engine Converter

Discussion in 'Utilities and programming' started by L0c4lh0sT, Aug 27, 2014.

  1. L0c4lh0sT

    L0c4lh0sT
    Expand Collapse

    Joined:
    Oct 8, 2013
    Messages:
    57
    Re: Automation Game Engine Converter

    Hmm....should work afaik. Can you update to 4.5.1 for testing?


    Thank you so much Andrew!
    I was going to post this on the Automation Forums too but somehow I thought it's easier to have one place for bug reports:p

    Glad to be part of these awesome communities!

    - - - Updated - - -

    Added a Debug release. New Version is now 1.0.7.2.

    This release will create Messages when the file drop event is executed.
    Please post content of the messageboxes or screenshots.
     
  2. upsetkiller

    upsetkiller
    Expand Collapse

    Joined:
    Jun 8, 2014
    Messages:
    21
    Re: Automation Game Engine Converter

    so , i downloaded 7.2v and again as i loaded the engine it didnt show the hp even tho it was selected , i tried shifting the values back and forth once again and it worked this time! , BUT ! the Chart generation still gives the error as seen below

    EDIT: first HP was not shown , now thats fixed LB/ft is not shown :/ , Also i set the path right and the config is saved in the selected vehicle from the list but how do i load the config ? its not there shown ingame when i press ctrl + e , only the default ones are there
     

    Attached Files:

    • converter.jpg
    #62 upsetkiller, Sep 2, 2014
    Last edited: Sep 2, 2014
  3. Ukkone...

    Ukkone...
    Expand Collapse

    Joined:
    Aug 5, 2013
    Messages:
    96
    Re: Automation Game Engine Converter

    Umm converter works but how do i get the engine in game ? I can't see it in parts configuration, did i miss something or don't know how to use it :D
     
  4. L0c4lh0sT

    L0c4lh0sT
    Expand Collapse

    Joined:
    Oct 8, 2013
    Messages:
    57
    Re: Automation Game Engine Converter

    I need to dive into the chart error.....for me everything is working. Going to try it on a fresh install of Windows 7 in a virtual machine later this week.
    Same for the error with hp or lb/ft is not shown.....

    The converter saves the file as a carname_enginetuningX.jbeam.
    In game hit Ctrl-W and search for Tuning in engine section. In there you should be able to find the enginename you converted.
    If it's not in there, you need to check the car's folder for the engine file. Some cars, that use multiple engines like the pickup, must be edited manually (at this time, will be fixed later)

    For the pickup, open the file "pickup_engine_v8.jbeam" (or the i6) and look for the following code:
    Code:
    "slots": [		["type", "default","description"]
    		["pickup_exhaust_v8","pickup_exhaust_v8","Gavril D-Series V8 Exhaust"],
    		["pickup_transmission","pickup_transmission_4A","Gavril D-Series Transmission"],
    		["pickup_enginetuning_v8","", "Gavril D-Series Engine Tuning"],
    	],
    
    Add the red line to it:
    Code:
    "slots": [
    		["type", "default","description"]
    		["pickup_exhaust_v8","pickup_exhaust_v8","Gavril D-Series V8 Exhaust"],
    		["pickup_transmission","pickup_transmission_4A","Gavril D-Series Transmission"],
    		["pickup_enginetuning_v8","", "Gavril D-Series Engine Tuning"],
    		[COLOR=#ff0000]["pickup_enginetuning","", "Gavril D-Series Engine Swap"],[/COLOR]
    	],
    
    After that, it is selectable under Tuning for the V8.

    I have this on my to-do list, but don't have time for that now.
     
  5. upsetkiller

    upsetkiller
    Expand Collapse

    Joined:
    Jun 8, 2014
    Messages:
    21
    Re: Automation Game Engine Converter

    1 question : P its pretty dumb but , does this just export the tuning values or it actually exports all the info of the engine like its actual displacement and engine type relative performance ? or does it simply apply just the tuning for example of a inline 4 i created onto a v8 engined car in beamng ?
     
    #65 upsetkiller, Sep 2, 2014
    Last edited: Sep 3, 2014
  6. B_Wilco

    B_Wilco
    Expand Collapse

    Joined:
    Jan 27, 2014
    Messages:
    22
    Re: Automation Game Engine Converter

    I like the idea of the chart, sadly it doesn't work for me either. The HP will display now, but only if you select KW then HP.

    I also can't get the engine tuning to work it creates the file in the proper vehicle folder, but doesn't display the engine as an option or any available tuning choices besides the stock options.

    And one really small nit-pick, the unit conversion for KW to HP is off slightly. It's converting KW to metric HP(0.73549875), but Automation uses Imperial/mechanical HP (0.74569). It's only 1% and is just a visual thing.
     
  7. caswal

    caswal
    Expand Collapse
    Automation Team

    Joined:
    Sep 3, 2014
    Messages:
    12
    Re: Automation Game Engine Converter

    Cossack give me a PM over on the automation forums. About getting gearbox ratios out from automation.

    Automation cheats somewhat in Diff / Gearbox ratios. Because of usability flow reasons. All wheel diameters are treated as the same from a calculations point of view. As you set wheel diameters after top speed, and diff ratio is never displayed anywhere. It seemed pointless to make it so if you change wheel diameters it changes diff ratio as well. Seeing that from a maths point of view it makes no difference.

    Anyway, the 2 values that get used are 0 - 1 fractional values:

    TargetTopSpeedFraction and RatioSpacing

    This is the function for generating the gearbox ratios:

    Code:
    function CCarCalculator:GetGearboxRatios()
        local GearboxRatios = {  }    
        if self.CarInfo.ModelInfo.Gearbox.Ratios == nil then return { 1 } end
        
        local ratioCount = self.CarInfo.ModelInfo.Gearbox.Ratios.RatioCount
        
        local ratioSpacing = math.lerp(1, 6, self.CarInfo.ModelInfo.Gearbox.RatioSpacing)
        local topRatio = math.lerp(0.75, 0.75, self.CarInfo.ModelInfo.Gearbox.RatioSpacing)
        
        for i=0, 1, 1 / (ratioCount - 1) do
            GearboxRatios[#GearboxRatios + 1] = topRatio + ratioSpacing * ((1 / (3 * i + 1) - 0.25) / 0.75)
        end
    
    
        return GearboxRatios
    end
    
    The math.lerp functions returns a value between the first 2 parameters by the third fractional (0-1) parameter.

    Examples:
    math.lerp(1, 6, 1.0) == 6
    math.lerp(1, 6, 0.5) == 3.5
    math.lerp(1, 6, 0.2) == 2
    math.lerp(1, 6, 0.0) == 1

    In lua it is defined as

    Code:
    math.lerp = function (a, b, l)
        return a + (b - a) * l
    end
    
    The diff ratio is calculated as:

    Code:
    self.CarInfo.ModelInfo.Gearbox.DiffRatio = math.lerp(10, 2, TargetTopSpeedFraction)
    
    All tyres wheels are treated as being 30 cm in radius. So you may need to adjust the DiffRatio to account for different car's wheel diameters in BeamNG.

    I'm not sure how you are reading the Automation Engine files, but I would highly recommend using NLua. I've attached a simple Visual Studio 2013 (.net 4.5) project. That contains an example of reading an engine file using NLua and getting all of the power curves out. If you are not using a Lua based solution, I would recommend using this. As it will be more robust and easier to maintain if the engine file format changes in the future.

    I hope this helps!

    Caswal Parker - Programmer at Camshaft Software
     

    Attached Files:

  8. RobertGracie

    RobertGracie
    Expand Collapse

    Joined:
    Oct 15, 2013
    Messages:
    3,780
    Re: Automation Game Engine Converter

    Good to see you on the forums Caswal we could use your assistance here...with this program :)
     
  9. Ukkone...

    Ukkone...
    Expand Collapse

    Joined:
    Aug 5, 2013
    Messages:
    96
    Re: Automation Game Engine Converter

    God i feel stupid... Yeah so it works now because i use the correct path, i have the steam version as my main game and i did use this conversion on the non steam path. :D
     
  10. B_Wilco

    B_Wilco
    Expand Collapse

    Joined:
    Jan 27, 2014
    Messages:
    22
    Re: Automation Game Engine Converter

    never mind, the top ratio is always 0.75.
    I failed.
     
    #70 B_Wilco, Sep 4, 2014
    Last edited: Sep 5, 2014
  11. L0c4lh0sT

    L0c4lh0sT
    Expand Collapse

    Joined:
    Oct 8, 2013
    Messages:
    57
    Re: Automation Game Engine Converter

    Okay I'm back from my work as a carer in a youth brigade camp.
    So I can continue with the EngineConverter.

    Special thanks to Caswal for all the useful informations and also to B_Wilco to figure out the unit conversion thing.

    To answer your question about what I use to read all the info from the lua:
    I wrote a simple but quite good method for that. You only need to give a file, a keyword and where to look for it. For example searching for the enginename:

    _findData("engine.lua", "[EngineName]", 1) - This will seach for the keyword "[EngineName]" in the file "engine.lua" and will return the Line with the first appearance of the keyword. After that the line is splitted after the equal sign and stored as a parameter.

    I will follow your recommentation and will try out NLua in future versions as this seems much better and resource friendly after all.


    I have installed a fresh Windows 7 in a virtual machine. Only installed .Net 4.5 and ran the engineconverter without any problems or errors. It displays the correct values and I get a nice chart after I click the button.
    However next week I try to implement NLua and maybe start from scratch (again). I've learned a lot in the last few weeks and I think it may be good to start with a clean project as right now my code is slightly messed up after all the bug searching.


    Thanks for all the feedback!

    Alex
     
  12. RobertGracie

    RobertGracie
    Expand Collapse

    Joined:
    Oct 15, 2013
    Messages:
    3,780
    Re: Automation Game Engine Converter

    I tried to build a micro 400cc 12,000rpm I4 motor and it refused to work with the gearboxes in game thats my only problem with this so far :(
     
  13. L0c4lh0sT

    L0c4lh0sT
    Expand Collapse

    Joined:
    Oct 8, 2013
    Messages:
    57
    Re: Automation Game Engine Converter *new*

    Released a new test version with nLua!
    Please read first post before downloading!
    This version will not let you create any jbeams! Just for testing the GUI!

    I'm afraid this only works on 64bit Windows, but I can't test it! Please let me know!
     
  14. L0c4lh0sT

    L0c4lh0sT
    Expand Collapse

    Joined:
    Oct 8, 2013
    Messages:
    57
    Re: Automation Game Engine Converter *new*

    First News:
    Started to work on converting Automation's Transmission. Right now you need to put in the values from the car manually. But it works.
    Big problem I have with this transmission calculation is, that the transmission is not driveable in Manual mode. And even on automatic it's not fun to drive.

    This is a transmission based on the calculation in Automation Game:
    1. Gear: 1.16
    2. Gear: 0.925714285714286
    3. Gear: 0.832
    4. Gear: 0.781538461538462
    5. Gear: 0.75

    DiffRatio: 4.4

    Added it to a Ibishu Covet with the engine tuning from automation.
    The 1st gear goes to 120 kph, 2nd to 140 kph, 3rd to 160 kph, 4th to 170 kph and 5th to 200 kph.

    I attached the tuning file for the hatch incase you want to try it your self.

    Remember to select the tuning and select 'empty' in transmission. The tuning has it's own transmission.

    Second News:
    The EngineConverter will get it's own setup. This is a requirement for the new way I read the Automation files. First there is a DLL that must be in the same directory as the exe, second I need to make sure that you have Visual C++ Runtimes installed. Otherwise GUI and Chart will not work correctly. The easiest way for both of us is to install dependencies with a setup.

    Working on a new release right now... should be ready in the next few days. This release will be shipped with the installer. Also you can create tunings again. I'm not sure about the transmission part right now. Maybe I need to tweek the calculation a bit to be more BeamNG friendly.

    Cheers

    Alex
     

    Attached Files:

  15. GabrielFarre

    GabrielFarre
    Expand Collapse

    Joined:
    Aug 6, 2013
    Messages:
    440
    Re: Automation Game Engine Converter *new*

    i cant understand how this works i put the engine jbeams and it isnt works :( help me please :3
     
  16. L0c4lh0sT

    L0c4lh0sT
    Expand Collapse

    Joined:
    Oct 8, 2013
    Messages:
    57
    Re: Automation Game Engine Converter *new*

    Please read Posting #64 again. I described what you have to do to get it ingame.
    Automation-Game-Engine-Converter-*new*
     
  17. JackCossack

    JackCossack
    Expand Collapse

    Joined:
    Oct 16, 2012
    Messages:
    47
    Re: Automation Game Engine Converter *new*

    There is something wrong with your implementation, as these ratios are impossible in Automation. Could you tell me what the Automation's gear spacing value is?
     
  18. L0c4lh0sT

    L0c4lh0sT
    Expand Collapse

    Joined:
    Oct 8, 2013
    Messages:
    57
    Re: Automation Game Engine Converter *new*

    Sure,

    ratioSpacing = 0.41;
    ratioCount = 5;

    Here is the calculation I use:
    Code:
    public static void GetGearboxRatios()
            {
    
    
                double topRatio = mathlerp(0.75, 0.75, ratioSpacing);
                int y = 0;
    
    
                for (double i = 0; i <= 1; i = i + Convert.ToDouble((1 / (ratioCount - 1))))
                {
                    GearboxRatios.Add(topRatio + ratioSpacing * ((1 / (3 * i + 1) - 0.25) / 0.75));
                    Console.WriteLine( y + 1 + ". Gear: " + GearboxRatios[y]);
                    y++;
                }
            }
    
    
            private static double mathlerp(double p1, double p2, double ratioSpacing)
            {
                return p1 + (p2 - p1) * ratioSpacing;
            }
    
    
    - - - Updated - - -

    Released Version 2.0.1 now!
    Read first post in this topic for full changelist and features!
     
  19. JackCossack

    JackCossack
    Expand Collapse

    Joined:
    Oct 16, 2012
    Messages:
    47
    You forgot to linearly interpolate the gear spacing.

    What you need is
    Code:
                double gearSpacing = mathlerp(1, 6, ratioSpacing);
    Added just after the top ratio line, and then using that variable (you can call it whatever you want) instead of the ratioSpacing value in the main gear ratio calculation
     
  20. L0c4lh0sT

    L0c4lh0sT
    Expand Collapse

    Joined:
    Oct 8, 2013
    Messages:
    57
    Thank you JackCossack!
    Now Calculation returns realistic ratios that are driveable!

    Will try to implement that in the next version. This requires a few changes because transmission calculation can only be done with a model, not with the engine itself.
    So maybe the future of EngineConverter will be DrivetrainConverter :p

    Right now i'm still struggling with finding the best shifting rpm's for automatic transmissions.

    Cheers
    Alex
     
  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