Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Door Permissions  (Read 868 times)

FearfulJesuit

  • Bay Watcher
  • True neoliberalism has never been tried
    • View Profile
Door Permissions
« on: March 07, 2011, 11:16:51 am »

It's well-known that the biggest FPS crash causer is pathfinding.

I propose that doors have permissions to dictate which dwarves can go through it and which can't.
Logged


@Footjob, you can microwave most grains I've tried pretty easily through the microwave, even if they aren't packaged for it.

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: Door Permissions
« Reply #1 on: March 07, 2011, 11:34:26 am »

I don't think you understand how this sort of thing works...

Pathfinding creates a map of connected tiles, and all units use this same connection map.  In fact, a reason why flying civ races don't work is because they always use a walker's connection map, and don't "see" the open air tiles to fly into. 

More to the point, pets who try to path through a door that is pet-impassible just bonk their head on the door and keep trying to get through, because the connection map doesn't remove a tile from consideration in pathing, even if the pet has already tried to path through that door. 

You'd just have the exact same thing, but with dwarves, now.
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

Starver

  • Bay Watcher
    • View Profile
Re: Door Permissions
« Reply #2 on: March 07, 2011, 11:49:38 am »

It's well-known that the biggest FPS crash causer is pathfinding.

I propose that doors have permissions to dictate which dwarves can go through it and which can't.

My first thought was "how will this help"?  c.f. the pathfinding thread, either there's an every-time search for paths, or a cached set of paths which would need to be multiplied to take into account "this dwarf can go this way, but this other has to take a huge diversion".

Then I realised that perhaps you're looking toward saying that a dwarf who is essentially only ever hauling no-longer forbidden dump-stone from the quantum garbage zone into the respective stone stockpile (frexample!) might regularly travel along a corridor winding around various hazards but whose side-doors that lead into the farming zone/etc are locked to him/her and thus the current pathfinding algorithm doesn't try to explore those sideroutes (and nor would any future versions of the algorithm, if they did in the first place) and just goes straight into the various stockpile areas that are allowed to try to find the best way to the one being directed to.

My immediate response to that is that burrow-designation[1] should help.  Except that (contrary to my initial assumption) burrows only generally deal with destinations, and do not need to be linked.

