SimCity Update 6: Streetcars

Hello mayors! We’ve noticed there have been a lot of questions about how public transit works under the hood, so today I’m going to lift that hood.

Let’s look at a city with a simple streetcar loop going through it. There are a few stops and a depot, and some cars are going from stop to stop, picking people up and dropping them off.

Now let’s look at the pathing data for the “pick up” destination. This destination becomes available to the streetcars when Sims are waiting to be picked up at a stop.

The numbers with “” represent how many people are waiting at stops on that particular road segment, while the other numbers represent the distance to the destination minus the number of people waiting.

Going clockwise and starting from the top left, you can see there are 10 people waiting, then 15, then 5, then 1, then 48, then 21.

When a streetcar leaves the depot, it’s going to make a left turn, as there’s less “work” to get to the 21 people who need to be picked up, since the stop is very close and the 48 people who are waiting on the right are too far comparatively.

If there was a situation where 300 people were waiting at the first stop to the right of the depot, and only one was waiting on the left, then the streetcars would make a right turn as they exit every time until everyone in the crowded stop is picked up. Then the next streetcar would make a left turn to pick up that one person.

There are a couple of obvious issues with this approach though:

If there are 300 Sims waiting for the streetcar on the other side of the loop for example, they may have to wait a long time for the vehicles to make their way. To remedy this problem, we’re looking into make crowded stops “high priority pick-up” destinations that transit vehicles will go to first.

Another problem is that, well, all the vehicles that are in the same area and want to go to the same destination type will all follow the same path, resulting in clumping and general traffic problems. We’re looking into various ways to improve the situation so traffic will spread out better.

You can also see that the data regarding streetcar destinations is only populated on the avenue with streetcar tracks. Regular roads are not part of the calculation (it says “inf” for “infinite” in the picture.)

Now let’s talk about what happens when a streetcar makes a stop. First, we try to drop off as many people as possible, based on the type of destinations located near the stop (like workplaces, shopping, home, school, etc). Then we pick up people based on what types of destination are available near other streetcar stops. Finally, we decide where the streetcar should go next.

If there is still room in the streetcar, then there’s a 75 percent chance we’ll send it to pick up more passengers. That said, if there’s nobody needing to be picked up at any stop on the line, we’ll make the streetcar drop off passengers at the first “DropOffAtX” destination, based on where the passengers want to go.

And then if that destination is not available, we’ll make the streetcar go back to the garage. (Streetcars do not use the “Trade Pick Up” destination, that’s only for buses, ferries & other vehicles that can go to other cities to pick up commuters and tourists.)

In 25% of the cases if there’s still room in the streetcar, as opposed to 100% of the time if it’s full, we’ll send the vehicle straight to a “drop off” destination.

Finally, if the streetcar is empty, there’s a 25% chance that it will go to the closest next stop on the line, and a 75% chance it will attempt to pick up passengers. And if all the stops have been visited recently, or there is nobody waiting to be picked up, then it will go back to the depot.

Comments

This is all fascinating, but can you maybe work on getting the cars and buses and other road vehicles to stop acting so dumb? Example.. http://www.youtube.com/watch?v=zcEaHT9mt-Y Just watch the video. It very clearly shows what I'm talking about.

The only thing that video demonstrates is that sims take the shortest path when travelling, and we already know that. They do not have any kind of optimal pathing algorithm. If you set up a crappy shortest path for them to follow, you're going to have traffic problems.

The point of the video is to show how poorly the AI is in this game. When is real life would EVERY SINGLE CAR take the same congested dirt road, when there is an OBVIOUSLY FASTER (but slightly longer) route? This kind of stuff happens all the time not matter how "good" you plan your road layout. Just look at how every vehicle in the game acts. It's comical to watch an ambulance or firetruck or garbage truck run its routes.

Then use some creativity and find a way to solve the "dumb". They arent real humans. There are ways to cut off roads and keep transit traffic separate from other traffic

Also, the side of the road that is crowded can be improved bybputting stops on the opposite side instead of all on the same side or randomly placed.

Sure there are some traffic problems once in a while that don't make sense, but you were given enough tools to work it out. When you make a change, you also have to wait till sims are done with their working day to see the result.

