Difference between revisions of "Tutorial:Understanding the Traffic Simulator"

From SC4D Encyclopaedia
Jump to navigation Jump to search
sc4e>CasperVg
(added {{tutorial}})
sc4e>Warrior
(link to original tutorial)
Line 1: Line 1:
{{tutorial |author=Jplumbley |site=SimCity 4 Devotion}}
+
{{tutorial |author=Jplumbley |site=SimCity 4 Devotion |original=http://sc4devotion.com/forums/index.php?topic=3907.0}}
  
 
__NOTOC__
 
__NOTOC__

Revision as of 09:54, 16 October 2008



Intro

The Traffic Simulator is a very complicated simulator and it is very mathematically intensive. Each Property within the Traffic Simuator has a different effect, but many of the Properties are closely tied together and must be tuned as a whole. Due to this it is recommended that you do not tamper with the simulator without the proper knowledge and the confidence in your mathematical calculations. This is an informative guide that will help describe the Properties, their functions and how everything is tied in together.

Not all properties are known about and their effects can be harmful to your game if modified in anyway. In the future some additions to this guide may be added due to new discoveries.

Properties

The most important Properties in the Traffic Simulator are:

 The Network Speed properties
 Commute Trip Maximum Time
 Pathfinding Heuristic
 Network Traffic Capacity
 Travel Type Generates Traffic
 Travel Type Can Reach Destination

These properties are the heart of the Traffic Simulator because they determine what the Simulator's boundaries are and how it is to react. The other properties affect the Simulator in other ways but are not required for the Simulator to run.


Network Speed Properties

Sample:

Walking Speed= 5,0,0,5,0,0,5,0,0,0,5,0,0
Driving Speed= 60,0,100,40,0,0,60,0,0,0,60,100,100
Bus Speed= 55,0,90,35,0,0,55,0,0,0,55,90,90
Train Speed= 0,110,0,0,0,0,0,0,0,0,0,0,0
Truck Speed= 55,0,90,35,0,0,55,0,0,0,55,90,90
Freight Train Speed= 0,150,0,0,0,0,0,0,0,0,0,0,0
Subway Speed= 0,0,0,0,0,0,0,150,0,0,0,0,0
El Train Speed= 0,0,0,0,0,0,0,0,150,0,0,0,0
Monorail Train Speed= 0,0,0,0,0,0,0,0,0,200,0,0,0


These are the speeds of the corresponding Path Types. The Path Types have their own properties and each value for the properties define the speed for the specific Network. There are 13 values and in order the values define the speed for the following networks:

 Road
 Rail
 Highway (Elevated)
 Street
 Pipes
 Power Poles
 Avenue
 Subway
 Elevated Rail
 Monorail
 One Way Road
 Dirt Road (ANT/RHW)
 Ground Highway

Or in a table format:

Traffic Type:
Network Type: Ro Ra Hw St Pi Po Av SW ER MR 1W DR GH
Walking Speed 5 0 0 5 0 0 5 0 0 0 5 0 0
Driving Speed 60 0 100 40 0 0 60 0 0 0 60 100 100
Bus Speed 55 0 90 35 0 0 55 0 0 0 55 90 90
Train Speed 0 110 0 0 0 0 0 0 0 0 0 0 0
Truck Speed 55 0 90 35 0 0 55 0 0 0 55 90 90
Freight Train Speed 0 150 0 0 0 0 0 0 0 0 0 0 0
Subway Speed 0 0 0 0 0 0 0 150 0 0 0 0 0
El Train Speed 0 0 0 0 0 0 0 0 150 0 0 0 0
Monorail Speed 0 0 0 0 0 0 0 0 0 200 0 0 0

The speed value for the Path Types are in # of Tiles per Unit of Time. Therefore in 1 unit of time based on the above example, a Sim will walk 5 tiles.

Commute Trip Maximum Time

This has one value. It is the maximum trip value as stated in the title. The MAXIS default value is 6. This means if the speed of the Path Type is 31 tiles per unit of time then for the entire there and back travel distance can be 186 tiles.

Tiles per Unit of Time = 1/31 Maximum Commute Time = 6

1/31 = 6 Travel Distance = 31x6 = 186 Tiles

Due to this being there and back, this would mean the maximum distance from work being from home can be 93 tiles. Since it would be 93+93 = 186 tiles.

  • Note: The Maximum Mass Transit Strategy Trip Length operates in the exact same fashion as the Commute Trip Maximum Time property.


Pathfinding Heuristic

This is an accuracy function of the Simulator. Basically, the lower the value the more accurate and more paths the Simulator will search before selecting the route for the Traffic.

The way the Simulator calculates the path is based on a Manhattan A* Algorithm. There are articles around the web that can explain this Algorithm better than I can.

A* Pathfinding for Beginners


Network Traffic Capacity

Network Traffic Capacity is exactly what it sounds like. It is the capacity for each network. The capacities are defined in the same fashion as the way the Speeds are where the values are tied in a specific order to which network it refers to:

 Road
 Rail
 Highway (Elevated)
 Street
 Pipes
 Power Poles
 Avenue
 Subway
 Elevated Rail
 Monorail
 One Way Road
 Dirt Road (ANT/RHW)
 Ground Highway

Capcity is an important property for the simulator though it may not seem like it would be. If you are trying to re-create realistic paths, then a Maximum Capacity is definately required. Every network doesnt restrict the number of cars that are allowed on them, but this value is used to determine the congestion of the network.

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.

Congestion vs Speed

This has an infinite number of values defined by the user. In alternating values it defines:

Value A = Congestion % of Network Value B = Speed Multiplier Adjustment

Value organization: A,B,A,B,A,B,A,B

Sample: 0,1.4,0.25,1.3,0.50,1.2,0.75,1.1,1,1,1.25,0.9,1.5,0.75,1.75,0.5,2,0.2

Translation:

Congestion
vs
Speed
0%
140%
25%
130%
50%
120%
75%
110%
100%
100%
125%
90%
150%
75%
175%
50%
200%
20%


Essentially, this will slow your Sims down for the higher congestion your network may have. If the speed gets too low the Simulator will find a faster way to get around it. Maybe by taking another road or street.

Intersection and Turn Capacity Effect

This is a properrty that modifies the Capacity of an intersection and the 2 tiles leading upto the intersection. Hence the three values of the property. The first value modifies the capacity of the Intersection itself and the following two values modify the capacity of the two tiles leading upto the intersection.

Example for a Road:

Values = 1.5, 0.8, 0.9

This means that at the Intersection the Capacity is multiplied by 1.5, the tile next to the intersection is multiplied by 0.8 and the tile before that is multiplied by 0.9.

So, if the Capacity for the Road is 2500, then the actual capacities of these tiles are:

 Intersection = 3750 
 1 Tile away  = 2000 
 2 Tiles away = 2250 

This causes the Simulation to act as if the 2 Immediate Tiles are "slow downs" for the intersection when coupled with a properly designed Congestion vs Speed Property. This setup makes is so that the intersection has a proportionally higher capacity since there are two separate routes. This increase in Capacity at the intersection tile allows for both routes to be used to almost fully and not being hampered by the intersection.

Travel Type Generates Traffic

This is a value that determines whether or not the Traffic Type will add to congestion. It is a yes (1) or no (0) value. The order of these Traffic Types is:

 Walking
 Car
 Bus
 Passenger Rail
 Truck
 Frieght Rail
 Subway
 El-Rail
 Monorail

In the MAXIS Original values Subway is set to not add to congestion. Buses and Pedestrians are also set not to add to congestion. There is no phyisical way for the Simulator to do a simple math calculation for busses such as 20 Bus Trips = 1 Car Trip so, each Sim will always be equal to 1 Bus Trip = 1 Car Trip no matter what. This is the reason Busses do not add to congestion and the reason they are given such a big preference when you have a high population city. This one simple calculation added as another property in the Simulator could have made a big difference.


Travel Type Can Reach Destination

This is a set of values that does exactly what it says. It is a yes (1) or no (0) value that determines whether the Traffic Type may reach their destination. The order of these Traffic Types is:

 Walking
 Car
 Bus
 Passenger Rail
 Truck
 Frieght Rail
 Subway
 El-Rail
 Monorail

The default game has Walking (Pedestrians) and Cars set to (1) and allows these two transit types to reach destination. So, this means your Sims will have to enter a Commercial or Industrial Lot by Car or Pedestrian.

Travel Strategy Percentage Properties

There are four of these properties. No Wealth, $, $$, $$$. Each one has 3 values and each value is tied to a different Strategy TYpe. The Strategy Types are in order Car Preferred, Mass Transit Prefered and No Preference. Car Preferred will give the Sim travelling the path an advantage to using Car Traffic by penalizing the Mass Transit Strategy. Mass Transit Strategy will give the Sim travelling an advantage to find a Mass Transit Route by penalizing the Car Traffic. No preferrence will not add any penalties to any strategies and the Simulator will look at both Strategies euqally. For this the three values in each Property must add upto 100%. So for example, you can have the Car Prefered 50%, MT Prefered 25% and No Preference 25% but you cannot have 75%, 25%, 50%.


Trip Starting Cost by Travel Type (Mass Transit or Car Preffered)

These are the two properties that determine the Penalties to the "unprefered" Travel Strategies from 1.9. There are 9 values listed here but only two of them really get used. Walking or Car Traffic.

In the Mass Transit Prefered the second value (Car Traffic) is 1.95 as a Starting Cost for the Car Traffic. This means that when the Simulator is calculating the trip cost any path is searches for with Car Traffic, it will add this value to it. For Car Preffered the first value (Pedestrian Traffic) is given the Starting cost.

The reason none of the other Traffic Types require a Starting Cost is because no Sim generates anything other than Pedestrian or Car Traffic. The other Traffic Types are generated by a TE Lot after the initial path is found.