At the University of Wollongong, Australia when I was completing my Bachelor of Computer Science degree, you would need to take a year long class where you document and develop an application in a small group. CBRTraffic was the application that the team I was on documented and developed.
CBRTraffic (the name comes from the first letter of each of the group members; Christopher, Brett, Rory, and Tom) is a very basic traffic simulator. The user has the ability to draw a network of roads (think SimCity or City Skylines) and then can add a number of vehicles to the road network to see how the traffic is handled using the configured intersections.
Only Java and Java Swing framework.
How It Works
When the user logs in by default they should be able to create the road network, unless their account is only able to simulate the traffic on the road network, in that case you can add vehicles to the network and press play to see how the traffic is handled.
After the user has created their road network they can switch modes where they can simulate the traffic. Vehicles can be added/removed to the road network at any time while the simulation is running.
Before you can run the simulator you need to build the road network. To build the road network you can first place the intersections down on your map. Unfortunately unlike SimCity and other city builder like games, when you connect roads they do not already change to intersections if they overlap.
After you have placed the intersections, you can easily connect the roads together based on the edges of the intersections. Take a look below of a simple road network with a traffic light and stop sign intersections.
Now with the road network build, you can easily add vehicles to it and press play. You can watch the vehicles drive around, in a random fashion. See below for a running simulation on a small map with two stop signs.
The build that I currently have access to (cannot find the latest build we showcased and cannot locate the source code to rebuild) is one of the earliest versions we had that had the vehicles moving and drawing the road network was working.
The application can be downloaded here in a compressed file format. All you need to do is extract it to your desired directory and then execute the jar file supplied. To log in to the application you need to enter valid user information. This can be found in the ‘user.dat’ file.
Enjoy 🙂 and as always if you want further information about the project just send me an email and I can help out.