Pathfinding is one of those BASIC things that any computer science major in college would have been exposed to. There would also be common issues, such as "what is the average length of time it takes" for each road segment based on the history, and that would be data for the pathfinding algorithm. This is all VERY simple stuff. There COULD be a method where some will always take the shortest path, compared to the fastest as a way to avoid having everything ending up on the same sections of road to get from one place to another.

There really are some issues that need to be resolved, such as emergency vehicles getting priority, and when you see cars driving in loops, or things like restricted access roads for emergency vehicles to take.

Correction* You will have traffic problems no matter what. For example, if the only entrance to your city is a road in the corner of your city zone, then obviously the congestion will stem from there. Stupid game logic -> stupid game to play. Needs to be fixed.

I would add that I think 'average time to traverse' could be a statistic kept for every road and/or road segment. It could be the average for the past XX hours. Before committing a sim on a particular path, the game should be able to easily determine the TRUE cost for multiple paths, and adjust their pathing as appropriate.

As a formally educated computer programmer, I can tell you that many if not most computer programmers know how to program an algorithm to lead a mouse out of a maze. And that seems to be as far as the SimCity programmers went with it. My suspicion is that they will hopefully add a little more complexity to the sims than they did for the mouse in the maze when they were in college/university.

If I am reading this correctly, then it sounds like to make the most use of the streetcar logic in its current state one should have streetcar stops only in specific zones -- i.e. stops in purely commercial or purely industrial. Otherwise the streetcars will get confused with dropping passengers off in mixed zones of r/c/i. Is this correct? Or are commercial zones that have no goods not considered in the destination list for a stop?

You can't, because the passengers dont have any destination. They just hop on to the streetcar because it is close to them. Then the streetcar drops them off in a place where (hopefully) there are jobs or shopping spots, and then the sims are dumped out, trying their luck to find a store, or some work for the day.

If you could set a circle route, they would just dump off the sims at the next stop, where they would wander around aimlessly, in search for the next best shopping experience or whatever.

Yeah this would be much appreciated. Don't know why you need a specific logic where the streetcar (or busses, too) should go.
Simply
- calculate one route all vehicles should follow
- show this route as a new map or extend the current streetcar/bus map...
- have an algorithm which lets vehicle B wait if there is a vehicle A infront of it that they don't clump up.
- don't allow streetcars to switch/toggle the direction "magically". If there is e.g. a circle, one street car goes around clockwise the next might go around counter clockwise, but they will not change direction...

All in all, the placement of streetcar/bus stops should give the player the ability to directly control the pathing. I don't want some fuzzy logic where streetcars do go to the next most crowded stop or what not... thats not realistical and even doesn't make any sense...

One problem I've noticed with that buses from another city. When they come to the bus stops in my city, all of them stick together like a train. They don't spread out across the whole city and spread the load of passengers.

That's because the AI in this game is broken...BADLY! Just like a lot of other things in this game. It looks like they needed at least six more months to test and polish before releasing. Unfortunately, EA doesn't work that way. They set a release date, and the game gets released on that date no matter what. This isn't the first time EA has shipped an OBVIOUSLY unfinished game. It's actually par for the course for them. Unfortunately, most of the industry is doing the same thing. It's just that EA is the biggest and worst offender. That is why gaming is in the state that it is.

lol so true. All the "agents" in the game are completely mindless. (transport, workers, shoppers, tourists, everything)... what's the point of calling it a simulation mose well call it ZombieCity instead of SimCity.

As a former game developer and former urban designer in real-life as well as being avid simcity fan, I am extremely disappointed with the transport decision logic within SimCity 2013, The 'sims' simply do not act anything at all like real people would in a city in regards to how they would travel between places. It honestly needs to be improved, one of the many factors of why I think this game was released too early.

Further, your proposed solution to help bandaid one of the many transport issues in the game is totally insufficient! What you need to do to fix the problem is improve the decision logic for choosing a route, I think we can assume the sims have GPS installed in their cars in this modern age...

One of the Major Problems with the public transport (Buses, Streetcars) at the moment is that they all freaking leave shortly after each other and follow each other around. I noticed that you left this off in your example!! (On purpose?)

So Streetcar 1 (in the lead) goes to pick someone up, Streetcar 2 (behind it) sees that the same stop requires attention follows it, except then streetcar 1 picks up everyone from Stop 1 and Streetcar 2 picks up no-one. If Stop 2 is in the opposite direction to Stop 1 from the start location, the Streetcar 2 has just wasted the entire time it took to travel from start location -> Stop 1.

