Tens of traffic cars with minimal lag

Discussion in 'Ideas and Suggestions' started by Gavril T85, Jun 5, 2018.

  1. Gavril T85

    Gavril T85
    Expand Collapse

    Joined:
    Aug 14, 2017
    Messages:
    635
    As of now, spawning even ten cars into the game causes tons of lag, but I have an idea that could allow this number to be greatly increased along with adding a traffic mode (where lots of cars drive around the map.)

    The AI cars spawn in and drive around, but with super simplified physics, so they barely require any computing power. It's as if they were a map editor object, but they can "drive" around the map. As soon as the player's car hits them (or goes within a certain radius), they become "real" cars that have their Jbeam structures, they can be crashed into properly. The player also won't be able to press tab to switch into these "vehicles" either.

    I hope the devs see this thread because if it works, It could allow for huge pile-ups and races without lag. The traffic mode could also go well with the upcoming new AI system. https://beamng.com/threads/ai-work.54961/
     
    • Like Like x 6
  2. Uanpis

    Uanpis
    Expand Collapse

    Joined:
    Mar 11, 2018
    Messages:
    57
    The problem is that if you wanna load a car just when you hit it, the game is gonna freeze like when you change a part or spawn a new car.
     
    • Agree Agree x 7
  3. Dr. Death

    Dr. Death
    Expand Collapse

    Joined:
    May 12, 2016
    Messages:
    1,962
    Super simplified physics for AI has already been suggested.
     
    • Agree Agree x 1
  4. Gavril T85

    Gavril T85
    Expand Collapse

    Joined:
    Aug 14, 2017
    Messages:
    635
    You know how pausing physics (J) stops all lag?
    The concept would be the same here. The actual car is loaded in already, but it's physics are disabled.
    Where?
     
  5. Uanpis

    Uanpis
    Expand Collapse

    Joined:
    Mar 11, 2018
    Messages:
    57
    I don't think that's a bad idea, but it would take lots and lots of memory
     
  6. STEVIE_G4M1NG_YT

    STEVIE_G4M1NG_YT
    Expand Collapse

    Joined:
    May 26, 2017
    Messages:
    663
    Yeah. I would like cars driving around. The AI cars could have black windows, no interior, no suspension, no engine model, and no crash physics until you actually hit it.
     
    • Like Like x 2
  7. Brother_Dave

    Brother_Dave
    Expand Collapse

    Joined:
    Aug 16, 2012
    Messages:
    1,662
    Ive brought it up before, cant remember if it was here or in General subforum. I wasnt first either. Id like it alot too, should be possible with less detailed jbeams where suspension could be a simpler version or a generic one for all ai traffic. Much like 'russian mods' are today only that it would be a really simple one.
     
    • Agree Agree x 1
  8. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    No such thing as 'crash physics' exist.
    What you see when you crash a car is the result of simulating vehicles to a certain level of details.
    There is no 'crash physics' switch anywhere.

    Anyhow, you cannot swap a vehicle JBeam on the fly, as if it was a 'LOD' for a static object.
    The Jbeam dictates how a vehicle moves and drives. It's the same as changing vehicle completely, still requires a loading in-between.
     
    • Agree Agree x 6
  9. Gavril T85

    Gavril T85
    Expand Collapse

    Joined:
    Aug 14, 2017
    Messages:
    635
    I only have 8 gigs, and disabling physics even with like 40 cars still brings the FPS back up to ~50
     
    #9 Gavril T85, Jun 8, 2018
    Last edited: Jun 23, 2018
  10. NickMsiGaming

    NickMsiGaming
    Expand Collapse

    Joined:
    Oct 31, 2016
    Messages:
    55
    You could make it where the other cars have GTA V levels of Crash Detail, like minor dents and scuffs, but your car gets beaten up like a regular one ;) Also, these AI drivers could detect the crash and honk their horn or pull over or something...It might be like a small stepping stone until vehicles would be able to be simulated by the GPU, like something of a fun, dumb way to test the limits of AI stupidity xD
     
    • Agree Agree x 1
  11. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    It does not quite work that way, all physics are same level or does not exists at all, that is sadly how it works.

    Of course you could reduce number of beams, to make car with less say under 50 beams, it would still use very same crash physics, but it would be easier to compute. However it would be less realistic, so it might be that devs are not making such.

    Very simple jbeam, with tires that has less rays, maybe even body as single object and no detaching parts, that would give you more vehicles on road, but how much you would be willing to sacrifice for making kind of traffic to happen?

    I guess simplest form of a car would be something like this:
    upload_2018-6-16_9-54-5.png

    Problem with that would be that you get launched off to air if you hit that.

    So instead of 10 beams, we need bit more to add shape to front and this is 19 beams:
    upload_2018-6-16_9-56-50.png

    It might be that rear needs shape too, which increases number of beams, then engine needs some beams as well as tires and suspension, so while body itself would be possible to be made under 50 beams, there is more beams added to it.

    So if you manage to get amount of beams to something like 30-40% of original vehicle, you could run up to 3 times more vehicles than now, would that be enough for a traffic?
     
    • Like Like x 2
  12. Alex_Farmer557

    Alex_Farmer557
    Expand Collapse

    Joined:
    Dec 28, 2016
    Messages:
    3,541
    make a generic model and give it a box jbeam, some lua, and voila!
     
    • Like Like x 1
  13. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Box jbeam will actually have more beams, triangular shape uses least amount of beams.

    For 3D model, you can put pretty much any model, as that is not very hard to render, but of course less polys will always help. Vanilla cars with simplified beams and no interiors would run just fine, well as well fine as it is possible.

    Engine could be made without beams too I guess, so maybe 30 cars would be possible with desktop i7?
     
    • Agree Agree x 2
    • Informative Informative x 1
  14. NickMsiGaming

    NickMsiGaming
    Expand Collapse

    Joined:
    Oct 31, 2016
    Messages:
    55
    That is sorta what I meant, cars with simplified J-Beam structures...
    Also, that should be enough performance boost to add a few passive traffic vehicles to make the map less lonely ;) They could also de-spawn after a while if the player leaves a specific area, although that might not be possible...Either way, that's a feature I wanna see in the future for BeamNG...
     
    • Like Like x 1
  15. Gavril T85

    Gavril T85
    Expand Collapse

    Joined:
    Aug 14, 2017
    Messages:
    635
    As a developer/moderator, do you think this is a reasonable suggestion?
     
  16. NickMsiGaming

    NickMsiGaming
    Expand Collapse

    Joined:
    Oct 31, 2016
    Messages:
    55
    OH! I got an Idea! The AUTOMATION UPDATE HAS THE SOLUTION PEOPLE! I noticed i can spawn 15 or more ported automation cars at a time! And their crash physics and looks would suffice! Make them look like the standard Beam vehicles and BOOM! Traffic with realistic crash physics (altho add a warning for people running BeamNG drive on potato computers that it may cause slight frame drops, I have an i5 6600 and gtx 980 ti and I cannot test it on lower power hardware) THUMBS UP IF YOU AGREE!
    --- Post updated ---
    Sorry for the cringe, but for real, this is exciting news!
     
  17. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    I doubt that would work too well, I have Automation exported car that I can't use more than 1 at the time, with 720p resolution. Automation cars are graphically quite heavy.
     
  18. Dr. Death

    Dr. Death
    Expand Collapse

    Joined:
    May 12, 2016
    Messages:
    1,962
    Automation physics and graphics are super basic, however i dont think this is a good solution. Their quality is very much subpar and i dont think that i want to see many cars with this quality roaming the map.
     
  19. General S'mores

    General S'mores
    Expand Collapse

    Joined:
    Sep 15, 2013
    Messages:
    4,487
    Plus, they lag more than a official vehicle. VeyronEB and NinetyNine! pointed that out before, and I happen to agree with both of them after downloading a few of them.
     
    • Agree Agree x 1
  20. Dr. Death

    Dr. Death
    Expand Collapse

    Joined:
    May 12, 2016
    Messages:
    1,962
    in my experience they dont. However it could be because i have only my own exported ones and never downloaded other people's.
     
  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