Ghost Engine to Layer Engine Sounds

Discussion in 'Programming' started by FFIVGUY, Dec 11, 2024.

  1. FFIVGUY

    FFIVGUY
    Expand Collapse

    Joined:
    Feb 21, 2018
    Messages:
    603
    I'm trying to make a ghost engine so that I can layer engine sounds. I almost got it but I seem to be missing something. I did it two different ways, but neither worked. And yes, I modified combustionEngine.lua and vehicleController.lua
     

    Attached Files:

  2. MrRadYT

    MrRadYT
    Expand Collapse

    Joined:
    Jan 18, 2023
    Messages:
    218
    If this could work, it could well and truly make engine sounds mods way more realistic for BeamNG. I tried to see if it was possible a while ago, but no one knew anything about it.
    Were you able to get both engines working at the same time, both producing their own sounds?
     
  3. FFIVGUY

    FFIVGUY
    Expand Collapse

    Joined:
    Feb 21, 2018
    Messages:
    603
    I did a while ago, hadn't done it recently. NOCARGO had given me an example project that used for reference, but I think I may have accidentally deleted it and the link to redownload it is expired. He also told me to use his I8 for the crash hard car as an example and to "adopt and adapt" it, though I tried that and nothing seemed to work. He has not been on the forums in over 2 years.
    --- Post updated ---
    This is what happens when I select the ghost engine
    2025-01-01.png
     
  4. MrRadYT

    MrRadYT
    Expand Collapse

    Joined:
    Jan 18, 2023
    Messages:
    218
    Damn, that sucks. There's no worse feeling than deleting something that becomes lost media. By the looks of it, the whole vehicle becomes corrupt from the engine, probably because the controllers don't know what to do with 2 engines.

    I remember trying to add an electric motor in series with an engine for the Bus, like a mild hybrid. When you would equip the electric motor, it would come with the same error.

    I know you said you edited the combustionEngine.lua and the vehicle controller, but if it connects to the powertrain system, depending on what gearbox, maybe it's a powertrain controller fault.

    I know I'm not much of a help at the moment, but I am really interested in this too. This system is perfect for what I need, as I am working on a Voith gearbox for the bus, and the input whine works with engine RPM rather than gear speed.
    tL-DR: I need a second engine source with a custom blend to make it realistic.

    Hopefully some advanced BeamNG dev or mod creator replies, because this is something I've needed for ages
     
    • Agree Agree x 1
  5. FFIVGUY

    FFIVGUY
    Expand Collapse

    Joined:
    Feb 21, 2018
    Messages:
    603
    I posted the combustionEngine and vehicleController luas if you want to take a look
     

    Attached Files:

    #5 FFIVGUY, Jan 2, 2025
    Last edited: Jan 2, 2025
  6. MrRadYT

    MrRadYT
    Expand Collapse

    Joined:
    Jan 18, 2023
    Messages:
    218
    I tried porting it to the citybus. It never came up the red error saying a corrupt mod, but it spawned with no gearbox. I took a look into the console and saw this
    upload_2025-1-3_13-50-11.png
    I did change all references to vehiclecontroller2 and combusionengine2. If you haven't already, check the console, there might be something there of value
     
  7. MrRadYT

    MrRadYT
    Expand Collapse

    Joined:
    Jan 18, 2023
    Messages:
    218
    Alright, I just figured something out. When I change it to combustionengine2.lua and mainengine2.lua here
    upload_2025-1-3_14-3-53.png
    The game throws the console error above.

    But, if I leave it the same as it was before
    upload_2025-1-3_14-3-3.png
    The game doesnt throw an error when both engines are selected.

    In the video, at the start, I am using the stock engine. But when I select the ghost engine (Voith sound emitter), the game doesnt bug out, and the powertrain still works. However, it only plays one sound, which is the ghost engine, the I4. So it seems that only one sound event can play at a time
     

    Attached Files:

  8. FFIVGUY

    FFIVGUY
    Expand Collapse

    Joined:
    Feb 21, 2018
    Messages:
    603
    It has to stay like that so it knows to use the those lua files and not the vanilla ones so that it can play multiple soundLayers at once
     
  9. MrRadYT

    MrRadYT
    Expand Collapse

    Joined:
    Jan 18, 2023
    Messages:
    218
    So does changing that from "combustionEngine" to "combustionEngine2" tell it to use the new lua files?

    I noticed when I did do that, in the console, it said "Unknown part: MainEngine2" and the powertrain gave up. So it seems that it wasn't edited to understand what "MainEngine2" is and act accordingly. Another thing too, is that the console was changing the file location. Not sure if that's a problem too, but thats there.

    What about vehicle controller at the bottom, that should be changed to "vehicleController2" too shouldn't it?
     
  10. FFIVGUY

    FFIVGUY
    Expand Collapse

    Joined:
    Feb 21, 2018
    Messages:
    603
    Yup. combustionEngine and vehicleController should both be changed to combustionEngine2 and vehicleController2 so it knows to use the new files. The same thing with mainEngine
     
  11. MrRadYT

    MrRadYT
    Expand Collapse

    Joined:
    Jan 18, 2023
    Messages:
    218
    And those lua files are located in
    "mod directory/lua/vehicle/controller" right?
     
  12. FFIVGUY

    FFIVGUY
    Expand Collapse

    Joined:
    Feb 21, 2018
    Messages:
    603
    yup
     
  13. MrRadYT

    MrRadYT
    Expand Collapse

    Joined:
    Jan 18, 2023
    Messages:
    218
    Any update on this? I cant seem to get it to work unfortunately, no matter what I try. :(
     
  14. FFIVGUY

    FFIVGUY
    Expand Collapse

    Joined:
    Feb 21, 2018
    Messages:
    603
    I still haven't had any luck either
     
  15. MrRadYT

    MrRadYT
    Expand Collapse

    Joined:
    Jan 18, 2023
    Messages:
    218
    Damn. I remember seeing a thread about this before, but that was in 2020 and probably not accurate anymore. Hopefully the BeamNG devs or someone experienced might see this though
     
  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