Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Traffic System

Discussion in 'Assets and Asset Store' started by unityasoft, Sep 21, 2012.

?

Physics for vehicles?

  1. Create it's own physics

    11 vote(s)
    22.0%
  2. Use UnityCar 2.0 Physics

    16 vote(s)
    32.0%
  3. Edy's Vehicle Physics

    21 vote(s)
    42.0%
  4. Unity Car Tutorial Physics

    1 vote(s)
    2.0%
  5. RapidUnity Vehicle Physics

    0 vote(s)
    0.0%
  6. Other - Please specify!

    1 vote(s)
    2.0%
  1. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    A couple of us are working on a traffic system, we are wondering if anyone else would be interested in this so we can make it more flexible and powerful to suit everyone.

    Currently I made a short video of supposedly traffic control lights:


    This is just a test on how the cars interact with each other, picture that scene to have a road and traffic lights

    If you have any questions about the system feel free to leave a comment
     
    Last edited: Oct 14, 2012
  2. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    a car following the lane very smoothly, bare in mind that the road is actually 15 degrees to the right so his actually not going just straight

    birds eye view


    third person view
     
    Last edited: Sep 21, 2012
  3. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,605
    I'd be interested!
     
  4. CrazySi

    CrazySi

    Joined:
    Jun 23, 2011
    Posts:
    538
    Looks good, I'd recommend having a "spawn" feature, where you have a traffic bubble around the player so you can support very large cities.
    Also key will be ease of use for setting up roads.
     
  5. ad456m

    ad456m

    Joined:
    Jul 13, 2012
    Posts:
    5
    Is this based on waypoints and are the cars using physics? I'm working on something similar and have my traffic lights and roads working, jus fine tuning my cars before i start onto peds
     
  6. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    @ad456m This would be a completely random simulation, where the vehicle could go off road randomly but is aware that it is doing so, the vehicle would then at go back to the path when appropriate.

    Since we are trying to make the system easy to implement into a open world game, there is a lot more challenges; car chases, police activity etc.

    Way points would be good for car racing where the vehicle has a fixed path and avoid collision. But in this scenario we are attempting to create a more exciting existence.


    @carking1996 Thank you for your interest, if you have any questions feel free

    @CrazySi We are trying to figure out the best approach for busy intersections and of course how to handle 100+ vehicles, I mean I would love to be able to chase down a car all the way to the end of the mountain, but how? how can we make some vehicles stay relevant?
     
  7. ad456m

    ad456m

    Joined:
    Jul 13, 2012
    Posts:
    5
    Sounds nice! A lot more robust than mine will likely end up, i just have the random choice of route, no pathfinding whatsoever other than where the road goes. I will be keeping an eye on this to see how you get on.
     
  8. CrazySi

    CrazySi

    Joined:
    Jun 23, 2011
    Posts:
    538
    So can you just spawn vehicles at random within say 500m (but not closer than 400m) to the human player, any vehicles that leave this region get removed and respawned.

    For roads setup what I would do is have each single road section have 2 invisble nodes that are placed on entry and exit points. Intersections have 4, T junctions have 3. Nodes that are close are judged by the vehicle as connected. Vehicles can travel to right or left of nodes depending on if going from entry to exit or vice versa.

    A "traffic light" switches nodes on and off at will. Vehicles only travel on enabled nodes and will come to a stop if there are no more nodes. A traffic light can control the junctions this way.

    For special cases like police and getaway vehicles - well these obviously dont obey traffic laws. So they just use whatever node they feel like all the while trying to avoid the other vehicles, perhaps using a raycast mechanism.
     
  9. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,605
    Any updates?
     
  10. UnleadedGames

    UnleadedGames

    Joined:
    Feb 17, 2008
    Posts:
    242
    I currently need a solution like this, I would be all over it!
     
  11. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    705
    looking good - especially this grassy car :)
    mainly you use raycast or something different?
     
  12. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    Hello guys,

    Right now I personally have been working on the traffic simulator at least 9 hours a day, so far I've made a little progress.

    The reason why it's currently taking so long to get past first base is because I want this to be a traffic simulator that can also be driven by players as well as NPC's. Where as a player walks over to a car he can steal it. A NPC can walk over to the car and steal it.





    Heres what I can promise will be included:
    Source code, same price... I dont like the idea of selling source separately
    Support - I will over work on support once its released
    Updates - we will constantly try and improve it, way past perfection.
    lots more....Brain isnt functioning at full capacity atm lol





    @reddotgames
    I'm glad your interested in the grassy car haha.... I've actually moved on from the grassy car already!
    I'm including raycast's where needed


    @carking1996
    Yes boss I'm over doing it =D

    @UnleadedGames
    Thank you for your enthusiasm man, I really appreciate it



    Thank you guys
     
    Last edited: Oct 1, 2012
  13. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,605
    Will be waiting for it. Although myself personally wouldn't need the car stealing.
     
  14. Ecocide

    Ecocide

    Joined:
    Aug 4, 2011
    Posts:
    293
    First of all, I am very interested and I think this is a great base to go on with! I wrote a PM to you, shiftyz :)

    I'm looking forward to see more of it soon! Thanks for sharing :)
     
  15. UnleadedGames

    UnleadedGames

    Joined:
    Feb 17, 2008
    Posts:
    242
    Big question for me, will this be an independent system with its own physics, or will we be able to integrate with say UnityCar/Edys/Unity Tutorial rigged cars?
     
  16. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    @UnleashedGames
    Maybe thats a question you can answer, would you guys rather it uses its own physics, or a preferred existing one? just let me know asap though

    @Rattlehead
    Yeah thanks i got the PM, its pretty complicated so I'll reply tomorrow afternoon .. off to bed now. Thanks for your interest man

    @carking1996
    That's fine, but i think some people would love it.



    Any suggestions on price?
     
  17. Ecocide

    Ecocide

    Joined:
    Aug 4, 2011
    Posts:
    293
    Ok, no problem. Thanks for your effort!

    I think it should have pretty easy and therefore fast physics, so you can have 100+ vehicles driving around without performance issues. High end physics for AI cars are pretty senseless (Exceptions prove the rule).
     
  18. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    I made a new video of a test with some new physics it's really nothing special but just to keep everyone up to date.

    The AI here has learnt that the road is important, but doesn't know which direction to go in, next is laning.

    please watch in high quality and ignore the clock on the top left.. its just something else im working on

     
    Last edited: Oct 3, 2012
  19. Ecocide

    Ecocide

    Joined:
    Aug 4, 2011
    Posts:
    293
    Thanks for keeping us up to date!
    Looking forward to see the AI stay in the same lane :D
     
  20. CrazySi

    CrazySi

    Joined:
    Jun 23, 2011
    Posts:
    538
    This implies you are using machine learning techniques, eg ANN.
    Or this just your way of saying: I have programmed it to follow roads.
     
  21. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    No no neurals nets here, I haven't tried using neurals so I cant judge by it but it maybe possible. I have programmed it all
     
  22. NewDeveloper

    NewDeveloper

    Joined:
    Aug 25, 2012
    Posts:
    153
    This is really good, looking as Traffic Edit, but really, you have to learn how to make trailers!!! :)
     
  23. Ecocide

    Ecocide

    Joined:
    Aug 4, 2011
    Posts:
    293
    Well, I'm pretty sure it's not supposed to be a trailer. Just something to quickly show the progress and I really like that :)
     
  24. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    @NewDevelopers -

    Thank you for your feedback, I'm not entirely sure what you mean by Traffic Edit. Currently theres nothing to see here so I really don't have anything to make a trailer for! lol it's really in early development

    @rattlehead -
    thanks for clearing that up, I couldn't have said it better myself
     
  25. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    Guys please take this poll regarding what physics to use, bare in mind if you choose third party physics you would have to buy it separately.

    This will help me finalize which physics to use before I dive into that part, please think carefully and leave a comment.
     
  26. jorjdboss

    jorjdboss

    Joined:
    Dec 25, 2011
    Posts:
    68
    Why not make the system physics independent? Most physics need only throttle-brake and steering inputs which are normalized.

    This way you can implement LODs for physics. For example: near vehicle use Edy's or UnityCar, far vehicles use wheel-collider vehicles, 'out of view' vehicles follow a spline. This may enable you to support mobile platforms as well.
     
  27. Ecocide

    Ecocide

    Joined:
    Aug 4, 2011
    Posts:
    293
    Honestly, I don't get the point of implementing highly detailed physics like Unity Car for traffic cars. Car tutorial physics are really enough for that.

    When it comes to the players car (if you do something in GTA style) it would be great to have a choice between some well-known physics. So if someone purchase your asset he/she can choose what physics to use.
     
  28. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    I'm going to get this for sure, I can't wait for it's release.;) Your system looks full of promise, and is perfect for an upcoming project we've been contemplating.
     
  29. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    A lot has happened recently so I haven't been posting or replying to PM's. I apologize for the delay, the development is going very fast right now, I will be posting shortly with a new video etc.

    - Using own physics.
     
  30. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    looks interesting. Would it mean though that we would have to use your car physics and not other packages?
     
  31. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,663
    Can't wait to see how it turns out! Count me in for a purchase.
     
  32. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,888
    If this gets good enough, I may consider a purchase, as long as I can implement it into projects easily, and create speed limits.
     
  33. ZiadJ

    ZiadJ

    Joined:
    Sep 3, 2011
    Posts:
    62
    "... the development is going very fast right now, I will be posting shortly with a new video etc."

    Hope this still stands...
     
  34. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    Hello guys, I've recently moved houses and I haven't had time to even come close to unity for a while since about 2 weeks since i last posted.

    I will be replying to all PM's and emails tonight, I do truly apologize if anyone thinks they were ignored, I did read all the messages but I haven't had time to reply to them formally.

    I'll be back on the project by tomorrow

    Thank you for the support

    -

    Btw I have 100% decided to create physics from scratch (unless I can combine some examples or anything free you guys can think of)

    So this means at the start the physics will be very basic, until the simulation area is treated nicely. This will also mean I won't be making appearances everyday to give updates, I'll be hard at work.

    Cheers,
     
    Last edited: Dec 3, 2012
  35. Super-Spuddage

    Super-Spuddage

    Joined:
    Dec 22, 2012
    Posts:
    20
    Hay im working on a traffic system having loads of trouble though. Maybe you could help?
     
  36. Enginhk

    Enginhk

    Joined:
    Jun 14, 2013
    Posts:
    4
    If you sell it in Asset Store definitely I will buy it!
     
  37. SimtropBuggi

    SimtropBuggi

    Joined:
    Feb 15, 2013
    Posts:
    98
    I'm currently prototyping a city builder game and naturally traffic is a huge factor. I, however, wouldn't need physics and only need a very basic AI to keep the agents on a pre-calculated route. Lane changes and such would have to be done in real-time, but the intersection to intersection path would already be known. The other catch is there would be thousands of vehicles, perhaps ten thousand plus with many intersections. The road network would also not be static as the player would be laying out new roads and intersections.

    While your effort here is promising, it's been awhile since an update. Once the prototype is in a presentable state it will be used for a crowdsourcing effort.
     
  38. Fillock

    Fillock

    Joined:
    Mar 18, 2009
    Posts:
    73
    http://www.traffic-simulation.de/

    I really could need something like that on my job, transferred to 3D cars in Unity, and dynamic so we can make the roads and the car just drive on them. If you make a system that works we are certainly interested
     
  39. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
  40. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    Hello everyone, I've been away from unity for a while because of financial problems, I have received a lot of PM's over the traffic simulator. Unfortunately I dont have the money or support to continue the project... I've been avoiding posting this because I thought I'd get back into it but honestly its a mess.

    I'm really sorry for those who were kind of looking forward to this project, what I can do is slowly work on improving the current version and simply send anyone interested the DL for free.

    The system was suppose to be more then just a physics simulator but instead a complete AI system.
     
    Last edited: Jun 5, 2014
  41. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    So far it has basic traffic light system, detection and avoidance and the basics obviously. But nothing would be easily implementable to a new project and thats what would take a lot of the time in this package.

    There is another package which seemed to do the job, you guys should check it out I think you just type in Traffic simulator in the store. Though it wasn't as ambitious as this with all the features I prepared, looked like of what I've already implemented but mine currently would be hard to implement into another project(I could do skype chat to guide the first 3-10 people whos that keen, for free).
     
    Last edited: Jul 20, 2013
  42. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,237
    I can't find it, care to post the link please?
     
  43. SmellyDogs

    SmellyDogs

    Joined:
    Jul 16, 2013
    Posts:
    387
  44. omelchor

    omelchor

    Joined:
    Jun 15, 2011
    Posts:
    20
    Last edited: Oct 17, 2013
  45. milinc

    milinc

    Joined:
    May 21, 2015
    Posts:
    1
    hey @shifty i have to build a driving simulator for testing drivers and i would like to use a template of yours if you could make it possible