We developed it with Unity3D in C#.
This simulator is based on New York City traffic, in fact there are pedestrian, differents kind of cars like truck or city-dweller car. There is not roundabout, cars can not cross each other and pedestrian can not cross the street.
For a better introduction you can watch this video which resume our Traffic-Simulator project.
You can clone or download the project by clicking on the button "Clone or Download". Or you can get this command on terminal
git clone https://github.com/leirbag95/Traffic-Simulator.git
-
Clone the project and launch it with Unity, then Build & Run the project with the OS you want.
-
Download the project for Mac OS through this link
Once you have started the program, you will be in front of the main menu where you will have several choices:
- Start a local traffic simulator
A traffic simulator will be randomly selected from a local database of document. In fact, you have a dozen of maps which are provided with the project.
- Upload your own city
Maps are generated from a JSON file. We made this simulator in order to upload your own map. Everything are explained in the specification.
Below you have an example of what looks like a city through a JSON file required
{
"name":"Pulv City",
"rows":17,
"cols":10,
"grid": [
["", "", "", "", "", "", "", "", "",""],
["", "", "TB", "BT", "", "TB", "BT", "", "",""],
["", "", "TB", "BT", "", "TB", "BT", "", "",""],
["", "RL", "CNO", "CNE", "RL", "CNO", "CNE", "RL", "RLS",""],
["", "LR", "CSO", "CSE", "LR", "CSO", "CSE", "LR", "LR",""],
["", "", "TB", "BT", "", "TB", "BT", "", "",""],
["", "", "TB", "BT", "", "TB", "BT", "", "",""],
["", "", "TB", "BT", "", "TB", "BT", "", "",""],
["", "", "TB", "BT", "", "TB", "BT", "", "",""],
["", "", "TB", "BT", "", "TB", "BT", "", "",""],
["", "", "TB", "BT", "", "TB", "BT", "", "",""],
["", "", "TB", "BT", "", "TB", "BT", "", "",""],
["", "RL", "CNO", "CNE", "RL", "CNO", "CNE", "RLS", "",""],
["", "LRS", "CSO", "CSE", "LR", "CSO", "CSE", "LR", "",""],
["", "", "TB", "BT", "", "TB", "BT", "", "",""],
["", "", "", "", "WP", "", "", "", "",""],
["", "", "", "", "", "", "", "", "",""]
]
}
Road are modeling by a matrix of GameObject. There are several types of GameObject :
These kind of GameObject represent the direction of the road, in fact each Road GameObject has a peer of Node.
- TB : TOP to the BOTTOM
- BT : BOTTOM to the TOP
- RL : RIGHT to the LEFT
- LR : LEFT to the RIGHT
- CNO : CENTER NORTH WEST
- CNE : CENTER NORTH EAST
- CSO : CENTER SUD WEST
- CSE : CENTER SUD EAST