1. Stuck or having problems creating your mod?

WIP Traffic Tool 1.2.1

It's here! Create dynamic traffic on almost any map!

  1. EnjoyMyHItsYT

    EnjoyMyHItsYT
    Expand Collapse
    Banned

    Joined:
    Oct 9, 2016
    Messages:
    1,193
    well, when i drive a police car the traffic is not making place for me...why?
    --- Post updated ---
    i know it has to be Police in the Car i used the 200bx theres no Police in name but for ShowMik worked it i think he had a custom car
     
  2. 98crownvic

    98crownvic
    Expand Collapse

    Joined:
    Jul 14, 2016
    Messages:
    1,305
    I don’t think the traffic does that.
     
  3. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,778
    Choose whatever police car you wish.

    Save configuration with name "police_whateveryouwant" (use parts manager ctrl-w to save)

    Now when you load your new saved configuration, script reconizes it as a police car and also script can spawn it as a police car.

    I think that I have well over 200 downloaded police car skins that needs renaming to work with the script.

    I would think that in a future it would make sense to have police and emergency tags in skins and tool implemented to game to look for those tags for reliability sake, but developers might already have better ideas about it, but for now, just use police name in saved config for any emergency vehicle you wish to drive with the script.
     
    • Like Like x 2
    • Informative Informative x 1
  4. Gamergull

    Gamergull
    Expand Collapse
    Staff Member

    Joined:
    Jun 3, 2018
    Messages:
    295
    Sorry for the late replies! Super long shifts are killing me, haha.

    Nice! It's very BeamNG Orange. I'll take it for a while!


    Multi-lane traffic works! But there's a catch. The map's decalRoads have to be set to oneWay and be wide enough for traffic to drive on both lanes. If you're not sure, then you'll have to test the maps to see. It would be possible on obsolete highways, but my parallel roads function throws too many false positives, and you would see all kinds of funky behavior on seemingly normal roads. I hope this encourages mapmakers to use the oneWay property more!

    Did you turn on AI Awareness? A lot of my extra AI behavior requires that to be checkmarked. Speaking of, I originally had it as an option because my awareness stuff was experimental, and I was not confident in it working decently. Dang confidence issues! I've improved my script since then, and perhaps AI Awareness should be a default thing.
     
    • Like Like x 1
    • Agree Agree x 1
  5. Shotgun Chuck

    Shotgun Chuck
    Expand Collapse

    Joined:
    Mar 6, 2015
    Messages:
    1,141
    Thanks! Maybe I'll try it out after I finish filming laps of Hirochi Raceway and Industrial Site tonight.
     
  6. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    2,277
    The new Roane County TN MAP 15.2.x version that's going to go live... toda....tomorro...errr whenever the moderators put it on the server has all beautiful AI work done on it, you will love it with the traffic tool, it's an update made specifically for what may be the most awesome mod of the year for BeamNG. *reluctantly hands the imaginary 'best mod of year' trophy to @Gamergull and cries a map-flooding river*. New AI works pretty well and I found that, to decrease the 'gap' length between nodes in bridges , simply carve a donut-shaped hole in the ground UNDER the bridge (since no-one drives in the river on purpose, even in a car-crash game), stick a rock over it, and raise the single (or a few) squares of terrain up underneath the bridge so they 'hide' inside the bridge (you can't see them from underneath, terrain only displays from the top). Then you can stick a decal road node on the little 'island' inside of the donut-shaped-hole in the terrain that you raised up under the bridge. since the AI drives from node-to-node without a care in the world, it will happily drive over your bridge like it isn't even there, and if you did it right, it won't spawn any in facing the wrong way, either.
    Only one of my bridges uses this in Roane County - the Thomas J Pickel Jr. bridge just east of Kingston (yeah heck of a name), I didn't want to be in a pickle trying out a new 'cheat' with the AI and decal roads (much less crash the darn game again, which I AM very very good at*), and end up wrecking things. It's easily identifiable though because the bridge is raised in the center, and it's the only 4-lane bridge to have that feature.

    *Surely the developers have gotten my picture somehow in this Orwellian society we live in, stuck it over their dart board, and throw darts at it after releasing an update waiting for me to slam a 50lbs stack of bug reports in their inbox. I'm only teasing but it wouldn't surprise me.

    Best wishes GamerGull - you're awesome man, I love this mod!
     
    • Like Like x 1
  7. Ai'Torror

    Ai'Torror
    Expand Collapse

    Joined:
    Aug 29, 2015
    Messages:
    1,732
    I did try to have some more unsusual fun with your traffic AI, that is see what it does on a race track. And while on hirochi raceway it works decently, on the Automation test track AI cars spawn too close (especially on the long straight) which leads to either extreme braking or pileups if the car doesn't have amazing brakes.
    One thing that could potentially help would be giving the vehicle some initial velocity on spawn, so ot would already be going like 70-80km/h in case of long straight road.
    I'm not really sure how the max speed the Ai can take at certain part of the path is calculated, but you could essentially take that and launch the car in the direction of the path at for example 30km/h less than the max speed. But then one more issue comes in mind, that is the fact cars start in 1st gear, which isn't a problem if you start from 0km/h, but at 200km/h that would either spin the car, blow up the engine or both, so the car would also need to be forced into the highest gear possible.
    Also a good idea would be to calculate "max possible vehicle speed" which would be just calculated off the gearing and max engine rpm, or top speed value from the info_configname.json file if the author of the config did performance testing on it.
     
    • Agree Agree x 2
  8. Cop

    Cop
    Expand Collapse

    Joined:
    Jul 15, 2018
    Messages:
    65
    Its okay. I hope my questions weren't too much
     
  9. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    2,277
    Could just keep the velocity of the vehicle from when it's warped out to when it's warped in, provided it was going in the new correct direction it needed to be when you spawned it in. That can work, but I will leave it up to Gull to figure out. Could lead to some hilarious booboo's though. If you just query what the speed of the AI would be used for the turn ahead, it would be fine, but I doubt the game has that value ahead of time. Getting the current value might work directly after spawn-in, though.

    I have used values of 500 for spawn out, and 375 or so for spawn in on Roane County, and speeding down the highway like that, it was pretty flawless. Keep in mind higher values = less traffic as it's spread out over a higher radius (double the spawn out radius would mean 0.2~0.25x the amount of vehicle density, or something like that, my number is no-where near precise).
     
    • Agree Agree x 1
  10. EnjoyMyHItsYT

    EnjoyMyHItsYT
    Expand Collapse
    Banned

    Joined:
    Oct 9, 2016
    Messages:
    1,193
    i know it has to be Police in the Car i used the 200bx theres no Police in name but for ShowMik worked it i think
    hm..yes i turned it on i'll try it again
     
  11. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,778
    Chasing ETK800 with a semi, lost it, but AI lost control too, counts as a busted? :D
    upload_2019-3-19_16-3-41.png

    Chasing 'bad guy' in traffic is probably most fun thing to do in this game, I wonder if developers get any work done with this tool around :D

    I guess there can be new game mode based on this, where you choose vehicle and vehicle you chase, then it spawn traffic, bad guy and your chosen car.
     
  12. Gamergull

    Gamergull
    Expand Collapse
    Staff Member

    Joined:
    Jun 3, 2018
    Messages:
    295
    Hmm, that's a great idea. By taking advantage of the fact that setting only the position of a vehicle lets it keep momentum, and calculating a quick vector dot product, this could really work. I'd have to test how problematic it could be around turns and other situations.

    Haha, I've spent too many hours setting up new situations and losing track of time due to sheer fun. Hard to resist!

    Version 1.1.1 is on its way. Bug fixes, plus a little secret feature, thanks to some inspiration.
     
    • Like Like x 3
  13. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    2,277
    Well yes, it should be easy enough to do, seeing as you can free-cam and place a car where you are so as-it-is with the default game - this should be easy to replicate with a few strings of code. You could simply aim the vehicle in the direction the road goes, like you normally do, and instead of halting it's momentum, just face it properly, and change the momentum *I am not sure if the game will support this* (can you even 'get' that value?). Maybe you could get the momentum and set the momentum with the next line, in it's new direction as-per the road, after the vehicle position is updated. Worst case is, you'll have a car flying off the outside of a turn, but that's better than vehicles stopping all the time. Or you could have a check-box that would say 'speed limit = spawn speed' that would merely use that.
    The good is that it would work great on the highway. There's another deal though.
    We should be able to create some 'zones' like game-play zones in the f1 object editor can control the audio whether there is an echo or not (for tunnels) and also how it controls the background lighting fill (again, for tunnels, so it gets dark). These ZONES could be used for say 'global speed 35mph or 30mph' etc. This would be where the speed limit on the app gets overridden.
    For other places, maybe we could set a value on the road based on the amount of lanes - for example, we could do 70mph on the highways with two lanes, but 45 or 50mph on single-lane bi-directional roads (just one lane each side with a double-yellow), but we'd need cooperation from the other developers on the team to give the roads a speed limit setting.
    A global map speed setting for roads inside of the map could be set in a new field on THELEVELINFO object inside the f1 object editor, used when no value is given on the decal road (there should be an option to not set it, so you don't have to set every last one).
    The app would have to be able to also handle conflicting info, like the speed being set on the decal road (for roads coming into a town, partially going into a speed zone box) so it did not crash. The priority of speed settings taking affect could be SPEED ZONE (like explained above for towns), Decal road speed value, map default value. Where you could have an option then to over-ride all these values for a specific speed. A drop down box could handle all possible combinations of what speed to use and when. Obviously emergency vehicles would be immune to speed limits while giving chase or responding to a criminal / emergency incident.

    IF you need some picture examples, this I could entirely do.

    There would have to be an 'exempt from speed zones' on decal roads, too, so that highways going through town (like Los Injurus) wouldn't get caught by the 40mph speed zone in the town.

    Also, I posted an image of the values I used in the Roane County discussion thread for the spawn tool in the traffictool.lua file, including the 1.1 version itself (i told them to make sure to match versions), so you might want to have a look at it. Traffic is more sparse with my settings, but cruising the highway is a beauty.

    Exemptions could be made on a per-vehicle basis, so that in the event you want to make a mission to chase 1 specific vehicle that would not respawn etc, such as chasing a criminal with a police vehicle, they obviously wouldn't be following the speed limits. I wouldn't know how to handle that though.

    Seriously, though, you're on to something big, and obviously the developers know this, as you're one of them (good job! you earned it!), please forward this info to the rest of the team, thanks! I really look forward to what you're coming up with - and if they ever want someone in the 98th percentile intelligence-wise, I'm totally game too. I can't code like you (well I can change values and read script) but I can sure pack a lot of fun into a map, model buildings, and make textures.

    If the editor is changed to give some of these new values, I will quite happily re-update Roane County TN (which still hasn't been updated on the repo yet, it should be any day), as much as necessary.
     
    #333 bob.blunderton, Mar 20, 2019
    Last edited: Mar 20, 2019
  14. Cop

    Cop
    Expand Collapse

    Joined:
    Jul 15, 2018
    Messages:
    65
    Looking Forward to see it.

    Say, Think it might be possible to bust other drivers as Cop? And just curious, what causes the Police to lose you?
     
  15. Gamergull

    Gamergull
    Expand Collapse
    Staff Member

    Joined:
    Jun 3, 2018
    Messages:
    295
    Gamergull updated Traffic Tool with a new update entry:

    Version 1.1.1

    Read the rest of this update entry...
     
    • Like Like x 2
  16. Xela

    Xela
    Expand Collapse

    Joined:
    Aug 31, 2017
    Messages:
    3
    i'll try this out right now! is the secret a little obvious or will it make me search in the code? x)


    edit: even if it's the little asterisk, it's crazy but no doubt this is something else
     
    #336 Xela, Mar 20, 2019
    Last edited: Mar 20, 2019
  17. Gamergull

    Gamergull
    Expand Collapse
    Staff Member

    Joined:
    Jun 3, 2018
    Messages:
    295
    Thanks for the insightful comment, I read it all and can pass some info on! Quick point, though; it's not possible to simply "set" the momentum of a vehicle, only keep it from its previous state, due to how the physics are handled. I'm not sure if this behavior is from the C++ side of the game engine, but perhaps I'll get back to you with a more in depth answer later.

    Maybe. And police lose you if you stay out of their chase range for 40 seconds in a row. Driving offroad can be a good trick!

    It can be rare to happen upon, but it's possible to read it in the code :p .
     
  18. Motherhazel

    Motherhazel
    Expand Collapse

    Joined:
    Dec 5, 2013
    Messages:
    40
    "Staff member"

    I like that! :p
     
  19. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    2,277
    A thruster can change momentum, but that's really a 'hacky-fix' and unprofessional, not what you need...
    Well if a vehicle had 100% of its momentum, you spawned it on a road 45 degrees different, simply take off half or three-quarters of it's momentum. Stopped/starting from stand-still traffic is better than traffic ending up in the thicket & not being on the road.
    FWIW I believe GTA IV's or SA's traffic did not always spawn in moving IIRC. Not 100% on that as I've seen traffic come in stopped and also moving depending on areas.

    Best of luck on that. I am glad you have a good knowledge of this also. I'd be a bit lost here. I just know how other games work.

    @Motherhazel your icon actually breaks the law* here in Tennessee USA, please change it to something less 'risky' (or pixelate / put a censor box over the XXX regions). I won't report you, but others might - and there are many children on this forum so that's not something for their eyes!
    *yes it actually constitutes breach of law for viewing or possessing pictures, video, or material otherwise in-line with XXX material on the computer, I likely wouldn't care otherwise.
     
  20. Cop

    Cop
    Expand Collapse

    Joined:
    Jul 15, 2018
    Messages:
    65
    I see. Apart from speeding, driving not on the road activates them too? I got busted once for respawning my car. Why I thought of being able to bust other drivers, this might give the Al react towards sirens move sense and would be nice to be the cop with your mod. Or seeing Al chasing/busting Al.

    No offense, but thing that I find anying is that they run streight into you when yo slow down/stop, than to match your speed. I mean, what's the point in pulling over if they ram you anyway?
     
  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