This is what I've come up with.
Vehicle has a path to take which is a series of Intersections
-At each intersection it will look for a LaneConnection that connects it's lane to a lane that connects to the next Intersection it wants
-If it can't find one (it means the graph has changed), so recalculate the path
-The path finder should maybe have a priority queue to process stuck cars first so that they're not blocking traffic
-Needs to check if this intersection has lights
-If it does have lights, will only proceed on a green light to enter LaneConnection
-Needs to check if any of the blocking lanes have a vehicle in them. If it does, then it is blocked and will not be able to move forward into this LaneConnection
Intersections:
-Process Lanes in a round-robin way so that every lane gets a chance to inject a car into the LaneConnections
-Each lane is checked to see if there's a Vehicle there, and it's logic is processed.
-Then every other vehicle in that lane is processed
Vehicles travel down roads by measuring the delta distance between it and the car in front / end of lane.
-If the distance is getting larger, we can speed up at acceleration rate until no more than speedLimit or drivers speed limit
-If the distance is getting smaller AND the distance is less than the breaking threshold for this driver, we will calculate brake rate to match drivers speed before hitting them or 0 for end of lane
-d = distance between vehicle and leading vehicle / end of lane
-s1 = vehicle speed
-s2 = leading vehicle speed or end of lane (0 speed)
-sd = s1^2 - s2^2
-dr = sd / (2 * d)
-dr is the deacceleration rate to apply
-Vehicles should be processed from front of lane to back of lane
Vehicles wilPost too long. Click here to view the full text.