SimCity: Under the Hood of SimCity’s Traffic System
Hello, I’m Alexander Harkness, and I’m a Software Engineer working in the transportation team of SimCity. I’ve primarily been working on implementing the behaviours for the vehicles, rail, boats, and helicopters during my amazing time here at Maxis. I wanted to take some time out of my usual duties to explain to you all how the traffic system works and how you can make the most of it.
Every vehicle in the game has a basic set of performance characteristics such as top speed, acceleration, and deceleration. The values assigned to each vehicle vary on the type of vehicle (scooter, car, and truck), the wealth value of the vehicle, or where the weight has changed after a delivery is made.
Vehicles will always try and get into the correct lane for the next turn they are required to make. So when turning right, they will attempt to get into the right lane. And when turning left, they will attempt to be in the left lane. Vehicles travelling straight through an intersection can be in any lane. Vehicles will also overtake vehicles in front using the lane to the left if the vehicle in front is travelling slower and there is space for them to do so. Emergency vehicles can undertake and overtake using any available lane. When the vehicle is expecting to enter a building on the current section of road, the vehicle will always try and be in the right most lanes, they will only move out of that lane if there is an obstruction such as a stationary fire truck.
We tend to be quite strict in cases such as U-turning where we found very early on that letting vehicles U-turn wherever they thought was best caused so many traffic problems that we had to restrict them to U-turns at intersections only. Other limitations imposed are vehicles not being allowed to cross the median to enter buildings on avenues and emergency/service vehicles stopping outside of building only. This means vehicles must travel much farther when their destination is on the opposite side of the road, since they will need to U-turn at the next available intersection. Of course, from this you can see that it is not always wise to immediately upgrade all your roads to avenues in an attempt to solve congestion.
Driving to emergency
All emergency vehicles have the ability to change the traffic lights in their path to green. This is so by the time they reach those lights, they should have changed, and any traffic at the set of lights should have started to flow. During periods of heavy traffic, it could be that there is some gridlock where traffic is not moving, even after the emergency vehicle has changed the light to green. In this case, it will remove the lock on the green light, as this can potentially be the cause of the gridlock.
Stopping outside buildings
All emergency vehicles will stop outside their destination while they are attending to the situation at hand. This causes a temporary blockage on the lane immediately outside the building and can last a variable amount of time depending on the emergency. On two lane roads, this causes an issue with traffic being permanently blocked until the emergency is over, however, on four or six lane roads, the vehicles should flow around unless they are interested in entering the building that the emergency is at.
In a recent update, we added some new functionality that prioritizes emergency vehicles over all other vehicles. The first change was to ensure that these vehicles could exit their garages and get onto the road as quickly as possible and deal with the emergency. This means that they will immediately reserve a spot on the lane outside the garage and drive straight onto it. Previously they would have to wait for a spot to open up which may never have happened during times of congestion. The second change was allowing them to use any lane on the road regardless of whether they were required to turn left/right at the next intersection, which as previously mentioned, would normally force the vehicle to attempt to get into that lane.
All way stops
At these types of intersections, vehicles obey the rules of first to arrive is the first to move. This rule is broken for two different scenarios. The first is where we can improve traffic flow by allowing multiple vehicles that will not cross paths to move at the same time. And the second is where the vehicle is unable to move because the road is blocked. In the latter case, the next vehicle to arrive is promoted to the top of the queue and the blocked vehicle is moved to the back.
Traffic lights can be used to improve the flow of traffic at intersections dramatically over all way stops. During testing, it was seen that there was a 4-5x improvement in the amount of traffic travelling through the intersection. Traffic lights also have knowledge of traffic whether it is vehicles or pedestrians that are waiting at the lights. In the case where there is zero traffic waiting or approaching, the intersection light will switch to allow traffic from the opposite set of lights to proceed. The traffic light will then stay green in that direction until traffic from the crossing direction approaches/arrives at the intersection. When there is traffic from both crossing directions, the lights work on a timer countdown. This countdown is differs in length depending on the combination of the joining roads at the intersection, but the length the light stays green is longer the wider and higher density the road is.
Side street stops
This setup can be incredibly useful to create corridors through the city where traffic can flow freely without interruption from stop signs or traffic lights (vehicles will only stop to let pedestrians cross). These can be created by using any four lane road or greater in combination with a two lane street or dirt road as the side roads.
To achieve better flow through the city it is much better to use T-Junctions than four way intersections. This is simply because there will be fewer vehicles trying to cross the path of oncoming traffic for which they have to wait until it passed. You may have noticed that often queues will form where traffic is waiting to turn left across the path of traffic. Intersections that are too close together are another thing to avoid. This is because the flow of traffic during the green phase of one of the intersections towards the next intersection will be very small due to the area available for the vehicles to wait and most of the green phase will have been wasted as no cars are moving.
- The Sims
- The Sims 4
- The Sims 3
- The Sims 2
- The Sims 1
- The Sims Medieval