Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: How does traffic work?  (Read 1083 times)

blaize9

  • Bay Watcher
    • View Profile
    • Blaizecraft
How does traffic work?
« on: February 25, 2011, 10:05:36 am »

How does traffic work?, can some one explain.
Logged

AdirianSoan

  • Bay Watcher
    • View Profile
Re: How does traffic work?
« Reply #1 on: February 25, 2011, 10:11:57 am »

The traffic areas change the pathfinding weights in the game; this can improve the speed of the game, or encourage dwarves to take particular routes.

An area with twice as much weight is treated as walking two tiles instead of one for purposes of calculating the shortest path, so dwarves will still go over weighted areas if the alternative is just as heavily weighted by virtue of being a longer walk.  So if you have a large room with a restricted tile in the center of it, dwarves will almost never go into that tile.

Well-done trafficking can speed your game up if you have FPS issues and a large fortress/large rooms; poorly done trafficking can significantly slow it down by forcing the game to consider alternatives it wouldn't otherwise consider.
Logged

orbcontrolled

  • Bay Watcher
    • View Profile
Re: How does traffic work?
« Reply #2 on: February 25, 2011, 02:11:05 pm »

Kind of a vague question.

Have you read this yet?
http://df.magmawiki.com/index.php/Traffic

Read it, then if there is something it doesn't answer, ask away.
Logged

blaize9

  • Bay Watcher
    • View Profile
    • Blaizecraft
Re: How does traffic work?
« Reply #3 on: February 25, 2011, 04:29:38 pm »

So if I use high traffic then they will use that path? If I put low traffic I would use that for them not to go there?
Logged

AdirianSoan

  • Bay Watcher
    • View Profile
Re: How does traffic work?
« Reply #4 on: February 25, 2011, 04:52:43 pm »

So if I use high traffic then they will use that path? If I put low traffic I would use that for them not to go there?

- They will -tend- to use that path, or -tend- not to use the low-traffic paths.  A low-traffic marking (or even a restricted marking) only discourages them, it will not outright prevent them from entering an area.

For an example of the difference, say you have a three tile wide corridor, and want them to stay exactly in the middle; high traffic in the middle and restricted or low traffic on the outer edges would lead to them mostly staying in the middle and more rarely drifting to the side (depending on the number of dwarves passing through that area)

But sticking "Restricted" all across the only entry way into your fortress will do nothing except slow your game down as they look for alternate paths - that entry way is still their only path way, and they'll still use it.
Logged

obeliab

  • Bay Watcher
    • View Profile
Re: How does traffic work?
« Reply #5 on: February 25, 2011, 06:18:29 pm »

Envision low and restricted traffic designations as pathing hurdles.  When a dwarf considers how to get somewhere, s/he will prefer not to "jump" over them--they'll generally prefer to take normal traffic areas--unless the traffic designations are blocking the entire path, at which point the dwarves have to "jump" (and will).  They don't slow movement down, but dwarves won't want to walk on them if they can find a reasonable path around them.  Restricted traffic zones covering an entire central area won't do that much, but if you, for example, restrict the center of the room and leave a 1-tile path around the edge, you should notice your dwarves tending towards the edges.  Leave a 1-tile normal traffic path going through the middle of one side... and watch as the beards tend towards that path.

The idea is that, if there are multiple paths to an area (especially noticeable in open areas like outside), you might have some preference about how you want your dwarves getting to that area (to, for example, avoid trampling saplings and all that).  I, for one, haven't had great luck getting FPS gains from setting traffic designations, but supposedly it helps if you've got a bunch of big rooms and lots of different possible paths.

Restricted traffic zones will not prevent dwarves from going somewhere, but they will make dwarves "go around," if there is another path to their objective.  The numbers attached to the different traffic zones--default 1/2/5/25, I think--signify just how far dwarves will go to "go around" the area.
Logged

plisskin

  • Bay Watcher
  • That's "Plissken"
    • View Profile
Re: How does traffic work?
« Reply #6 on: February 25, 2011, 11:01:57 pm »

Traffic designations are used primarily for these things:

1. To keep dwarves generally away from an area such as a goblin pit that would make them cancel jobs if they got too close. Restricting traffic near it helps with this.

2. To improve FPS a little by making pathfinding simpler. Restricting unused areas and making commonly used hallways/areas high traffic does this.

3. To streamline general movement in your fort. Making a web of high traffic areas between commonly used workshops or between stockpiles that take from each other helps keep those dwarves out of the way of other dwarves.

There's other uses but those are the big reasons they exist. It's a micromanagement thing for streamlining forts.
Logged
Legendary Wrestler
Legendary Ambusher

Left Eye