I think you're generally onto something, except that (pet and dwarf access differences aside, w.r.t. doors) I can't come up with a particularly good in-context reasoning behind it (beyond copying whatever rationale there is behind burrows themselves...  "Yeah, well, I'd love to go to the mess hall, but it is Armok's will that I keep cutting away through this rock...  Say, could you bring me a bucket of water next time you're not busy, mate?  Assuming that Armok hasn't told you to stay in the vicinity of the farms, that is...".



(Sorry, someone's already replied in front of me, but I'm being rushed out of the office, so won't review for ninjaship, right now.)

[1] To derail a moment, what I'd love is a way of, frexample, not just "designate to burrow" or not, and if a dwarf is designated to a burrow he's effectively barred from (choosing a destination in) all those he's not, but designating the food'n'drink or bedroom burrows as "allowed if other burrows are positively defined for <foo>, but not exclusively restricted to if no others are".  The alternative is to designate "priority farm" burrows (being an example where you cover the fields that you want certain farmers to prioritise crop management with) to also include zones covering the sleeping and eating and drinking areas.  I know they'll tend to abandon burrow restrictions when very hungry/thirsty/tired, but I'd rather avoid that kind of stress-test.  The other version would be to allow burrows to be "<this> designated area, plus these other burrows that I've marked as dependencies".  This would also allow an "inside" burrow to be composed entirely of "main stairwell" burrow, "dormitory" burrow, "food'n'drink" burrow, etc, etc, adding the ones for workshops, underground fields, above-ground-but-within-walled-area bits, easily add or subtract the depot/depot-accessway areas, dum de dum de, dum, without having to essentially repeat all of these designations into one massive burrow designation, which then accidentally gets deleted when your fingers are too quick and try to (d)esignate prior to escaping out of the burrow-management screen...  Anyway, end of derail. :)
Logged

FearfulJesuit

  • Bay Watcher
  • True neoliberalism has never been tried
    • View Profile
Re: Door Permissions
« Reply #3 on: March 07, 2011, 12:56:49 pm »

Yeah, basically. It's really an anti-burrow...sometimes it's much easier to tell a dwarf where he can't go than where he can. Maybe it'd just be best to implement anti-burrows.
Logged


@Footjob, you can microwave most grains I've tried pretty easily through the microwave, even if they aren't packaged for it.

Starver

  • Bay Watcher
    • View Profile
Re: Door Permissions
« Reply #4 on: March 07, 2011, 02:17:20 pm »

Yeah, basically. It's really an anti-burrow...sometimes it's much easier to tell a dwarf where he can't go than where he can. Maybe it'd just be best to implement anti-burrows.
It would depend upon your exact design[1], but Restricted Traffic zones at key points do tend to improve certain pathing options at the cost of spoiling others.  Bias this towards helping the regular traffic (such as the almost eternal back-and-forths between quantum garbage-piles and store-rooms set up to receive the de-garbaged items) at the expense of making rarer trips (e.g. between magma workshops and farms, where you have a decent intermediate food processing, storing and consumption points) less efficient to calculate.

But a lot will depend on the layout.


And as NW_Kohaku says (now that I've managed to find a computer outside of work from which to add to my previously rushed post), part of the problem is that there seems basically to be, at present, an equal omniscience of path-knowledge shared around everybody who wants to do anything but random-walk or make other short-term line-of-sight forays.  Part of the Improved Pathfinding idea is to perhaps implement a hierarchical/layered pathing matrix so that flyers can utilise air tiles regardless of ground access, (future) burrowers and (also future) wall-scalers/moat-bridgers/barrier-deconstructors can find themselves an intelligent non-standard route without trying to press around impassible or hyper-trapped pathways.

It may also allow for a more realistic amount of sub-omniscience (even fortress-dwellers need to learn routes, and immigrants/traders/invaders/siegers have to explorer, possibly pass on knowledge, and observe where others can (and can't!) travel with impunity) with agent-learning of pathways.  At least until Armok makes some strange new reconfiguration they haven't encountered and suddenly it is not correct to wander up to the base of the magmafall, activate the pressure pad which temporarily shuts it off and then quickly skip along alternate diagonals to avoid it being reactivated before firey starts off down on its own accord due to a hyrdomechanical timer tripping out.


But, to return to the door idea, you know how pets bash themselves against pet-impassable doors (at least until a dwarf wanders through, and they squirrel their way past the barrier (not to mention rabbiting, cowing, cameling, cougaring and now, it appears, pandafying)), without a major overhaul of the pathfinding, all that a particularly dwarf-picky door could probably do is make a dwarf re-compute the path once they encounter the obstacle that is biased against their passage, find almost exactly the same route as before and make this dwarf similarly fret against the portal until some key-holder who is allowed through wanders that way and lets them have a go anyway.  If that's their best route.

It it wasn't their best route, then the pathfinding would still explore beyond the door, the dwarf would still realise (after the same amount of pathfinding effort) that they're going somewhere other than through that door, and then set out along that route with no more (or less) effort expended than without the door being barred to them.


I suppose that an initially useful door-locking integration with pathfinding would essentially be the same as using player-defined 'hints' (above and beyond the hints that are Restricted Travel designations, as already discussed), something that is a little frowned upon by those who think there should be a way for the program to automatically work out some shortcuts for the pathfinding algorithm without having to ask the player what he or she wants it to do.  So if a door marked "Not for Urist McStonehaulers use!" in the game data is encountered when checking Urist McStonehauler's route, it'd temporarily prune that possible branch.  But even then, there are problems in that a certain amount of duplication of the "everydwarf/everyelf/everyFB/everykobold" basic route map would be needed.  Or changing the central copy and then 'unpruning' it (either by a form of undo, which is a copy, or re-running the whole pathfinding again to clear out the special case alterations from the cache).  Computationally, I foresee slowdowns.

At least that's how I see it.  ICVWBW.


[1] As us players often make completely strange design decisions in order to take account of (or, by some estimations, exploit) certain strange game conditions, I don't doubt
Logged

Sphalerite

  • Bay Watcher
    • View Profile
    • Drew's Robots and stuff
Re: Door Permissions
« Reply #5 on: March 07, 2011, 04:40:45 pm »

Yeah, basically. It's really an anti-burrow...sometimes it's much easier to tell a dwarf where he can't go than where he can. Maybe it'd just be best to implement anti-burrows.
Burrows don't actually control where dwarves go.  Burrows control what objects and buildings a dwarf is allowed to use.  A dwarf assigned to a burrow won't use objects or buildings outside the burrow, but nothing stops him from walking outside the burrow while on the way to something he can do.  Anti-burrows would have the same effect - a dwarf wouldn't be able to use any items or buildings in the anti-burrow, but nothing would stop him from walking through it.
Logged
Any intelligent fool can make things bigger and more complex... It takes a touch of genius --- and a lot of courage to move in the opposite direction.

Bohandas

  • Bay Watcher
  • Discordia Vobis Com Et Cum Spiritum
    • View Profile
Re: Door Permissions
« Reply #6 on: April 12, 2011, 04:11:45 pm »

Yeah, basically. It's really an anti-burrow...sometimes it's much easier to tell a dwarf where he can't go than where he can. Maybe it'd just be best to implement anti-burrows.

I am in favor of both anti-burrows and door permissions.
Logged
NEW Petition to stop the anti-consumer, anti-worker, Trans-Pacific Partnership agreement
What is TPP
----------------------
Remember, no one can tell you who you are except an emotionally unattached outside observer making quantifiable measurements.
----------------------
Έπαινος Ερις

Jeoshua

  • Bay Watcher
  • God help me, I think I may be addicted to modding.
    • View Profile
Re: Door Permissions
« Reply #7 on: April 13, 2011, 06:45:13 am »

More than door permissions, it would be nice if forbidding a door removed its tile from the connection map.  So that forbidding a door into an unused section of the fortress would stop the pathing system from searching that area.

It would be more efficient than building a wall, which is what I do now, currently.
Logged
I like fortresses because they are still underground.

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: Door Permissions
« Reply #8 on: April 13, 2011, 11:11:56 am »

More than door permissions, it would be nice if forbidding a door removed its tile from the connection map.  So that forbidding a door into an unused section of the fortress would stop the pathing system from searching that area.

It would be more efficient than building a wall, which is what I do now, currently.

I believe this is how it already works, currently.
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

Aquillion

  • Bay Watcher
    • View Profile
Re: Door Permissions
« Reply #9 on: April 14, 2011, 07:58:38 pm »

It might be unintuitive to say this, but door permissions would actually make pathfinding worse, not better, since it would make the caching much more complicated.
Logged
We don't want another cheap fantasy universe, we want a cheap fantasy universe generator. --Toady One

FearfulJesuit

  • Bay Watcher
  • True neoliberalism has never been tried
    • View Profile
Re: Door Permissions
« Reply #10 on: April 14, 2011, 08:17:03 pm »

What if you had a cache of well-traveled paths for each dwarf, and for each dwarf the computer checks each of them to see if it goes where the dwarf wants to go, and only innovates a new path if it can't find one?
Logged


@Footjob, you can microwave most grains I've tried pretty easily through the microwave, even if they aren't packaged for it.

Starver

  • Bay Watcher
    • View Profile
Re: Door Permissions
« Reply #11 on: April 15, 2011, 05:48:12 am »

You're getting into the territory of the "Improved Pathfinding" thread.  Or threads, as there have been several others.

I've a feeling that while the currently active thread on this subject isn't currently dealing with the issue of non-global pathfinding maps, there's still significant overlap, unless you can persuade that thread to abandon all future claims to a discussion of multiple path-caches[1] I can see the same old arguments being posited both here and there.  (Albeit already mostly the same arguments as have been posited in times past, but I'm an optimist and feel sure that there will be something new arising.)


[1] One for each distinct unit.  Or at least group of agents with identical permissions and possibilities, such as the goblin death squad that's just learnt about the trapped main entrance and is now seeking an apparently non-trapped entry, or indeed all workshop dwarfs for whom a certain door into the quarry-face has been barred, whereas haulers are barred only from the main exit into the wilds and miners aren't barred from anything of significance.
Logged