Clearly what should happen is the following (What the AI needs to do!) aka I AM ABOUT TO TELL YOU EXACTLY HOW TO FIX YOUR GAME!:
Streetcar 2 upon leaving should consider that Streetcar 1 is on the route to Stop 1 and will pick up the passengers from there, then make a decision if it is still appropriate to go to Stop 1 or if it is better to go to Stop 2.

Dear Maxis Team,
I think my idea is a better solution to resolve the traffic problem because i think you guys know that the game cause always traffic. Why dont you add an radio central? U can only build it when u have the traffic upgrade and it would keep informing the sims about where is too much traffic so the traffic can fluid better and causes less traffic infarcts. Thanks yours Danbiz

Never [sadly] took advantage of the streetcar mod in 4, so streetcars are a new "toy" for me...

But still, the path-finding in this game is well, idiotic. Hopefully after the servers are fixed, they can get to work fixing this problem with all the transit and vehicles... It irks me to see buses make illegal U-turns (for Californian standards even!) and watch a sim drive in a loop trying to get to work.

Of course, let's not forget some of the issues in 4 and how sims could get stuck in loops... =/ Hopefully someone can fix this recurring problem of the franchise!

No, no,no Guillaume, the correct answer is: WHO GIVES A SHIT?
Streetcars are the LEAST important problem of this game. Fix pathing, fix population number display, fix servers, fix RCI interconnections, fix cheetah speed, fix map sizes, fix the running out of water and THEN tell us how you simulate dogs pooping into your street and how you do streetcar algorithms.

Had 1 city 140k population. Nice size population had all major forms of transportation covered. Worst spots: #1 Entering my city-Road block for miles. Don't know why that's the case when I had a fully upgraded airport and train station. #2 Pathway to my industrial area, I had 5 ways of getting to my industrial area 2 of the roads almost never used 2 of the roads had street car accessibility but still backed up 100%. With having a lot of mass transit covered this shouldn't be an issue but it is...

I believe that people would be better served by stating their concerns politely. Mr. Pierre took the time to explain how streetcar pathing works, which, I think, gives people a chance to provide feedback. I'm sure he reads this blog and it must be extremely difficult for him to work for people who talk to him this way.

If there are 300 Sims waiting for the streetcar on the other side of the loop for example, they may have to wait a long time for the vehicles to make their way. To remedy this problem, we’re looking into make crowded stops “high priority pick-up” destinations that transit vehicles will go to first.
Another problem is that, well, all the vehicles that are in the same area and want to go to the same destination type will all follow the same path, resulting in clumping and general traffic problems. We’re looking into various ways to improve the situation so traffic will spread out better."

Thank you for acknowledging these problems - really hoping you guys actually patch this game. And yeah - use HIGH RES pictures.

I find it interesting to read this. I have until now planed my city while thinking people would act almost as one could expect from the mindless masses in real life. There people know where to go, and go on the bus or street car that are planed to go there. Now I realize that people are going on the first bus or street car available, telling the driver if they are going shopping, working or to any residential house, and the driver goes to the nearest stop offering it.

I would like to see my SimCity people know where they where going, and travel accordingly. And that the buses and streetcars followed a planed path.

When I think a little further I see that I have been thinking like a SimCity citizen when I bought the game. I logged on to the Internet and told my computer I want a game. It took me to the newest all Internet game, and I was happy for until my money was gone. Next time I want a new game, I will tell my computer that I want a game that works as expected.

Don't know why you need a specific logic where the streetcar (or busses, too) should go.
Simply
- calculate one route all vehicles should follow
- show this route as a new map or extend the current streetcar/bus map...
- have an algorithm which lets vehicle B wait if there is a vehicle A infront of it that they don't clump up.
- don't allow streetcars to switch/toggle the direction "magically". If there is e.g. a circle, one street car goes around clockwise the next might go around counter clockwise, but they will not change direction...

All in all, the placement of streetcar/bus stops should give the player the ability to directly control the pathing. I don't want some fuzzy logic where streetcars do go to the next most crowded stop or what not... thats not realistical and even doesn't make any sense...

I want to set up the lines / numbers for myself. if the streetcar/bus company isnt capable, their business gets socialised / nationalised and town hall will do their jobs, too. that feature is just missing - like one way roads.