Understanding the Traffic Simulator

Started by jplumbley, February 21, 2008, 03:00:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Not required anymore.
"You learn something new everyday."

Bringing the new horizons closer to reality.

Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dmscopio jplumbley ♦ moganite ♦ M4346 ♦ Dedgren ♦ Ennedi Shadow Assassin ♦  Tarkus ♦ wouanagaine
Street Addon Mod - SAM


Excellent to have all this information presented and explained in one place, jplumbley! &apls


Nice work there and yip will agree that is very math intensive.

Maybe now some of us can fathom just a little bit more the work people like you go through when dealing with transit related stuff like NAM and your updated simulator that we all cry out for.

:thumbsup: :thumbsup: :thumbsup: :thumbsup: is not enough for the piece written here
Now Idle
Please leave a message after the beep and I'll get to you as soon as I can bother


Very informative and clearly structured. Thank you.


Quote from: jplumbley on February 21, 2008, 03:00:50 PM
For example a Avenue may have a capacity of 2500 cars a day, but it can handle more than 2500 cars before Sims start looking for other ways to get around the congestion.  There are other properties that define what the Sim should do if he comes in contact with such congestion.  One important one would be 1.5 Congestion vs Speed.

Question on this.  You say it has a capacity of 2500 cars a day.  Does that count morning and evening commute then?



Ah, this helps me understand it a lot better and clarify some things :)
Click here if you want to play SimCity 4 in Linux :)
Click here if you want to try Linux :)


There seems to be an error in Section 1.2, "Commute Trip Maximum Time."  The first equation says, "Tiles per Unit of Time = 1/31,"  where 31 is the speed of the path type in question.  But this can't be correct, because it means the faster the speed, the fewer tiles would be covered per unit of time.  So instead of 1/31, it should just be 31.  This also makes more sense when you consider the final equation, "Travel Distance = 31x6 = 186 Tiles," which is correct.  In effect, what you are doing is the following calculation:

-------------   X   Time
Unit of Time

The time units cancel out, and you are left with the number of tiles.


Yes, that makes sense.  So you might want to change it from "Tiles per Unit of Time" to its inverse, "Time per Tile."

Also, I'm not sure what the "1/31 = 6" equation is supposed to be saying.  Mathematically, it doesn't seem to make sense.  You might want to consider deleting it, as everything else is quite understandable without it.

BTW, these are just nits.  (Which makes me a nitpicker, I guess.)  On the whole, the tutorial is excellent, and it has certainly helped me to understand the traffic simulator better.


Looking further at your guide, I notice that for both the Network Speed properties and the Commute Trip Maximum Time, the units of each are not mentioned.  And from what I have read, there doesn't seem to be a consensus as to what the units should be.  But I've come across a relationship that should answer this question, and which should be very useful for anyone who wants to design or modify a traffic simulator.

It is well known that in the Reader, the network speeds are described as being measured in kph.  Some people have disputed whether or not this is correct, but the evidence that I have found indicates that it is.  It turns out that if your city is built to the standard Maxis scale (64 squares = 1 km) and your speeds are specified in kph, then Commute Trip Maximum Time is actually the time in minutes for the longest permitted one-way trip.  It's easy to verify this mathematically.

You might think, "Wait a second!  The Maxis default value for Commute Trip Maximum Time is 6, which implies that Sims can only travel 6 minutes before they run out of time!"  That's absolutely correct.  Fortunately, Sims never have to wait for the bus or the train, because they're always on time, and in fact, they run continuously.  And the three minutes doesn't count the time the Sims use getting to their car from their house, backing out of their driveway, etc.  Still, it's an awfully short amount of time, and it's short enough that all the early NAM traffic simulators tried to fix it in various and sundry ways.

Now we have Simulators A and B, which use speeds which are certainly in the kph range.  But their Commute Trip Maximum Time is 17 and 24, respectively, which implies one-way commute limits of 17 and 24 minutes.  I know that for Simulator A, the rationale for this number was that it was big enough for Sims to cross one large tile on an avenue, which, of course, it is.  But is that the right criterion to use?  How many people have jobs where it takes them only 17 minutes to get to work?  Some, but not many.  What would happen if that were the limit in the real world?

To be more specific, a value of 17 isn't large enough for Sims to drive from one corner of a large tile to the opposite corner and back, especially since true diagonals don't exist.  For cities with zones placed far apart, these values are just too small for such cities to function well.  Even a large tile is only 4 km (or 2.5 miles) wide, and in real cities, zones are often placed farther apart than that.  I am currently building a region of Chicago to scale, and when I tried out the new simulators, the individual cities started falling apart.

So what's the ideal value for Commute Trip Maximum Time?  Well, basically, it should reflect real-world commutes.  I'm currently using a value of 180, which represents a maximum commute of 90 minutes each way, which is not uncommon for a maximum in many places.  This has made realistic traffic flow possible in my cities, as well as greatly improving inter-city commuting.  Of course, once you get past a certain point it doesn't matter how high this number is, since it's reset whenever Sims cross city boundaries.  So I use the 180 number primarily for realism.  However, if the Sims want to take a convoluted route from one end of a large tile to another, which would be realistic in a real city, this number makes that possible as well.


