Search Unity

Road & Traffic System

Discussion in 'Assets and Asset Store' started by wireddev, Aug 25, 2014.

?

Wondering if this is something that people are interested in purchasing?

  1. Yes

    88 vote(s)
    85.4%
  2. No

    15 vote(s)
    14.6%
  1. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    Or She wasn't being sexist ;)
     
    OnePxl likes this.
  2. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    We will look into what a one click solution might look like and get back to you guys for feedback before implementation to make sure we cover the things you most want in an auto road network generator. Many options to consider with this one so unfortunately it isn't as simple as build an automatic one-click generation of roads... unless you want it completely random, then it might become a little easier but we will see.
     
  3. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    I'm not particularly interested in a one-click solution, I'd like to program one myself. If I understand it correctly, I have to set up road pieces with nodes beforehand, then connect them in the editor. If this can be done in code, during runtime, that'd be great. Is that possible with the current version?
     
  4. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    If you are setting up your own road pieces then yes the nodes need to also be setup. If you are using the pieces that come with the package then all you need to do is use the custom editor to spawn and link the road pieces to form your road network in the editor which is super easy. As for run-time, you can also code your own solution to create the road network at run-time but it will be something we look into in the future for those wanting to generate road networks on the fly.
     
  5. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    I will be using my own road pieces, yes. After I've defined nodes on them, can I simply place them one after another in code, and call some functions to connect them up?
     
  6. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    It is a little more complicated than that as you need to determine where you want to make the link in code ... something simple as Straight Road Pieces can be difficult to determine the links in code due to some might need to be flipped to connect with opposite lanes depending on how they are built, also there is an offset value for all road pieces that can be used to connect road pieces that are not perfectly square (take corners for example). Also intersections are difficult as you need to determine which entry and exit point of the intersection needs to connect with what other road pieces you want since there are 3 or 4 entry / exit points to an intersection.

    Unfortunately it isn't a simple solution... it can be done but the customer tools we have currently in the editor take care of all this for the user and makes it easy for them to connect anything together. Doing that 100% procedurally might be rather difficult.
     
  7. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    We've been busy updating the features of our Road & Traffic System for Unity3D and have a BIG update on the way. (Take a look below!)

    Update includes:
    - ALL NEW road pieces in High Detail and Mobile Detail!

    - Roundabouts are here for 2, 4 and 6 Lanes!

    - New 2, 4 and 6 Lane corner road pieces with realistic curves.

    - AI car braking now has progressive slow down and accelerate.

    - You can enable all car front lights instantly. Perfect for night scenes. Just call the function "TrafficSystem.Instance.SetAllVehicleFrontLights( true/false )" found in the TrafficSystem.cs script

    - Road Pieces now have speed limits so vehicles can determine what speed they should be doing at certain locations on your road network. If a speed limit isn't given to a certain set of road pieces than the global "TrafficSystem.cs" m_globalSpeedLimit is used. Like everything, this can be enabled and disabled per vehicle prefab so you are not bound to using this for all or individual vehicles.

    - Reveal buttons for all links so you can display all links before connecting them (makes development of road networks very easy!)

    - All (T and Cross) Intersections and Roundabouts are fully constructed for you in 2, 4 and 6 Lane Prefabs, just drop and use!

    - Fix for collision causing cars to spin at one position constantly. This is caused by the collider of the vehicle coming in contact with the collider on the ground. All cases can be sorted by setting the "Offset Pos Val" of a vehicle "under" the lowest point of the vehicle so that the vehicle collider never really comes in contact with the ground while still looks like it is driving on the road. There is a nice little yellow square representing the Offset Pos Val in the editor now to make things super easy to tune.

    - Many more smaller improvements to help with road network construction and custom vehicle construction.

     
    john-essy and hopeful like this.
  8. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Sounds like a lot of improvements, the new video looks great! Looks like you guys are putting in tons of work to take this asset to the next level.

    Just wondering on the state of some other requests:

    1. Front wheeling turning

    2. Random pedestrian system

    3. One-click random road network generation

    Also, I would like to request a couple additional improvements:

    A. Slight variation in lane position, so cars don't follow each other exactly on the same line

    B. Slight variation of speed in cars, so cars don't move at exactly the same speed behind each other

    Great job, and keep up the great work!
     
  9. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    Aw crap.
     
  10. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    I agree with most of these points.

    I'm all for the devs adding a small random influence to vehicle behaviors, such as a variable short pause for headlight switching (so all vehicle lights don't go on or off precisely in unison), position within lane (left or right of center), acceleration rate, braking rate, and variable travel speed (+/- a little bit in relation to the speed limit). That would help the scripts better simulate real driving while keeping the code efficient.

    While it would be great to have a pedestrian system, I'm thinking it may be that this is something that should be left up to individual game devs using AI and waypoints. What's important is to have some hooks into the R&T system, such as a cue as to when to use the crosswalk. If I remember correctly, there's already a sort of means for getting a car to avoid a pedestrian (by making the pedestrian appear to be another car). Possibly this would need some tinkering.

    As for turning the front wheels or road network generation ... maybe those are best left for other plugins? I've not really delved into any of the Unity car kits, but they look like they have comprehensive solutions for car physics, including proper manipulation of wheels. I'm thinking in my own game I would probably want to have cars that are distant from the camera using as few features as possible - like just the plain vanilla R&T AI - then cars that are near the camera (such as the player car and any rival cars) could be running some more advanced physics and AI scripts, and maybe spotlights for headlights and reflective shaders and so on.

    Again, maybe R&T can do a little to facilitate such hand-offs by making it easy to run their traffic AI in conjunction with third party car physics scripts. It's already set up to recognize and avoid player cars on the road, and any player car will soon be able to check the speed limit of the road. A player car might also be able to tell what color the traffic light is when they approach an intersection. It would be good to be able to hook that, so if a player car enters the intersection on red it could be flagged by the game and the police sent in pursuit. ;)
     
  11. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138

    1. Front wheeling turning
    - not in this coming update

    2. Random pedestrian system
    - Started but not in this coming update. We have constructed all the new road models to include footpaths and crossing textures to be ready for when this does go live.

    3. One-click random road network generation
    - This one we need to find time for as we have a lot of other commitments with R&T at the moment to get in.

    Also, I would like to request a couple additional improvements:
    A. Slight variation in lane position, so cars don't follow each other exactly on the same line
    B. Slight variation of speed in cars, so cars don't move at exactly the same speed behind each other
    - Requests granted and they are already in this next update ;)
     
    Last edited: Jan 30, 2015
    hopeful likes this.
  12. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Added in the next update.
     
    hopeful likes this.
  13. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Version 2.0 of the Road & Traffic System is live! Hope you all enjoy the massive update and we look forward to seeing how you use this in your projects: http://www.assetstore.unity3d.com/en/#!/content/21626

    Plenty more features and updates to come!

    New Webplayer and Android demo is live which can be found on our official website: http://wireddevelopments.com/trafficsystem

    We will be updating the documentation to reflect all the new features and updates VERY SHORTLY! Just finalizing all the video tutorials...
     
    MarcusWatson and hopeful like this.
  14. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    I don't know if you've got the latest build running on your website demo, but I noticed a few odd things:

    1) Cars automatically stop at intersections even when the light is green, when they could go right through.

    2) Cars will not enter an intersection on yellow. (In real life they go faster. lol)

    3) A traffic light I was watching worked normally some times, but then one direction was allowed to send traffic twice in a row without letting the perpendicular lanes travel.

    4) A traffic light turned green and let one car across, then the rest that were behind that car waited till the light turned green a second time before they moved.

    5) A car I'd clicked on to follow was traveling in a straight line, but the car body kept angling left and then straight again as though it thought it was negotiating left turns.

    6) Turns for long vehicles like school buses look very rough and probably need some sort of tweak. If it's not too inefficient, probably all vehicles could use a smoother turn.
     
  15. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Also, vehicles stop way too suddenly. I almost get whiplash just looking at them come to a stop. They should gradually slow down before stopping.

    But they accelerate smoothly from a standstill... that part looks very realistic.
     
  16. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Yep, most of these are addressed already in 2.0.1.

    1) and 2) are in the details below.
    3) Is due to having a priority queue to process turning vehicles so what you were not seeing was the Traffic Lights giving a green light to these vehicles wanting to turn ... we have added Traffic Light Arrows for the turning lanes now so you can clearing see why this is happening.
    4) It is to do with waiting for the lights to allow the turning vehicle to have priority to turn. You will see this more on 2 lanes than 4 or 6. The Traffic Light Arrows and vehicle blinkers allow for a visual indication of what is going on but the real solution is to have a side turning lane which we are looking to put in an update soon.
    5) Yes we have seen this bug recently... we will hunt it down and squish it ;)
    6) Yes we are looking into the best option to interpolate between node points or generate a spline based on the node curve layout to allow for a smoother turn. Will keep you all updated on the progress of this.
     
    hopeful likes this.
  17. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Yes, it is on the list to improve... don't want our drivers getting whiplash ;)
     
    John3D likes this.
  18. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Submitted for review version 2.0.1
    - Traffic Lights now have arrows for all turning lanes
    - Slight variation in lane position, so cars don't follow each other exactly on the same line
    - Slight variation of speed in cars, so cars don't move at exactly the same speed behind each other
    - Cars now have the option to automatically check at intersections to make sure the intersection is clear. It was set to true by default to allow for tight road networks to function properly but we have created an option for this in the TrafficSystemIntersection.cs script (check/uncheck “Ignore Can Fit Across Intersection Check”) to relax this check as users might not need it.
    - Cars will randomly enter an intersection on yellow to provide additional realistic simulation
    - A TrafficSystemCameraFollow.cs class is added to provide customisable camera following functionality so users can attach a camera to any spawned vehicle and toggle through them to follow the vehicle. (current keys to toggle are ‘,’ or ‘.’ or you can click on a vehicle in the scene to follow it, provided the script is in your current scene.
    - A TrafficSystemVehiclePlayerAuto.cs script is added to allow users to control an AI car with directions on where the car should go when it gets to multiple directions… Google wanted this one ;)

     
    Last edited: Feb 4, 2015
    John3D, MarcusWatson and hopeful like this.
  19. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    hopeful likes this.
  20. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    Hi there,

    I have a question,

    I am using you demo scene as testing for other parts of my game for mobile. When i create around 15-25 vehicles my FPS drops from 30FPS to around 14? I am using the samsung galaxy s3 as my base device. Do you have any advice to get the FPS higher?
     
  21. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Hi John, what do you get when you install the Android Demo from our website as this is the demo scene you should be seeing in the package? http://wireddevelopments.com/trafficsystem/

    There are a few things that could play the part in lower FPS. One in particular would be rendering everything at once. In our demo scene on an S3 if you get to the corner of the map and look over the entire scene you will see it drop between 20(ish) to 30(ish) FPS but that is because it is rendering the entire scene (all road pieces and all vehicles which should be more than 15-25 vehicle at once).

    Have you added anything to our demo scene?
     
  22. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    I added my own vehicles, Thing is i am only rendering MAX 70 Drawcalls and Max 47K Tris as this is the main thing we keep an eye on when testing our games.

    We have it setup to generate a level so in some cases we have around 100 drawcalls and 70K tris and it still runs perfectly fine.

    I don't know if this is the issue but at the start of each of our levels we Call your method to create all cars at once at random nodes. But we set the value of traffic between 0.1 - 0.5 and we have 108 Road peices in your demo scene as we collect all this data aswell.

    It is probably something i am doing tbh will look into it and get back to you. I haven't tested your android demo actually gonna give that a look.

    Thanks
     
  23. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    Just tested the demo on my S3 and it runs at 14-16 FPS nearlly the exact same as my test.
     
  24. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    Sorry for Spamming it seems to have flattened out at 20 FPS after initial play and with shadows off.
     
  25. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    The demo scene rendering everything on a Samsung Galaxy S3 (model GT- I9300, Android Version 4.1.2) results in the following:

    Shadows ON - 20 FPS
    Shadows OFF - 30 FPS
    Note, this is rendering everything, all cars and road pieces for the entire scene. Higher FPS as the large amount of cars are reduced (even slightly).

    Maybe do a test with and without cars, then with and without the road models enabled to determine how much FPS you are losing with either so we might be able to determine a solution for you.
     
  26. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    Will do mate, will let you know on monday. Thanks for the reply.
     
  27. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    Hey man, i know its been longer than i said but have been super busy, I done the tests and found that it is the traffic system that is slowing me down from an avg of 34 FPS with road peices, buildings, without shadows, then i play a level with the traffic and it slows right down to 18 fps im losing nearlly half my FPS with having traffic enabled.

    Again i have probably set something up wrong or something along those lines but any help would be greatly appreciated.
     
  28. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    My guess is that you need some sort of occlusion so you're not rendering things that aren't being seen ...? It's hard to imagine that the R&T scripts are taking up so much processing, but I suppose it is possible.
     
  29. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Could you post an image of what you are seeing at the time of 18 FPS?
     
  30. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    I can send you a test build if you like mate? So you can see exactly what is going on?
     
  31. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Yes that will work. Contact us through our support email and we can sort it out a little quicker.
    http://wireddevelopments.com/ ... under "About Us"
     
  32. Archestratidas

    Archestratidas

    Joined:
    Feb 1, 2015
    Posts:
    10
    Hello,

    I'm interested in a road system and recently saw your product on the asset store. I have a few questions if you don't mind.

    1) I'd like to know if this works at runtime--that is, whether or not road pieces can be placed at runtime by an end user (e.g., a player trying to lay down a new road during play) and have those pieces integrate with roads placed while in the editor during build.

    2) I'd also like to know if your system can be extended to create a railroad-type 'road' such that road vehicles won't use the rail system and trains won't use the road system.

    3) Does this system work with TerrainComposer (which uses the basic unity terrain system, but can create multiple terrain objects that are stitched together)? Does the traffic system still work if the roads cross onto another terrain object?

    4) Is there any kind of height matching or terrain smoothing to accommodate building roads on rough/uneven/non-flat surfaces? (I have the same question regarding City Generator as well)

    5) And (finally!) is there a way to add new 'pieces' to the system, e.g., a bridge?

    Thank you for your time.
     
  33. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Hi Archestratidas,

    1) I'd like to know if this works at runtime--that is, whether or not road pieces can be placed at runtime by an end user (e.g., a player trying to lay down a new road during play) and have those pieces integrate with roads placed while in the editor during build.
    WD: At the current time the Road & Traffic System is only customized via the Unity Editor. This is changing in the future but is still a little way off yet.

    2) I'd also like to know if your system can be extended to create a railroad-type 'road' such that road vehicles won't use the rail system and trains won't use the road system.
    WD: Yes this is possible, let me explain in detail.
    A. you would obviously need railroad custom pieces in additional to the default road pieces that come with the package. Making these are easy and you can find the "14. How to create a custom road piece" video here: http://wireddevelopments.com/trafficsystem/documentation.php#14
    B. Vehicles are really just gameobjects that follow the road node paths so "a vehicle" doesn't have to be a car, it can be anything you want so trains would work fine.
    C. In order to make sure cars don't use railroads and trains don't use roads you just don't link the two networks together. The railroad is connected only to rail pieces and the road is only connected to road pieces.
    D. If you wanted "crossings" so that cars stopped when trains were passing from a certain distance away from the rail crossing then we would need to put this on the feature list for you as this doesn't exist.

    3) Does this system work with TerrainComposer (which uses the basic unity terrain system, but can create multiple terrain objects that are stitched together)? Does the traffic system still work if the roads cross onto another terrain object?
    WD: The traffic system is completely separate to any other system and therefore should work if you put it anywhere. What won't work is if you have your vehicles colliding with terrain and the road network is under the terrain collision as the vehicles won't be able to read the nodes that are positioned under the terrain. Road & Traffic System is best with flat terrain areas where you build up the terrain around it.

    4) Is there any kind of height matching or terrain smoothing to accommodate building roads on rough/uneven/non-flat surfaces? (I have the same question regarding City Generator as well)
    WD: See answer to (3)

    5) And (finally!) is there a way to add new 'pieces' to the system, e.g., a bridge?
    WD: Yes, see answer to (2.A)
     
  34. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    hopeful likes this.
  35. Archestratidas

    Archestratidas

    Joined:
    Feb 1, 2015
    Posts:
    10
    Is it possible to add some sort of mesh deformation to the road pieces so they match the terrain beneath it? Something along the lines of what this asset did?
     
  36. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Unfortunately not as the new detailed (version 2) road pieces are not as simple as a flat plane to deform like in that video.
     
  37. pab

    pab

    Joined:
    Jul 2, 2013
    Posts:
    6
    Hello -

    I have read posts on the forum and looked at videos. But I would like to be certain that you can set up your system for a left hand drive system. The traffic light prefabs all seem to be right hand drive only.
     
    hopeful and MarcusWatson like this.
  38. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    I made a new road the other day and noticed nearlly strait away that the road pieces do not match up correctly. To get them matching up correctly you have to manually scale them and even then you get flickering with overlapping etc? So they are not tile pieces.
     
    Last edited: Mar 29, 2015
  39. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    Any update on the automatic road generation? The thread has seemed to have died,
     
  40. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    Keep in mind @wireddev may not be getting pinged by the forum. If you need assistance right away, try a PM or the contact info.
     
  41. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    True

    Were there any plans to integrate the traffic system into the upcoming easyroads3d v3? That would be lovely
     
  42. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    I suggested they look into getting their system working with EasyRoads right around the time ER3D entered beta testing. However, it's been many months and ER3D is still in beta, and I believe R&T is holding off on any firm moves on integration till after ER3D gets out of beta.

    So ... my impression is that at this point they're only looking into it.
     
  43. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    575
    is this pack unity 5 ready
     
  44. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    Yup sure is.
     
  45. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    575
    it gave a warning in the bying button on the store, its on promotion today
     
  46. ruuno

    ruuno

    Joined:
    Oct 28, 2012
    Posts:
    4
    Is this compatible with Unity 5?

    Nevermind! Saw the post from just a little earlier!
     
  47. jackburf

    jackburf

    Joined:
    May 7, 2013
    Posts:
    9
    Hi WiredDev,

    Just bought this asset in the sale, it looks great and the documentation is outstanding!
    I was wondering however, is there a chance of including a version of the car control script which acts as input for the car physics solution 'Edy's Vehicle Physics' in the next update? One which mantains the navigation AI of the current script, but provides steering and speed information to the EVP script.

    Just thought it would be a cool mash-up.
     
  48. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Sorry, this is still on the wish list at the moment until we finish a few additional developments.
     
  49. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    We are waiting to see what they develop in v3 to determine if it is possible / or makes sense to plugin Road & Traffic System into it.
     
  50. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Yes, we have tested on Unity 5 and all works fine. If you find anything wrong with the package, please contact us immediately via our support form at http://www.wireddevelopments.com so we can implement a fix.