• Welcome to SC4 Devotion Forum Archives.

Traffic...

Started by Cire360, July 05, 2012, 02:45:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Cire360

I realize that this is probably the wrong place to post this, but it seems like a pretty good place as it will be seen by those who have a very strong understanding of the traffic simulator in SC4.

I've tried as best  i could to simulate the 'traffic' in SC4, with some 200,000 sims using only a couple of different avenues and roads.  The only time i seem to have heavy traffic is between 5 and 6 at night when most are getting off work, as well as first thing in the morning, when sims are leaving for work.

With those exceptions traffic is pretty much calm, and not like when I do play sc4 where i have heavy traffic at all times once i reach a certain population threshold.  Does SC4 only show traffic generated at its heaviest?  Is SC4 traffic simulator based solely around 'rush hour', which kinda would make since aka the name, or am i missing some random factor that SC4 uses as a constant, ie that at any given time 20% of total population will be taking a Sunday drive on Monday or something silly like that?

Thanks for any insight that you can provide.

++Cire

Cire360

Is this a dumb question or does no one have a suitable answer, I really need to know before i can make any more progress.

Tarkus

The visuals of the cars and the actual traffic volume figures are only tangentially related. 

The cars are merely a visual, graphical effect--they technically don't exist in the simulation.  Their density at certain times depends on what kind of graphical and automata plugin (if using the NAM) settings one is running.

There's not really any consensus on what timeframe the morning/evening traffic volume values given by the traffic query represent, though I'd presume they're the daily peak hour volumes.

-Alex

Cire360

Ahh thank you tarkus, i'm gong to probably stay with my style of traffic simulator since it is probably more accurate then what SC4 uses.  Plus I generate traffic by the hour, since not everyone will leave to and arrive home at the same time, nor be going to the same location.

I thought something was wrong with my traffic simulator but i stepped through the code line by line and didn't see anything wrong, i figured that SC4 may be using some constants that in play to effectively increase traffic as the size of the city increased.

I did a core dump of the traffic code from the exe, and it does look like its 'precalculating' traffic density and volume for two different times of the day, only one is going and the other is arriving.  I didn't follow the entire routine as binary code is hard to read and follow.

Thanks once again.

NCGAIO

#4
Quote from: Cire360 on July 05, 2012, 09:30:22 PM
Is this a dumb question or does no one have a suitable answer, I really need to know before i can make any more progress.

You will not have wait for answers if  get all the necessary information  reading this topic - A Guide to the Operation of the Traffic-Simulator - that brings a well-documented analize on the subject.

As you can see the game uses a modified A * algorithm
- Amit's Game Programming -


Perhaps it is one interesting discussion of what you would be using in your project?


- - Ncgaio

Cire360


Sweet some nice information there, but i'd rather do real simulation on it since its closer to real life and for now isn't eating up loads of cpu.  I dunno about you but not everyone here leaves for work at exactly 6am.  I have to be to work for 7 but i only live 5ms away. :)

mike3775

Quote from: Cire360 on July 06, 2012, 10:46:12 PM

Sweet some nice information there, but i'd rather do real simulation on it since its closer to real life and for now isn't eating up loads of cpu.  I dunno about you but not everyone here leaves for work at exactly 6am.  I have to be to work for 7 but i only live 5ms away. :)

I have always thought the simulation in SC4 was way out of whack, even with the different simulators that have been created for it.  It sounds like yours is more realistic

NCGAIO

Quote from: Cire360 on July 06, 2012, 10:46:12 PM

Sweet some nice information there, but i'd rather do real simulation on it since its closer to real life and for now isn't eating up loads of cpu.  I dunno about you but not everyone here leaves for work at exactly 6am.  I have to be to work for 7 but i only live 5ms away. :)



My dear ... no comments ... thought it was something serious and not realize it was a joke.


Sorry to intrude on your hobby it seems that many people want to participate.


Very well thought ... congratulations.

Cire360

I didn't mean to come off offensive NCGAIO, and I apologize if that's how it sounded.

I only wanted to stress that I would rather do a more 'realistic' traffic simulation, where once a user found a job, they would leave for home giving themselves a period of 15 to 20 mins weight when it comes to traveling.  What I mean is that if it takes a user 20m to reach there job under normal circumstances then they would leave for work at say 6:30 if then needed to be to work for 7, giving themselves 10mins lead time.

Again i'm sorry if i came off as being rude that was not my intention.

z

