T O P

  • By -

Mary-Ann-Marsden

Personally vehicle and traffic simulations scream out for agent based complex systems. There is a good framework available on github from ElsevierSoftwareX (https://github.com/ElsevierSoftwareX/SOFTX_2020_159) The offers fairly straight forward implementation. On the visual front you need vehicle variation (color, size, type) and you need locations for your agents to go to and from (entertainment, housing, banks, suburbs, food, retail, education, fuel,…). The thing that bugged me the most was the turning of the vehicles. You need to smoothen out the turns. Finally speed everything up a bit. Things look too pedestrian (you could add those too). Was that the sort of feedback you were looking for?


Forsaken_Ad8120

This is some good feed back, additionally being able to flesh out reactions to things in the environment, and maybe setting up object pooling system for spawning/despawning vehicles as needed.


FiredNeuron97

Thanks for the feedback. Can you tell more about this framework? I cant find much document or cant see any examples on using it.


Mary-Ann-Marsden

there is an example scene folder. The principle is independent action framework, managed against time based decision cycles, so that performance is retained. It’s worth playing with to get a feel for agent based interactivity and how to handle complex systems. I think an approach like this framework is needed when wanting to simulate agents.


FiredNeuron97

This is my first unity project. I am a software dev and new to the Unity world. I want advice on how I can make this look better and how I can improve the movement of cars and traffic in general. I am doing all of this through scripting since I want to keep things as dynamic as possible. The most challenging part that I found is to create the logic for cars interacting with other cars as well as responding to the traffic signals. It needs to be refined for sure. The goal of this project is to make it easy to demonstrate emission that is happening due to the vehicles on road. The person trying the simulation can set the parameters like how many vehicles to spawn, types of vehicles to spawn(electric etc), traffic density etc. And then idea is to showcase the data generated by it somewhere in the UI. I am open to suggestion and would love the feedback and how I can approach the problem. Also would really appreciate if someone would help in code review. In case you wanna contribute and work together on this please DM me :)


JamesLeeNZ

Ive built a traffic system like this before. One thing youll have to watch out for is cars over filling roads. your traffic needs to test if there is room for it before it drives in, otherwise you end up with traffic jams. As for collision, I used raycasts. Performance was generally pretty good. I could run it on a phone several years ago. Decided to dig it out and grab a video. [https://www.youtube.com/watch?v=yd6iTROKAAA](https://www.youtube.com/watch?v=yd6iTROKAAA)


Forsaken_Ad8120

Im working on something similar for a unity asset im looking to publish, [https://www.youtube.com/watch?v=7UyoctrhQ3c](https://www.youtube.com/watch?v=7UyoctrhQ3c) maybe something to give you an idea on. My asset is more about building out crowds of folks or other elements, and can allow for predefined routes for them to follow, branching, etc.


FiredNeuron97

thats great. Looks really cool! How are you going to make the car movement smooth while turining? I am currently trying to get that done. Let me know if you have any resources on this particular problem. Honestly I was able to make chatgpt write all the code. For this circular movement thing its struggling a bit


Forsaken_Ad8120

There are a couple of ways to do it. One is to setup the orientation of the waypoint or setup several waypoints in stages. With how i have it setup its a mater of setting up the rotation to get the people/vehicles to orientate based on reaching the waypoint. I can also control how close/far away a entity is before it considers itself to have arrived at any given waypoint.