This is certainly interesting.  Could you please give details, as this may be relevant to the work some of us are doing?  For example, I would expect that this would affect just the middle lane of a TLA-3; is this true?  And if so, does it affect the entire middle lane, or only certain squares?  And which parts of a TLA-5 are affected?


Quote from: z on September 05, 2008, 02:36:32 AM
This is certainly interesting.  Could you please give details, as this may be relevant to the work some of us are doing?  For example, I would expect that this would affect just the middle lane of a TLA-3; is this true?  And if so, does it affect the entire middle lane, or only certain squares?  And which parts of a TLA-5 are affected?

All parts would be effected.  The outside tiles have paths into the centre ones as well as paths to the north and south.


Quote from: jplumbley on September 03, 2008, 07:49:48 PM
EDIT September 3, 2008
New information about how Intersections are determined was discovered today, which directly relates to how Capacity is determined on a network.  It has been discovered that a tile consisting of paths from 3 or more sides is considered to be an intersection, no matter whether the tile is part of a network in which it is intended to be a straight through piece or not.  For example, the Road network straight piece has paths which run North-South through the tile, and its effective capacity is equal to that of a normal network tile.  But with the TLA-3,which is based off of the Road network, there are left turn paths that leave the tile on both the East and West sides of the tile.  Due to these new paths, it makes the tile considered to be an intersection even though visually it is not.  Since it is considered an Intersection these tiles are effected by the 1.6 Intersection and Turn Capacity Effect where in the NAM Simulators "A" and "B" it is the effective capacity of 150%.

I guess this explains my finding, which I posted at http://sc4devotion.com/forums/index.php?topic=9124.0 before. For the sake of completeness, I still wonder though why a ped bridge doesn't have the same effect. Is that because that is a different kind of network which doesn't interfere with other networks? To illustrate, here's an image of what I mean (notice how the road overpass creates congestion on the avenue while the ped bridge doesn't):

I have no idea of network modding in SC4, but maybe there could be a way to cure that behaviour of overpasses creating congestion on the underlying networks, using something that "resembles" the ped bridge...? Otherwise, this is just one more reason why access to the source code would be needed to fix something.  &cry2


What you mentioned in your original post happens because the game is not entirely 3D, and so you can get intersection effects at overpasses.  But in order to get intersection effects, the same travel types (e.g., cars) have to be able to travel on the crossing networks, and that isn't true for your pedestrian overpasses.  There's really no way to fix this without, accessing the source code, as you mentioned, and even then, I would expect it to be a major amount of work to fix.


Thanks for your quick reply. :) I'll still keep my fingers crossed that maybe one day, Maxis will show some consideration and allow someone under a non-disclosure rule to fix this in the source (and that there is actually someone willing and capable of doing it). After all, it's a bug that affects the vanilla game all the same. Having said that and being a newbie on the forums here; is there some kind of central thread to gather game engine bugs? This would belong to such a thread imho.


Quote from: HeinBloed4711 on October 27, 2009, 03:55:40 PM
Is there some kind of central thread to gather game engine bugs? This would belong to such a thread imho.

I don't believe so, but I'm sure someone will correct me if I'm wrong.


Jason, would you be willing to update this document with what's been learned in the last year?

I know there are a few more variables that we do now know what they do that aren't mentioned.

Some things also bear clearing up such as:
You state congestion is (evening + morning /2) / network capacity.
Later on in a reply you state it as (evening + morning)/network capacity.

&Thk/( In fact at this point I don't even remember which is the correct formula.  :-\

These little kinds of things led me to pestering you and Steve with questions sooner than I might have otherwise.
A more up to date and comprehensive document would also have prevented many of my stupid questions (yes, there IS such a thing as a stupid question).
It is unlikely I will be the last person to come along and take an interest in the traffic simulator either. And the next person might be even dumber than me :P

Way to necro a thread btw.  :thumbsup:


Quote from: jplumbley on October 29, 2009, 04:06:50 PM
I have fixed that formula.  You don't divide by 2 like was previously thought.

If you have any questions about other areas, please point them out.  I need to re-read the document and see what is there again, but I would rather finish off reading my novel right now, so I will not be doing that right now.

Taking a break from all this, even if just for a night doesn't sound like a bad idea to me either.  :thumbsup:

A few additions:
Customers/Traffic Noise Coefficient. I am now pretty certain in my game the var is called "Unknown" because that is one of the few unknowns I have left and the values jive with what Steve has said in his post where he lists the different values that Maxis, A,B, Z use.
Pathfinding heuristic may be labeled nearest destination attractiveness.

Also if you'd rather I pm you with it, or even write up some of it in a proper format to fit I will.
I am prefectly willing to do the work. I just am not qualified to pick the content. That and I'm pretty sure I can't edit your post :P


it is locked so where can i get it now?