Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Specify traffic by direction  (Read 608 times)

PaulMurrayCbr

  • Bay Watcher
    • View Profile
Specify traffic by direction
« on: April 05, 2013, 10:56:41 pm »

I would like to be able to specify that a square is high-traffic when it is entered from (for instance) the north -  any of the three squares above it. This would allow me to set up directional paths around my fortress and keep dwarves from running into each other when I suddenly need a lot of hauling done.

I would also like to be able to state that doors are locked to dwarves directionally, allowing areas to be emptied of dwarves without having to watch for the last one to leave.
« Last Edit: April 05, 2013, 11:33:06 pm by PaulMurrayCbr »
Logged

SuicideJunkie

  • Bay Watcher
    • View Profile
Re: Specify traffic by direction
« Reply #1 on: April 05, 2013, 11:31:35 pm »

A general keep-to-the-right (or left) rule would help traffic flow in busy corridors.  I'm not sure how compatible it would be with the pathfinding algorithm tho.
Logged

PaulMurrayCbr

  • Bay Watcher
    • View Profile
Re: Specify traffic by direction
« Reply #2 on: April 05, 2013, 11:36:28 pm »

Well, allowing you to specify directional traffic cost allows complex things. For instance, I suspect that you wouldn't need directionality along a whole corridor - just putting it at the 2*2 intersections of major routes would do the job.

Furthermore, it leverages the existing algorithm and doesn't add a lot of complexity to pathfinding. I hope.
Logged

Maklak

  • Bay Watcher
    • View Profile
Re: Specify traffic by direction
« Reply #3 on: April 06, 2013, 07:35:24 am »

Just build wider corridors.

Now a tile can have any of 4 traffic costs, which fits in 2 bits. For what you want you'd need 4 bits and more complex logic inside the innermost loop of A*, which translates to slower pathfinding. It will not be implemented. End thread.

EDIT: Ah, right. It would need 2 bits for every direction, but that's even worse.
« Last Edit: April 07, 2013, 05:02:07 am by Maklak »
Logged
Quote from: Omnicega
Since you seem to criticize most things harsher than concentrated acid, I'll take that as a compliment.
On mining Organics
Military guide for FoE mod.
Research: Crossbow with axe and shield.
Dropbox referral

King Mir

  • Bay Watcher
    • View Profile
Re: Specify traffic by direction
« Reply #4 on: April 06, 2013, 11:40:16 am »

One way doors are something Toady has talked about as desirable, for secret passages and such.

It's not 4 bits. Firstly because dwarves can move in up to 10 directions from a tile, and secondly because you need to specify the cost for each direction, which is a number. Even if you have one cost, plus a passable direction option, that still needs more space than now. And the algorithm is very likely to be heavily impacted by memory latency, so this matters.
« Last Edit: April 06, 2013, 11:44:54 am by King Mir »
Logged

SuicideJunkie

  • Bay Watcher
    • View Profile
Re: Specify traffic by direction
« Reply #5 on: April 06, 2013, 02:52:35 pm »

This is why I suggest that it could be done by checking the clockwise direction first among equal cost paths
.
If your path has just gone north, a slight preference for northeast over north again (as long as it doesn't increase the path cost).
If you path has just gone south, then a slight preference for southwest over south again.
Same for all other directions.

That would keep dwarves tending to the right side of the road and avoid collisions.
Logged

Pootis

  • Bay Watcher
    • View Profile
Re: Specify traffic by direction
« Reply #6 on: April 09, 2013, 10:42:12 am »

It will not be implemented. End thread.

I don't think you can speak for Toady this definitively.
Logged