First Traffic Simulation

We’ve begun early prototyping work for the internal colony management.  You can see one of our early graphics tests here.  But this week, we’re thinking mainly about the city simulation itself.

The growth of a city is primarily a function of demand for housing, jobs, and services; and transportation of people and goods.  Transportation will be especially interesting in High Frontier because available land is constrained, but we have lots of options to choose from.  Roads will certainly be possible, but we’ll also have things like monorails, moving walkways, and good old-fashioned walking or biking.

So how do we model all those different modes of transport, and their effects on city growth?  The first step is to build a network of all the places you can travel or change transportation modes within the city.  Then, we simulate trips on this network.  Those trips use an algorithm that takes into account the travel speed, wait time for buses or trains, whether the person traveling has a car, and so on.  The fastest path for each trip is found based on all those factors.  We count up how often each link is used over many trips, and that tells us how high the traffic is on any of those links.

Traffic1The image above shows the first test of all that computation.  We’ve modeled here a small town with foot paths in green, a bus route in red, and a monorail in purple.  There is a 10-15 minute wait, on average, for a bus or monorail, and the whole map is about a kilometer across.  The width of each link shows how often that path was taken.

The results are none too surprising; on this scale, our simulated residents mostly get around on foot.  They’re impatient little folk, and waiting for the bus or monorail is only worth it when going a long way.  (Both of these public transit systems were chosen a few times; just not as often as walking.)

In this early simulation, the origin and destination of each trip were chosen completely at random.  In the full city simulation, we will probably model specific kinds of trips instead: home to the store, home to school, work to home, home to recreation, and so on.  For each of those, we’ll generate a random simulated resident, figure out where he lives, and then choose the other end of the trip (school, work, etc.) according to what’s available nearby.  So, depending on how the different kinds of buildings are arranged, you’ll see more or less traffic in the appropriate places.

That’s the transportation part.  What about city growth?  We haven’t prototyped that yet, but we do know how it’s going to work.  Basically, whenever there is overall demand for buildings of a particular type, we’ll simulate builders that look at all the available lots, and choose to build where the transportation network best links into what that type of building needs.  For example, commercial buildings need customers; industrial areas need workers and good shipping; houses need nearby shops, schools, and jobs.  So what buildings appear depends on the transportation network… and traffic on the transportation network depends on the buildings.

I won’t try to fool you; building the city simulation is a big job.  But we’re up to it.  Keep watching here for more results as they develop!

3 comments on “First Traffic Simulation”

  1. scottmcglasson

    Greetings!

    I’m a member of the Space Opera group on Facebook, a motley collection of nerds, fans, and wannabe writers who’s primary interest is big, sprawling epics in the vein of Banks, Reynolds, Hamilton, etc. Obviously, this project is of interest, so I posted a link to your page in the group.

Comments are closed.