Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    We have just announced our newest plugin that works well with Road & Traffic System. It's called "City Generator"... check out all the information and video here: http://wireddevelopments.com/citygenerator/ (sorry the video does go on a bit but it list all the information you need to know!)
     
  2. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Thanks wireddev! Will the City Generator be sold in the Asset store?

    Can cities be generated at runtime?

    If so, mobile performance?
     
  3. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    It sure will be... we have just submitted it so waiting on Unity to approve it. Once approved you will be able to purchase it on the asset store.

    As for generating cities at runtime, you currently need to generate cities via the editor but if that functionality was wanted we could definitely add that in.

    Mobile performance for generating a grid of objects will be determined by the size of the grid you wish to generate and your objects you plan on using. Obviously a 50 x 50 grid will be fast on mobile where a 5000 x 5000 grid will chug along.
     
  4. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Thanks! Would appreciate some tests, demos or benchmarks on mobile if you are able!
     
  5. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    With City Generator, currently you generate object grids / cities via the editor for your games, so it is kind of hard to benchmark anything for mobile on our side. The only reason it wouldn't run on mobile is if your models you are using were not weaked for mobile (super high polygon and/or using advanced shaders) or you generate a massive layout of objects with the system and have a massive far clipping plane so that it renders the entire scene constantly.

    * also might be worth taking any City Generator conversation to its forum here: http://forum.unity3d.com/threads/city-generator.279176/
     
  6. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Thanks for this guys, this was a big help!
     
  7. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
  8. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    City Generator just released! Purchase on the Asset Store here.
     
  9. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    If anyone wants to see City Generator and Road & Traffic System working together then here is a little video for you!

     
  10. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Thanks for the video! Looks nice.

    I have a question about the traffic lights... if I create a road network that has no intersections, will there be no traffic lights generated?

    Let's say I want to make a medieval village with old huts and a dirt road. The vehicles would be horse-driven carts. Of course traffic lights didn't exist back then so I wouldn't want any to show up. Thanks for your continuous fast feedback!
     
  11. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
  12. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Not a problem, you can add 4-Way Intersections and T Junctions / Intersections with or without Traffic Lights, both options are there.

    To achieve your medieval look, all you will need is to change the texture on the material for the road pieces... check out "11. How to change the appearance of your road" on the video tutorials page here.
     
  13. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    This looks very interesting. How does this compare to Road Architect?
     
  14. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,717
    Two totally different products, so far as I can see. Road Architect was more like Easy Roads: a tool for making roads and bridges, and maybe simple intersections. This product is for AI, guiding your cars along whatever roads you want to use (with some road tiles supplied in the kit). As noted just above, you could even use this smart waypoint-type system to direct medieval traffic along dirt roads.
     
  15. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Can you use Road Architect or EasyRoads3D roads as the basis for Road and Traffic System?
     
  16. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    4-Way Intersections and T Intersections just got a WHOLE LOT EASIER! We have created new prefabs that you can just drop in and use easily and very quickly. You can rotate them, flip lanes, flip directions ...etc everything you usually do with any road piece. Hope it helps speed up your road network creation! (coming in update v1.0.6 which has just been submitted)

     
    eridani likes this.
  17. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,717
    This AI supports realistic intersections of 3 lanes each way, with one or two left turn storage lanes, right? Just checking.
     
  18. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    There are no prefabs created "yet" for this but it absolutely can be done. You can have as many lanes going every which way you want them too. A good video to check out is the "14. How to create a custom road piece" found on the documentation page.
     
    Last edited: Nov 22, 2014
    hopeful likes this.
  19. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    I was just looking at that video and it looks good.
     
  20. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    How will the intersections work with prefabs? Just litrally drag and drop?
     
  21. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    228
    I have a fes questions:
    - Can I add or remove Lane Prefabs at runtime to change my traffic system?
    - I see only very "hard" curves in your webplayer demo. Is it possible to make not-90° curves? Is there some sort of spline-system to let vehicles drive more smoothly in curves?
    - Does it support roundabout traffic? Or can I make my own roundabout prefab with it or is there any programming limits which could interfer?
    - Is there any help in implementing crossroads and pedestriants crossing the road?
     
    Last edited: Nov 26, 2014
    eridani likes this.
  22. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    You can drag and drop the prefab if you wish but it is very easy to use our custom built system to place each prefab as it comes with a range of options to help connect all the prefabs together. With the newly created "connected" T intersection and 4-way intersections you only need to link your surrounding road pieces that connect up to the T intersection or 4-Way intersection. This saves you a lot of time not having to connect all the intricate intersection nodes together.
     
  23. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    A pedestrian system is in the works.
     
    eridani, hopeful, john-essy and 2 others like this.
  24. GAMEQUAD

    GAMEQUAD

    Joined:
    Dec 4, 2014
    Posts:
    1
    How can I add automatically creating a mesh collider for the road?
     
  25. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    If you put a mesh collider (any collider) on a road piece prefab it will be generated when instantiated / spawned in the editor. If that isn't what you are looking for please explain the question further.
     
  26. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    v 1.0.9 - New update on the way!


    • Spawn random vehicles on startup. Just slide the custom editor to fill 1% to 100% of your road network on startup!
    • Option to kill the vehicle when they have no path (TrafficSystemVehicle.cs)
    • Wheel rotation now has a multiplier that users can tweak so wheel rotation speeds are correct for larger or smaller wheels.
    • Front headlights added.
    • Vehicles fitted with Audio Source and engine sounds + horn sounds (new audio clips)
    • Option to activate flashing lights and horn on AI vehicle crash
    • Crash collision fixed (TrafficSystemVehicle.cs)
    • Spawners now pool the total amount of vehicles to be spawned on initial run-time so there is no overhead of Instantiation during gameplay (TrafficSystemVehicle.cs)
    • Pathing bugs fixed for larger vehicles.
    • New Offset Pos Val on TrafficSystemVehicle.cs script with yellow visual indicator to determine how far off the ground a vehicle should be pathing.
    Currently in submission with the Asset Store now!
     
    hopeful likes this.
  27. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,717
    Front headlights are added, but is there an easy way to turn them all on when you want, like when your scene clock heads into night?

    The new update sounds great! :)
     
  28. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    No, but we will add that to the next update!
     
    hopeful likes this.
  29. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,717
    I appreciate it. :)

    Best to have an option to turn all the lights on at once (for, say, the beginning of a scene at night) or to have them obey some fuzzy logic to turn on over a short (user selected) period of time.
     
  30. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Can the wheels on the cars be made to turn left or right as the cars turn left or right, respectively?
     
    hopeful likes this.
  31. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,717
    EDIT: (I had a poorly worded post that was confusing, so I've re-written it.)

    If possible, I'd like to have R&T be flexible enough to respond to a player or NPC car that is operating outside the system, so that the R&T cars can see it and brake appropriately (or steer around if it is parked in the street).

    EDIT2: I see there is a script and collider we can use that helps R&T and player / NPC vehicles "see" one another, and theoretically a R&T vehicle can change lanes to get around a non-R&T vehicle in their lane ... if there is an additional lane for the R&T vehicle to move into.

    I'm not sure to what extent more is needed in this area, but I'll think about it. :)
     
    Last edited: Dec 14, 2014
    eridani likes this.
  32. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,717
    Is it possible to have the speed limit of the car embedded in the roadway?

    I'm playing around with the R&T plugin right now, and it looks like the velocity is set on the vehicle as it comes out of the spawner, remaining constant thereafter. What I'd prefer is that the road nodes pass the current desired speed to the vehicle. That way you can set one section of road to be higher speed (like a freeway) and another road to be of lower speed (like a hairpin curve or school crossing). As the car passes over the node and reads it, it picks up the new speed and accelerates or decelerates accordingly.

    I'd also like to have each vehicle alter its own speed according to something like a simple curve. So it speeds up a little, slows down a little, repeatedly, as it passes over a long stretch of road. Whenever a vehicle applies its brakes (for either a light or a pedestrian or a slower car in front) it starts the curve over again. I think this would help the vehicles simulate real traffic a little better, as they would speed up and slow down a tiny bit for reasons unrelated to traffic conditions, which is how it normally goes. Applied in combination with different acceleration and deceleration rates per vehicle type - which already exists - this ought to look great.

    Also, when cars are starting back up after having applied their brakes, it would be good to have them pause a brief variable moment before resuming their speed curve. This would simulate reaction time. Currently, I often see cars closely following another car and stopping and starting in unison, which looks a little freaky.
     
  33. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Added to the feature list Eridani. Will try to get it in the next drop.
     
    eridani likes this.
  34. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Yep you got it. Just add the TrafficSystemVehiclePlayer.cs script to any car that isn't simulated in the Traffic System network and it should become one with the system. (probably should rename the script to TrafficSystemVehicleExternal.cs ... or something appropriate for all situations. Originally it was only created for a player controlled vehicle but does work with any situation)
     
    hopeful likes this.
  35. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Thanks for the suggestions! We are already working on real simulated traffic acceleration and braking but we will definitely add the speed to the road pieces so you can create speed sections throughout your road network.
     
    hopeful likes this.
  36. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    Quick question: can't this already be done by setting up triggers, and setting a new speed for any car that hits the trigger?

    Not that I don't want you to develop the new feature!
     
  37. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Yes it can but we will add it to the system to say people having to set it up themselves with an alternate solution.
     
    hopeful likes this.
  38. IndieScapeGames

    IndieScapeGames

    Joined:
    Jul 3, 2012
    Posts:
    80
    Incredible asset!

    Have not purchased yet, but on the immediate 'to-buy' list when funds become available.
     
  39. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Thanks for the kind words ChadM... hopefully you like some of the upcoming feature updates too ;)
     
  40. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,717
    I'm trying to think of R&T in the sense of a vehicle AI, and I'm wondering if there is an easy way of getting a car that is off the road grid back onto the grid, and how to have it realize when it is back on a road and which direction to travel.

    Right now, if a car gets knocked out of line on the grid, I don't think it is capable of corrective action and it will have to self-destruct.
     
  41. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    The AI car will get a rigidbody added to it to simulate the crash and then after it settles it will take some corrective action back to the node in which it crashed at.
     
    hopeful likes this.
  42. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Version 1.0.10 is on the way! This update supports the following...
    • 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.
    • 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.
     
    hopeful likes this.
  43. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,717
    Looking forward to using the new speed limit feature! :)
     
  44. lun

    lun

    Joined:
    Dec 30, 2014
    Posts:
    4
    Hello wireddev,

    Your plugin seems very cool, I'm now plan for develop a game like "SimCity", may I know that the Road & Traffic System support runtime creation by player?

    Lun
     
  45. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Currently the custom editor for creating the road network is for the unity editor. If enough people want the runtime road creation feature than we will add it to the development list.
     
    SkyFire101 likes this.
  46. hakankaraduman

    hakankaraduman

    Joined:
    Aug 27, 2012
    Posts:
    355
    Hi,

    Is EasyRoadv3 compatibility in the work and if so when will it be out?

    Thanks
     
  47. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    No it is still on the feature list as we have new high quality road pieces coming out soon in the next updated along with some other cool features.
     
    hopeful likes this.
  48. wireddev

    wireddev

    Joined:
    Apr 22, 2013
    Posts:
    138
    Big update coming VERY SOON! Lots of cool new features to play with and best of all ... ALL NEW HIGH DETAIL ROAD PIECES!

    new_mobile_ready.png
    new-2-4-6-T-intersections.png
    new-2-4-6-intersections.png
    new-6-intersections.png
    new-corners.png
     
    hopeful likes this.
  49. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Is an option to dynamically generate a road network at runtime planned? In other words an automatic one-click generation of roads and city (with city generator). Thank you!
     
    john-essy likes this.
  50. john-essy

    john-essy

    Joined:
    Apr 17, 2011
    Posts:
    464
    ^ What he said!