Submitted by mdonahoe on Mar 23, 2013
United States

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 behaviors 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.

Vehicle Behaviors

Basic Information

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.

Lane Changing

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.

Limitations

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.

Emergency Vehicles

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.

New additions

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.

Intersections

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

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.

Creating intersections

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.

Routing

Overview

To understand how the routing system works, I’ll talk a bit about how roads are created, how routing propagates values through it, and how you can influence these values.

Roads

Roads are constructed from many paths and paths are constructed from one or more segments. A path is the road between two intersections. Each path is made from segments and the number of these can vary depending on the curvature of the path or the terrain the path is crossing. So flat areas paths will tend to be only one single segment.

Assigning weights

Where there is any capacity on a segment, we assign a value to that segment based on the capacity. In this example, the work place has ten open jobs so we assign a base value of ten at each point on the ends of segment four. This value then propagates out through the network adding on the length of the segment that the vehicle will have to traverse. So in this case we say that segment two and three are fifty meters in length, and segment one is two hundred meters long.

In addition to this, we also add on congestion values that are calculated continuously. These values are only applied to the network when they reach certain thresholds that we have set at 25%, 50%, and 75% of road capacity. We do this to avoid the overhead in continually updating the complete network of paths. You have to know that we have many hundreds of these networks to update to cover the many different destinations vehicles have. As an example, say that segment 2 becomes 50% congested. We would then take the length of that segment and multiply it by a set amount, say 10 times. This would mean that the values would then become 10, 10, 510, 560 and 760.

Influencing the values

Let us look at the scenario below which has been seen in a video posted on YouTube. I marked each of the segments and the values at each end of the segment as before. With this layout, the vehicles will all initially exit their houses and use segments 5, 6, 2, and 1 to get to their jobs. As segment 6 becomes congested due to the traffic, the additional congestion weight will be applied to influence the value so that vehicles will route around using segments 4 and 3. However, in this case, because there is only one segment on the path where segment 6 is, and the value at the end is shared between segment 2, 3, and 6, the value will not actually change from its current value of 60 since the distance from segment 3 to segment 2 is still only an additional 50 meters and during the propagation the lowest value is always applied.

You can however influence the network by forcing a path to split into multiple segments. The cheapest way to do this is by drawing a dirt road midway along the path and then bulldozing this path. This then changes how the values are applied and would make the vehicles take the alternative longer but less congested route.

Obviously, this is not an ideal solution for you as a player since you can’t see how the paths are split up, so we are of course working hard at improving the routing.

Final Tips

Mass Transit

Traffic should generally be at an absolute minimum around an hour before the shift changes start at 6am and 6pm. When I start to see the congestion building up and lasting closer to this point I start to plan ahead and think about my mass transit options. Remember, when picking stops, the green overlays show you how far Sims are willing to walk to the bus stop, which can be a handy guide to helping space them out. This is important when strategically placing bus stops. Since busses don’t follow set routes, it’s a good idea to place them closely spaced in lines on the same side of the road to encourage the busses to go to the next stop in the line. This way, they won’t have to make a U-turn to reach the next stop.
In addition to busses, you can also upgrade your avenues to allow for street cars. Street cars are always my preference as it can’t get stuck in traffic jams like the buses can, however don’t go crazy with lots of avenues as this can cause extra traffic itself as I mentioned before. Plan out a route that will cover your highest density population areas and places of work then place rail stops that will allow those Sims to get out of their car and walk to the nearest stop instead.

Thanks for listening everyone. I really hope these tips help you out in designing your perfect city and getting that traffic flowing. Just remember, avenues won’t solve all your traffic woes. And look out for those telltale signs your road network can no longer cope with current volume of vehicles.

Author: 
Software Engineer Alexander Harkness
Date: 
Saturday, March 23, 2013 - 17:00
Category: 
Friendly id: 
under-the-hood-of-simcitys-traffic
thumbnail: 
Weight: 
0

Comments

Alexander, study Transport Tycoon and Locomotion and redesign the transportation systems to allow us to really build a working infrastructure that functions and really does something.

I'm sorry, but the transportation in Sim City just doesn't work. Nothing goes to where you want it and the traffic just builds until your city is paralyzed. Suggesting that we use "T" intersections just proves that normal 4-way intersections don't work and the game is flawed.

I support this statement and also suggest that maybe having the Sims a permanent place of work would help the traffic issue more, than just letting first come first served rules apply everyday. That way at the very least, we can figure out which areas are the cause of traffic, instead of the ENTIRE CITY being one big clusterf***

I am inclined to agree with Cocojacoby.

thanks for the amazing content on your blog I am very interested in this article and you have really helped me. I have just told a few of my friends about this on FaceBook and they love your content just as much as I do. jual new balance original online | harga sepatu futsal nike mercurial | harga sepatu futsal adidas original

  • Jobs for 13 year olds jobs for 13 year olds that pay
  • Jobs for 15 year olds jobs for 15 year olds
  • Jobs for 16 year olds 16 year old jobs
  • Free anonymous proxy anonymous proxy free
  • Anonymous proxy free proxy
  • Unblock youtube youtube unblocker
  • babysitting jobs for 13 year olds click here
  • summer jobs for 13 year olds click here
  • online jobs for 13 year olds click here
  • summer jobs for 16 year olds click here
  • babysitting jobs for 16 year olds click here
  • online jobs for 16 year olds click here
  • Thank you very much for a very useful article. Best of luck always to the author.
    Cipto Junaedy, Mobil Sedan COrolla, Mobil Sedan COrolla, Cipto Junaedy

    locksmith Services In Atlanta

    locksmith Seattle toronto locksmith

    locksmith | Door locks | Seattle locksmith
    locksmith Marietta Ga call ] locksmith Marietta,Ga

    According to this post, the base value assigned to nodes is equal to the number of jobs available on that segment. If that's true, then a segment with a million available jobs 1 meter away would have the same weight as a segment with 1 job that is a million meters away? I assume that is not how the game actually operates (though it sure would explain all the traffic problems). Please clarify/elaborate on how this "base value" is actually calculated.

    Also, I find it completely absurd that your proposed solution in section "Influencing the values" is to add and remove a dirt road so that some hidden internal values are calculated correctly. I would classify that as a bug, since Sims are choosing to take one path based on the weights assigned to an unrelated path. Has this bug been fixed since this article was released?

    That is very interesting Smile I love reading and I Cipto Junaedy always searching for informative information like this Jadwal MotoGP 2015. This is exactly what I was looking for Cara Upload Video ke Youtube.  Really this system so amazing. Cipto Junaedy  so happy to browsing this BBM Untuk Android Versi Terbaru. Simply fill out a quick and easy application, and you'll be on your way to getting your new Cara Membuat Email  and Cara Instal Windows 7 avoiding Thanks for sharing this great article . Don't forget for reading the articles about Jinpoker.com Agen Judi Poker Online dan Domino Online Indonesia Terpercaya. And I encourage you to bookmark the following page if Cahayapoker.com Agen Judi Poker Dan Domino Uang Asli Online Terpercaya Indonesia considered important ... Regards ituDewa.net Agen Judi Poker Domino QQ Ceme Online Indonesia

    More

    ADD NEW COMMENT

    You must be logged in to leave a comment.

    Register