Personally, I don't think that current PCs are up to doing a fully realistic traffic simulation.  Even when tuned optimally, the current traffic simulator slows down the whole game horribly when used on a large city.

Even Maxis isn't doing the type of simulation you're talking about for the new Sim City, which isn't even out yet.  However, they are using the D* Lite pathfinding algorithm, which is far superior to A*, especially in terms of speed.  If I were to build a completely new traffic simulator, I'd base it on D* Lite, too.

Cire360

I seem to have no problems handling it, with 200k sims.  Granted I've still along ways to go, and it could become alot more complex as the thing progresses, but i won't know for sure till things start to get in depth.   If it seems overloaded at that point i'll look at using different measures.

z

#11
With regards to this quote above:

Quote from: Cire360 on July 05, 2012, 10:06:55 PM
I thought something was wrong with my traffic simulator but i stepped through the code line by line and didn't see anything wrong, i figured that SC4 may be using some constants that in play to effectively increase traffic as the size of the city increased.

I did a core dump of the traffic code from the exe, and it does look like its 'precalculating' traffic density and volume for two different times of the day, only one is going and the other is arriving.  I didn't follow the entire routine as binary code is hard to read and follow.

It sure is!  I admire your ability to find and read the traffic simulator at all.  What probably wasn't clear from the code, though, is that not only does the traffic simulator not run every hour, it doesn't even run every day.  On average, it runs once every four months.  It creates routes for the Sims for reference by the rest of the game; that's all.  The Sims can't be said to be at any particular place along the route at any particular time; they are present along their entire morning route for the morning commute, and they are present along the entire length of their evening route for the evening commute.  Internal SC4 time granularity for the traffic simulator is therefore limited to a half day, and routes are not revised for months at a time.

The problem with the traffic simulator is that (at least for A* and D* Lite) it eats CPU time exponentially as the size of your city grows.  So for a city of 200,000, you may not see its impact on the game at all.  But at a population of a million, you certainly will.  And it gets much worse from there.

D* Lite is so much faster than A* that in the new SC4, Maxis is able to run the traffic simulator at every commute period, yielding unique commutes each time.  Yet there are limits to D* Lite, too, which is still exponential.  The new SC is limited to city tiles that are one quarter the size of the Large city tiles in SC4; I strongly suspect that the reason for this is that D* Lite just blows up if the city gets too big.

What kind of pathfinding are you using?  And how are you testing?

Which brings me to another point:  the EULA for SC4.  Please note the following excerpt:

QuoteExcept to the extent permitted under applicable law, you may not decompile, disassemble, or reverse engineer the Software, or any component thereof, by any means whatsoever... All rights not expressly granted herein are reserved by EA.

I think that what you are doing by reading the binary code is clearly what is understood by reverse engineering the software.  If you just did this for your own personal use, I don't think anyone would care.  But if you're building a city simulation game after having done this, you could be in big trouble with EA.  Basically, reverse engineering the software is on par with modifying the executable, which is strictly forbidden.  And discussion of those things that are strictly forbidden by the EULA is prohibited on this site (as well as at Simtropolis).  So if you want to build a new city simulation game and talk about it here, that's fine, but you must be in strict compliance with the SC4 EULA.  Otherwise, we as a site could possibly face liabilities here.

catty


This topic is locked till I can talk to the rest of the Admin Staff re

Quote from: z on July 08, 2012, 02:00:08 AM
...Which brings me to another point:  the EULA for SC4.  Please note the following excerpt:

QuoteExcept to the extent permitted under applicable law, you may not decompile, disassemble, or reverse engineer the Software, or any component thereof, by any means whatsoever... All rights not expressly granted herein are reserved by EA.

I think that what you are doing by reading the binary code is clearly what is understood by reverse engineering the software.  If you just did this for your own personal use, I don't think anyone would care.  But if you're building a city simulation game after having done this, you could be in big trouble with EA.  Basically, reverse engineering the software is on par with modifying the executable, which is strictly forbidden.  And discussion of those things that are strictly forbidden by the EULA is prohibited on this site (as well as at Simtropolis).  So if you want to build a new city simulation game and talk about it here, that's fine, but you must be in strict compliance with the SC4 EULA.  Otherwise, we as a site could possibly face liabilities here.
I meant," said Ipslore bitterly, "what is there in this world that truly makes living worthwhile?" DEATH thought about it. "CATS," he said eventually, "CATS ARE NICE.