Why Everyone is Wrong About SimCity (except me.) | General | Forum

 
You must be logged in to post Login Register


Register? | Lost Your Password?

Search Forums:


 






Minimum search word length is 3 characters – Maximum search word length is 84 characters
Wildcard Usage:
*  matches any number of characters    %  matches exactly one character

Why Everyone is Wrong About SimCity (except me.)
Read original blog post

UserPost

8:31 pm
March 14, 2013


quill18

Ontario, Canada

Admin

posts 559

 

When it comes to SimCity, everyone loves poop — whether it's flowing through the sewage data layer or being flung at EA.

And generally that's fine, but there's one place where people have it wrong: The shortest-path traffic routing does not represent some kind of incompetence on the part of the programmers who worked on the game, nor a failure of quality-assurance, not is it representative that the game has been rushed out. Here's why:

  • Shortest-path is a game rule that is absolutely clear to the user. You don't have to guess about what's going on. Once you understand the rule, you know exactly how the vehicles are going to behave and you can plan accordingly. This is how all games work: Figure out the system, then figure out how to best take advantage of it. The value of this CANNOT be ignored. (Also, people in real-life often don't have real-time traffic updates and often find themselves driving into traffic jams. Omniscient Sims would actually be unrealistic.)
  • Routing that takes traffic into consideration is not something that it trivial to implement — it has major programming and performance considerations. Non-programmers have no idea how much of a problem this is — they just say: "Just have the car look to see if the road has too much traffic, and if so choose another route". If it were that simple…don't you think they would have just done it? Furthermore, as per my previous point it can lead to unclear behavior that the user doesn't understand. SimCity has always been a game of traffic management. There will *always* be bottlenecks. The key is to make sure that the user understands why the bottleneck is happening and can then work with the system to eliminate them.
  • Finally: "Smarter" traffic routing will not solve the real problem with traffic.

What's the real problem with traffic? The fact that when vehicles are spawned, they aren't properly aware of if other vehicles are also going to the same target. This is particularly evident with things like fire trucks (all trucks go to ONE fire while the rest of the city burns down), but it also happens with people leaving work — a ton of cars all go to ONE house, then all the cars (minus whoever fit at the first stop) move to the second house, etc…

That's what is causing the worst of the bottlenecks and if this were resolved the shortest-route driving would be far less of a problem. And the good news is that this should actually be much easier to solve than "traffic awareness", while also creating far less of a performance hit because it won't require constant recomputation — just a check when the vehicle is spawned.  Even if it doesn't resolve traffic jams completely (although it would help!), it would make emergency vehicles and buses far more effective, which by itself would make cities run a lot more smoothly.

 

 

Also, the poop-flinging about "fudged" population numbers is ludicrous.

 

 

 

 


Read original blog post

I'm just a dude with Fraps and too much spare time.

11:55 am
March 15, 2013


ChStoffesson

Sweden

New Member

posts 1

Well the most realistic way to solve it would be creating some kind of "dynamic learning AI" or what ever you would call it for the traffic that always chooses the fastest way to get somewhere based on how the that agent experienced traffic jams in the past. So the first times it would take the shortest way and if that always gets jammed then some agents starts searching for other paths with a less dense trafficpathern, but ofc that would probably be almost impossible to code and get working. 

 

But if I ever manage to master the art of programming I will try!

 

oh btw we should play a region sometime!

Nick is the same as here on Antarctica 1, WE 1 and 2

 

____________________________________________________________________________________________________

ChStoffesson

12:48 pm
March 15, 2013


Prxx

New Member

posts 1

> Routing that takes traffic into consideration is not something that it trivial to implement — it has major programming and performance considerations. Non-programmers have no idea how much of a problem this is — they just say: "Just have the car look to see if the road has too much traffic, and if so choose another route". If it were that simple…don't you think they would have just done it?

 

I'd like to dispute this point in particular. Weighted path cost, while not realistic (but neither is the naive SPF SC5 seems to have now), doesn't change the performance. If they use some specialisation of A*, like Dijkstra's algorithm, complexity will be bounded by O(e+vlogv), where e and v are the size of the sets of edges and vertices, respectively, and this doesn't change if the cost function is a function with constant time complexity.

1:31 pm
March 15, 2013


quill18

Ontario, Canada

Admin

posts 559

I think that the point that people keep missing isn't that weighted path costs are hard. That's easy.  That's pathfinding 101.

 

The problem with "pathfinding 101" solutions is that they only work when there's enough CPU power available to be able to generate a custom route for each agent.  Regenerating the graph isn't the problem — you could do it at regular intervals, or just have a dedicated thread that runs it as frequently as possible, which would be almost "free" in modern multi-core computers. The problem is that it is utterly unfeasible to have the thousands of agents running around in SimCity respond to that information in real-time, because while generating the graphs are easy — walking the graphs over and over and over for thousands of agents will bring any computer to its knees.  That's why agents do NOT recalculate their path once they are on it.

 

So even with great graph updates, what you'll get is a thousand of agents spawning at the same time (i.e. time to go to work) and all of them selecting a route that is CURRENTLY free of traffic…then getting stuck.  Then repeat a few hours later at quitting time.  The solution to this is to have the "traffic weight" only grow very slowly over time and to have a bit of randomness applied so that over time agents start to have a higher and higher chance to select an alternate route – but stuff like this requires significant manual fiddling and is still suffers from the core problem with pathfinding.

 

The core problem is that even in a perfect world with real-time pathfinding response to traffic situations, you STILL need to have agents "claim" destinations or you'll still end up with "clumping" problems, especially with emergency vehicles.  And since you need this no matter what, it makes sense to implement this first — and there's a good chance that the worst of the traffic problems will be resolved once agents (especially emergency vehicles) stop "clumping".

 

What I will say is that if they are NOT adding pathing cost to roads based on their density, then that does represent a completely stupid implementation.  Low-density roads should require a TREMENDOUS shortening of routes over taking a high-density avenue for vehicles to make that choice.  This IS something that only has to be calculated once, as part of the same cost heuristic they already use (go from cost=length to cost=length*density_penalty_factor).  It's trivial to implement and while cars still wouldn't respond to changing traffic conditions, this (plus the clumping-prevention) would go a long way towards preventing any traffic problems in the first place.

I'm just a dude with Fraps and too much spare time.

1:42 pm
March 15, 2013


quill18

Ontario, Canada

Admin

posts 559

Post edited 1:55 pm – March 15, 2013 by quill18


Woah. I just saw this very topical blog post:

our roads will have a weighting system based on 25%, 50% and 75% capacity. As a road hits those marks it will become less and less appealing for other cars, increasing the likelihood of them taking an alternate path if one exists.

As we both said: This is not hard to do.  But as I still claim: This will not resolve the fundamental problem, because I don't expect that the "alternate paths" will be recalculated for agents that already exist, though I can certainly see the case where a car that is stuck at an intersection might recalc its path — this would only require calculating a handful of paths at a time (just for the car literally at the intersection itself).  That sort of thing would be a drop in the bucket though and really wouldn't eliminate traffic jams (though maybe emergency vehicles should recalculate frequently, since there are fewer of them and they are more important).

Again, I claim that the fundamental problem is clumping — especially with emergency vehicles.

instance, emergency vehicles will not get blocked in their garages and will move into empty lanes to get around traffic jams. We’re also working on preventing service vehicles from clumping up (for instance, only one fire truck will respond to a fire instead of two) 

Boom.

 

Also, we know that buses are pretty dumb. If they worked better, we'd also have fewer traffic problems. Part of this is eliminating clumping, part of this is tweaking their system for choosing which stops to visit.

improving the way that Public Transportation operates in the city.

Boom again.

 

Notice that while it would be easy to program real-time recalculation of all agent paths based on traffic updates, there's no mention of it in this blog post.  Because doing that would be impossible in the real-world of non-infinite CPU power.  (EDIT: Though you could certainly fudge it. For example, I could see having a single low-priority background thread whose job is to iterate through all the agents one at a time and run a recalc on anyone not currently stuck in a jam. Making use of any *idle* CPU power that might be available, especially in a multi-core system, would be fantastic.)

I'm just a dude with Fraps and too much spare time.

2:14 pm
March 15, 2013


quill18

Ontario, Canada

Admin

posts 559

Post edited 2:16 pm – March 15, 2013 by quill18


Hot damn, I should start giving myself awards.  Check out this video from a SimCity developer working on new traffic avoidance

 

Note how cars continue to go straight through to the dirt road when they can (because it is the shortest route) BUT cars that get stopped at the intersection and CANNOT enter do recalc their path.  This way you don't overload the CPU by recalculating everyone all the time — just the handful of cars that are stopped at the crosswalk.

 

Later cars DO avoid the dirt road entirely — probably because they were spawned AFTER the avenue was added and their initial pathing calculation took the dirt road traffic into account. EDIT: In fact, this is quite obvious because when he adds the new, even shortly 2nd avenue there's still plenty of people taking the longer avenue — but over time more and more cars end up taking the path on the right, probably because they were spawned afterwards.

I'm just a dude with Fraps and too much spare time.

4:17 pm
March 16, 2013


bjclang

the Netherlands

Member

posts 5

Nice post, Indeed Simcity is broken at various points, and needs to be fixed. Im still convinced that Simcity can be a "near" 10/10 game.

And its indead ridiculous that people complain about fudging population numbers. That happened in all Simcity games incl Simcity 4, where "average Joe"suburban houses were filled with 40 people. Also in wow where a 5 man dungeon boss got more hitpoints then a Old God. It happens in all games.

 

Well said quill.

10:48 pm
March 16, 2013


SirCliveWolfe

New Member

posts 1

Interesting article Quill

 

Nice in-depth analysis of the problems of thinking that making a huge change to the way a game works (and lets be fair a large part of SimCity has always been traffic management… in fact I remember the 1st SimCity on the Amiga in which one of the scenarios was Bern where you had to reduce traffic to win!*) is not quite as easy as many on Reddit and such places on the interwebs think.

 

Interestingly I started a new city today after receiving an update from Maxis and I have managed to build a 375,000+ pop city with out any real traffic problems. Well I still get jams on major roads, but they soon shift and sort themselves out. I'm not sure if Maxis have changed something (probably) but I've found that using mixed zones helps a lot i.e. have RC&I all on one road (not ave) in between two avenues, seems to cut down the traffic.

 

Anways, keep up the good work, love the vidoes

 

*D'oh! sorry for the tangent

8:35 am
March 23, 2013


Lurimax

New Member

posts 1

I totally agree with quill. It would not be possible to recalculate the route for every vehicle at every intersection using any for of shortest weighted path. Your CPU would probably turn to mush.

 

I do wish they had weighted empty roads more though. In the famous examples of the dirt road with the slightly longer avenue next to it, the cars shouldn't be going on the dirt road in the first place. The avenue has a higher speed limit and is more gently to your car, so chances are you would take that instead. Yes it would add more processing to the game, but it would only have to happen once for each car, which is very doable.

 

But making someone own something as soon as they find a path to it would be the best cure. This doesn't take much programming or resources either. If all building just had a flag saying "taken" or something, people would know when the calculate their path that the building does not need any more people rushing to it. 

But I disagree about the fudge population thing.  It seems like they couldn't deliver the size of city the promised so they just invent random numbers to make it seem like they have. It's a bit like saying you can get to level 100 in diablo 2, only to find out that past level 60, you don't get any more skill or stat points. It becomes just a number that doesn't mean anything. It also makes it harder do judge how many workers you have. It's not uncommon to think "I need more jobs, I have 150K people in my city!" only to find out you are missing over 6000 workers (despite the RCI bar showing a high demand for industry)


About the Tower Dive! Forum

Forum Timezone: UTC 0

Most Users Ever Online: 155

Currently Online:
4 Guests

Currently Browsing this Topic:
1 Guest

Forum Stats:

Groups: 3
Forums: 4
Topics: 388
Posts: 3517

Membership:

There are 27348 Members

There is 1 Admin
There are 3 Moderators

Top Posters:

Niicks – 198
Mordius – 168
Briarstone – 125
raynesummers – 103
Smartzach – 98
wbmc1 – 72

Recent New Members: Mattson, themarbleguru, acentriatech, vipin12345, Daisy221, Silden

Administrators: quill18 (559 Posts)

Moderators: AnimeHero (263 Posts), Jay Is Awesome (155 Posts), Demonac (59 Posts)



 
Go to Top