Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: One-way traffic designations  (Read 2019 times)

amade

  • Bay Watcher
    • View Profile
    • amade's illustrations
One-way traffic designations
« on: December 26, 2008, 09:43:43 pm »

Well, I didn't find this suggestion in the eternal voting list...

Say I have two stairwells. I want one to be used only for going up and another for going down. So all I have to do is designate the tiles between a set of up staircase and down staircase to be one-way traffic only and do the opposite way for the other set (won't work with up/down staircase I suppose). Same goes if I have two entrances and want one to be the exit and another to be the entrance.

Laying down the designation should prob'ly work like laying down traffic priority areas, in this case you select the direction of the one-way traffic (possibly limited to N/S/E/W) and then you mark out the area you want.

Problems that may arise:
  • Dwarfs may not be able to cross from one side of a one-way lane to the other, so a possible solution for this is to make it possible for dwarfs to move to the lane's relative left and right so in practice when you designate a one-way traffic area you're actually forbidding dwarfs from going the opposite-way. Also, because of this the dwarfs may jump out of the one-way lane only to enter the other one-way lane you've set up! Obviously care must be taken when laying down the designations (use physical walls or restricted traffic designation).
  • May mess up the traffic priority designation, especially if you can overlap, and cause heavy lag due to the increased pathfinding calcs? Possible solution is to restrict designation so that you can either have a priority or a one-way designation per tile. Even so, dwarfs may wander off a one-way lane they're supposed to follow in order to go into a nearby high-priority area. Possible solution is to make sure you designate your areas carefully, and use a little bit of ingenuity to ensure your dwarfs follow the traffic rules as well as break 'em when necessary :-P
  • Dwarfs may run headlong into danger while obeying traffic rules, but you already get this with the priority designation.

Also I'd like to suggest that military dwarfs can have the option to ignore traffic rules. I hate it when I order a squad to chase some fleeing goblins they choose to follow the traffic designation to get to their target.

...

Watcha guys think?
Logged
¯\_(ツ)_/¯

Draco18s

  • Bay Watcher
    • View Profile
Re: One-way traffic designations
« Reply #1 on: December 26, 2008, 11:16:04 pm »

No, it's not on Eternal, but It has been suggested before.
Logged

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile
Re: One-way traffic designations
« Reply #2 on: December 26, 2008, 11:33:30 pm »

REgardless of whether or not it has been suggested before, these both (one-way + military ignores traffic) sound like grand ideas.

If anything, the pathfinding lag might be reduced; you don't have to recalculate your course to move around someone coming down the opposite way if they, y'know, aren't.
Logged
DF Vanilla-Spice Revised: Better balance, more !!fun!!
http://www.bay12forums.com/smf/index.php?topic=173907.msg7968772#msg7968772

LeadfootSlim on Steam, LeadfootSlim#1851 on Discord. Hit me up!

Tack

  • Bay Watcher
  • Giving nothing to a community who gave me so much.
    • View Profile
Re: One-way traffic designations
« Reply #3 on: December 27, 2008, 02:38:23 am »

i like that, but you might have to make NSEW plus Up and Down. You could just have it act as a wall if they wish to travel in a certain direction, meaning the pathfinding would go around them.
Logged
Sentience, Endurance, and Thumbs: The Trifector of a Superpredator.
Yeah, he's a banned spammer. Normally we'd delete this thread too, but people were having too much fun with it by the time we got here.

Pilsu

  • Bay Watcher
    • View Profile
Re: One-way traffic designations
« Reply #4 on: December 27, 2008, 03:20:29 am »

Toady said it'd be notoriously difficult to code
Logged

Savok

  • Bay Watcher
    • View Profile
Re: One-way traffic designations
« Reply #5 on: December 27, 2008, 12:34:50 pm »

Could it be possible to have a square that can only be moved into from one direction?
Logged
So sayeth the Wiki Loremaster!

TettyNullus

  • Bay Watcher
    • View Profile
Re: One-way traffic designations
« Reply #6 on: December 27, 2008, 06:48:41 pm »

I like the idea, though the only way I can see it happening is if it mimics traffic designation in directional way, ie. restricted all but one way and high traffic in one direction. Won't be perfect, naturally, since dwarves tend to wander off into restricted traffice area if they thinks they can go through it to do something faster... Sometimes right into the hazards  ;D

Could it be possible to have a square that can only be moved into from one direction?

Would need a one-way door or some such mechaism, could possibly emulate with pressure plate, but doubt it'd work since there'd be no pathing to it and nothing stopping escape when it's open.
Logged

Maggarg - Eater of chicke

  • Bay Watcher
  • His Maleficent Magnificence of Nur
    • View Profile
Re: One-way traffic designations
« Reply #7 on: December 28, 2008, 07:49:30 am »

A one way road into the magma pipe.
Ahahahahaha.
Logged
...I keep searching for my family's raw files, for modding them.

JoshuaFH

  • Bay Watcher
    • View Profile
Re: One-way traffic designations
« Reply #8 on: December 28, 2008, 07:56:27 am »

goddamnit, why is it that no one sees the simplest and best answer? Just to it like they do in Rollercoaster Tycoon where you can make "one-way signs"!

set up the sign, tell it which direction dwarves are allowed to walk through, VOILA! You have your traffic designation, except now much more simplified.
Logged

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: One-way traffic designations
« Reply #9 on: December 28, 2008, 06:10:07 pm »

Toady said it'd be notoriously difficult to code

Yeah.  I think this would kind of break the connected components system.  It might be possible to augment that system so that terrain areas only connected by a one-way passage would still remain separate, while a components list data structure thing maintains a special link between the two so that the accessibility checker could detect the one-wayness.  I don't know if that would handle it though.
Logged

JoshuaFH

  • Bay Watcher
    • View Profile
Re: One-way traffic designations
« Reply #10 on: December 28, 2008, 06:17:31 pm »

Hmm, I guess i don't quite understand Footkerchief. If thats the way it has to be though, then i'll just shut up. Lord knows i don't know crap about programming.
Logged

Fieari

  • Bay Watcher
    • View Profile
Re: One-way traffic designations
« Reply #11 on: December 28, 2008, 06:34:42 pm »

You'd have to set up a database of connectivity, as opposed to a simple list.  On the other hand, setting up that database is eventually going to be necessary, once Toady decides to make flying/swimming/magmaswimming creatures work like they fully should.

EVENTUALLY necessary.  It'll take a lot of work to get that working, gutting the old code, setting up new systems for determining "continuous areas", code for the program to be able to navigate the databased zones in a meaningful way, etc.  I'm sure he'll get to it one of these years, but give it time.

On the other hand, maybe he'd work on it sooner if he realized that the same database of connectivity would enable some rudimentary military strategy (as opposed to merely tactics)... "zones of control" could be determined by the computer, and pathfinding could work to find ways around such zones for some unit types, and go straight for the kill with other unit types, and so on.
« Last Edit: December 28, 2008, 06:37:18 pm by Fieari »
Logged

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: One-way traffic designations
« Reply #12 on: December 28, 2008, 06:38:40 pm »

Hmm, I guess i don't quite understand Footkerchief. If thats the way it has to be though, then i'll just shut up. Lord knows i don't know crap about programming.

It's simpler than it sounds.  Basically, the game assigns each tile a "component number" -- component meaning a group of tiles that can all be accessed (on foot) from each other.  So creatures can only path to tiles that have the same component number as the one they're standing in.  The component numbers get updated based on new constructions, locked doors, etc. -- when a passage gets closed, a component might need to get split into two components, so the game goes and updates all the component numbers for the affected tiles.  At least, I think that's how it works.

This is also why flying creatures have so many problems in fortress mode -- the components system assumes that the creatures only need to pathfind by foot.  It might be possible to give tiles 3 different component numbers for the 3 mobility types that come to mind (walking, swimming, flying).

e: oh right, magma-swimming too ^^^^

Although now I realize that still wouldn't be enough -- if a creature has to fly, then swim, then fly to reach a destination, the start/end component numbers won't match up for any pathfinding system.  So it's a little trickier than it looks.  I'm sure Toady already thought all this stuff through anyway though.
« Last Edit: December 28, 2008, 06:45:33 pm by Footkerchief »
Logged

Fieari

  • Bay Watcher
    • View Profile
Re: One-way traffic designations
« Reply #13 on: December 28, 2008, 06:45:36 pm »

Walking, flying, swimming, and hazards... like too hot, too cold, too poisonous, maybe in the future lack of air, etc.  And then you have to worry about those that can fly AND swim, or just fly, or just swim, or just walk through fire, or fly and walk through fire, or swim through fire...
Logged

Veroule

  • Bay Watcher
    • View Profile
Re: One-way traffic designations
« Reply #14 on: December 28, 2008, 07:13:23 pm »

Soldiers ignoring traffic designations is good.  I would suggest that it should only be for ON DUTY soldiers.  This obviously is easily done since everything that isn't a dwarf already ignores the traffic designations.

The simplest solution to make one-way designations is to expand the existing traffic designations so that it is no longer "stepping into this tile", it is instead "stepping into this tile from direction".  Depending on the specifics of the existing code this could be as little as adding 3 lines to have the path finding understand it.  The real problem is in creating the interface.

A very simple interface is to allow setting of a single direction as a preferred direction.  This preferred direction is treated as having the high traffic value, while all other directions would use the value set for the tile.  This would only require an additional 4 bits per tile.  A user can then create a 'one-way' areay by setting a number of tiles to restricted and giving them all the same preferred direction.
Logged
"Please, spare us additional torture; and just euthanise yourselves."
Delivered by Tim Curry of Clue as a parody of the lead ass from American Idol in the show Psych.
Pages: [1] 2