Vehicles behaviour / Source code / Simulation

  • We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

PyromaX63

Recruit
Mar 3, 2023
4
1
Hello everyone !
(Some blabla here, just to introduce^^)
I'm COMPLETELY new to the game, I don't even know how it works (only played about 15 minutes) but I already have questions.
In fact, I'm working on a project for my "graduation" which is the following one : Is closing a major artery of a city benefial for the traffic ? In fact, it's a concrete implementation of the Braess' paradox.
My plan was to make a Python simulation and to compare it with another model, in that case, Cities : Skylines. However, I do get hindered by a few things. First of, my Python sim doesn't work lol...

BUT HERE IS THE REAL SUBJECT OF THE TOPIC : how do vehicles work ????

(I don't know if some threads like this one have already been created and I have absolutely NO TIME to check that. If some of you are aware of that, I'd really appreciate links ! (I'd also appreciate answers^^)

Are their behaviours random ? Do they act together ? Do some vehicles act selfishly ? Was it coded in C++, Java... ? And so on so on... I think there are even more questions that shall be asked, but I don't really know which ones, I'm not a pro^^. By no means I want to have the complete source code of the game but it may help me to understand some things I hope !


(Some more blabla here lol)
I contacted the Paradox Interative support today and I was really kindly told to ask here since there are no devs in the support team.

I hope the thread will be interesting for everyone ;)

Waiting for your answers !

Pyro
 
  • 1Love
Reactions:

ASGeek2012

Colonel
33 Badges
Dec 21, 2019
865
2.083
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris: Nemesis
  • Crusader Kings III
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Cities: Skylines - Campus
  • Stellaris: Megacorp
  • Cities: Skylines Industries
  • Europa Universalis IV: Dharma
  • Stellaris: Distant Stars
  • Cities: Skylines - Parklife
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Green Cities
  • Europa Universalis IV
  • Cities: Skylines - Mass Transit
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Cities: Skylines - Snowfall
  • Cities: Skylines
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Wealth of Nations
  • Cities: Skylines Deluxe Edition
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Synthetic Dawn
Vehicles in the game act more or less independently of one another. Vehicles are not random, they get spawned for specific purposes such as:
- Taking a cim from home to a job
- Taking a student from home to a school
- Going to visit a commercial store, a park, or a monument
- A tourist spawning from outside the city to see some park or monument in the city
- A service building (fire, police, medical, deathcare, postal, garbage) spawning a vehicle to handle a specific task
- A truck spawning from general industry to delivery goods to commercial areas or to export goods out of city
- A truck spawning from specialized industry to deliver raw materials to general industry

That's not necessarily an exhaustive list, but it covers the basics and illustrates that the vehicle agents generally have purpose and are not just there to make things look nice.

The one exception to this is that the game does spawn "dummy traffic" from the outside connections that travel to other outside connections. These only cause a problem if they decide that going through the city is a better route than staying on the highways.
 
  • 1Like
Reactions:

PyromaX63

Recruit
Mar 3, 2023
4
1
Thanks a lot for that answer ! It does help me understanding vehicles behaviour alot more and it's a clear contrast with my own model in the Python simulation.
However, I don't think this explaination will be enough to compare the two models.
Do you have any information concerning the "specs" of the vehicles ? Such as accelerarion, speed, brake, and so on ? I think concrete numbers can be great for the comparison, as I can change that in the Python sim.

Once more, thanks for your answer !
 

MarkJohnson

Field Marshal
16 Badges
Feb 19, 2015
3.451
715
  • Cities in Motion 2
  • Europa Universalis IV
  • Cities: Skylines
  • Cities: Skylines Deluxe Edition
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Stellaris
  • Cities: Skylines - Natural Disasters
  • Cities: Skylines - Mass Transit
  • Surviving Mars
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Cities: Skylines Industries
  • Prison Architect
  • Cities: Skylines - Campus
More simply, a building makes a request, then the nearest, currently available unit at that exact moment, will come directly to the requesting building and make the delivery by the quickest route. It will ignore all other traffic doing this.

so if there is a traffic jam, then the requested unit will continue to wait in line until it gets there.

If it runs out of time (everything in the game is on a timer), it will despawn and then the original building will make a new rewquest. If it fails again, then the requesting building will go abandoned and everyone leaves the building.

Eventually the building will request for new cims to move in, then it will start all over again with whatever requests it needs fulfilled (go to work, shopping, school, garbage picked up, etc.)

There are a lot of exceptions to the rule.

Hopefully that makes enough sense. If not, ask for any clarification.
 
Last edited:
  • 1Like
Reactions:

PyromaX63

Recruit
Mar 3, 2023
4
1
Yeah sure !
I do understand how the spawn mechanism work. Thanks for the explanations !

I do have another question : is it possible to add a vehicle count within the game ?
In fact, I'd like to compare, within a predetermined time, how many vehicles will cross a precise point in that lapse of time.
 

icedancer

Sergeant
8 Badges
Aug 28, 2014
52
19
  • Cities: Skylines
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Parklife
  • Cities: Skylines Industries
  • Cities: Skylines - Campus
Yeah sure !
I do understand how the spawn mechanism work. Thanks for the explanations !

I do have another question : is it possible to add a vehicle count within the game ?
In fact, I'd like to compare, within a predetermined time, how many vehicles will cross a precise point in that lapse of time.
Maybe a non-stop toll booth.
 
  • 1Like
Reactions: