Bay 12 Games Forum

Please login or register.

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

Author Topic: Better sytem for "Dwarves Stay Inside" PLEASE!  (Read 1380 times)

Beacon

  • Bay Watcher
  • Holy Dwarf-Beacon
    • View Profile
Better sytem for "Dwarves Stay Inside" PLEASE!
« on: July 12, 2008, 04:02:09 am »

Now, this has almost certainly been said many times, but I can't find anything.

Anyway, the system right now is really flawed. Most of the time it just doesn't work well enough. What would be ideal would be a new "zone" which upon changing order to "Dwarves stay inside", all dwarves would proceed to this "safe-zone" and stay there until you change it. This safe zone would have food/drink/beds, so the dwarves wouldn't have to leave, and it would effectively solve the whole problem we currently have.

Wat do you guys think?
Logged

Glutton

  • Bay Watcher
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #1 on: July 12, 2008, 04:37:00 am »

Good idea,
but maybe there should be more types of these "defensive zones". In my opinion at least two. One "save zone" for civilians. And then military zones that would have assigned squads to them.
These zones would be inactive by defauld. But you should be able quickly to (de)ativate them from the orders menu. Causing imetiatelly civilians proceeding to the save zones and military running for their places. That would make preparing for the attack much more confortable.

But there is still problem. Do you need crate save zone all over the fortress? Because if you will create jsut the small one... the dwarfs will stay there - without access to anything outside this zone. That can be a problem during long assaults making these save zones eighter uselless or time consuming to plae all over the fortress.

So there should be aven third defensive zone "no crossing by civilians" - once activated the civilians will not walk oer it (it will work like wall for them). This would be used just like difining ouside/inside by manual.

So your actions once siege begins:
1) Activate military posts and save zone (to get civilians inside the fortres - getitng to save zone should be one of the hightest priority)
2) Once all civilians ar at (or near) sove zone = you get them to the corect side of the "denied crossing" zones you will swith it - deactivate save zone (= givving dwarfs free will) - but they will not be able to pass just activated zone = they will not go near entrance...
Logged

Areyar

  • Bay Watcher
  • Ecstatic about recieving his own E:4 mug recently
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #2 on: July 12, 2008, 05:29:42 am »

I think the problem stems from the compromise solution of getting civilians to safety vs having them continue their work during a siege.
A solution would be to cancel all jobs for a duration, getting all civvy dwarves partying in the meetinghalls.
Strange way to welcome a siege, but that's dwarves for ye.

An 'airlock' with locked doors should prevent any unqualified personell from loitering inside the main gate. Even under the current mechanic this would be a good idea.
Logged
My images bucket for WIPs and such: link

Wolfius

  • Bay Watcher
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #3 on: July 12, 2008, 06:55:57 am »

For zone solutions, I'd go with two designations - call then 'green zone' and 'red zone'

Upon being told to 'stay indoors', dwarves will rally at the green zone, if they can path to it, than resume activities. Red zones are impassable to dwarves who are told to stay indoors, provided they've already reached the green zone.

Essentially, you define a place that qualifies as 'indoors' and where 'outside' starts. This has the unfortunate side-effect of canceling/suspending all active tasks, but it should be easy to implement and reliable.

Logged

Glutton

  • Bay Watcher
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #4 on: July 12, 2008, 07:09:58 am »

Wolfius:
This idea have problem that it will consume lot of time to manually specify all red and green zones. Especially in the bigger fortresses. And even after building each new room... we will need to manually specify again zone for that place?  That is not too much user friendly.

For this reason i suggested using small green zones where all civilian dwarfs will run with hightest priority (to get them indoors). But this zone will be just somethink like checkpoint - once dwarf will reach it he will know he is in "safe" area. And then there will be just small red areas that can not be crossed by the civilians - usually put just near each entrance.

So once you put order "stay inside" all dwarwes will run to nearest green zone. And once reached, they will again regain free will - but with the limitation "red zone = wall"
With this solution you jsut need to define the entrance boeadres (red zones) and at least one green zone in the meeting area for example. Then you can dig as you want and untill you create anothe entrance, it will work - without need to define each room manually.
Logged

Aquillion

  • Bay Watcher
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #5 on: July 12, 2008, 08:06:28 am »

I think that's pretty much what Wolfius meant.  At least, that's how I read it.
Logged
We don't want another cheap fantasy universe, we want a cheap fantasy universe generator. --Toady One

Omega2

  • Bay Watcher
  • Too productive for his own good
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #6 on: July 12, 2008, 10:40:06 am »

I like Wolfius idea. Well-designed fortresses are unlikely to have too many surface access areas, instead concentrating traffic in only a couple chokepoints, so it should be easy enough to create a Safe Zone at a food&drink stockpile and a couple Danger Zones that are treated as walls by civilians before the main combat areas.
Logged
Fire in the disco! Fire in the disco! Fire in the dining hall!

Exponent

  • Bay Watcher
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #7 on: July 12, 2008, 11:50:47 am »

Heck, I'd be mostly satisfied if "inside" actually meant inside in this case, not subterranean, and if pathing through outside tiles was actually impossible for the relevant dwarves, so that the entrance dance would be avoided.  I cannot conceive of any reason why these two changes should be difficult at all.

The first would simply be a change of checking one flag instead of another, and would allow us to more easily choose which areas are safe or not (subterranean tiles cannot be created, only removed, while inside tiles can be both created and removed).

The second would simply add an extra check to the path finding algorithm, in the section where it checks to see if a tile is passable.  The extra check would need to know if the creature doing the pathing is allowed outside, and whether the tile is inside or outside.  If the creature is not allowed outside, but the tile is outside, then simply treat the tile as impassable, just as if the tile were occupied by a wall or something.

Although before calculating the path, if the creature doing the pathing is not allowed outside, then starting tile and ending tile would need to be checked as follows:  If the ending tile is outside, then don't do the calculations, and just return that there is no path.  If the ending tile is inside, then if the starting tile is outside, skip the above additional condition (just tell the pathing algorithm that the creature is allowed outside).  All outside tiles should be passable like normal, as long as the destination is inside.  If the starting tile is inside, then do the calculations with the above condition in place.  This will allow the dwarf to run inside if it is currently outside, but will prevent it from grabbing additional jobs that are outside, and will never once let the dwarf step foot outside, if it is already inside and is trying to go somewhere else inside*. 

The biggest remaining problem with this system would be a limit to flexibility, in that sometimes you might want a tile to be inside for one reason or another (perhaps you require it to be subterranean) but you still want it to be off limits.  A completely user-defined system as suggested by everyone above would admittedly probably be the only way to achieve this flexibility.  But it would also take significantly more programming, and would change the file format of the fortress.

*Well, that last part isn't exactly correct.  If the dwarf is outside, and trying to path to an indoor location, it can cross over inside and outside tiles the whole way, passing back outside after it was inside.  The correction to this would be to re-enable the above condition about impassable tiles the moment the pathing algorithm tries an inside tile.  Once the dwarf steps inside, outside tiles become impassable.  This might be undesirable, however, because while attempting to get inside, the dwarf might walk under a small structure (walkway, partial construction, whatever) which causes it to enter an inside tile.  It would then be unable to leave that small inside area if all surrounding areas are outside, and the pathing algorithm would keep trying new paths until it either found one that remained completely outside until reaching the final inside area (which would be dumb), or found no paths at all, causing the dwarf to just stand around outside.  So actually, it's probably best to simply not correct this aspect of the algorithm.
Logged

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #8 on: July 12, 2008, 11:57:36 am »

My idea about restricted traffic could help it  a bit.
Expand the Traffic thing.

For now the "restricted" area counts as a big number of tiles, but it's still passable.
Make it to block the pathing totally, like a wall, so dwarves don't try to find the way through it.
Then, make it customizable. I.e. you move it from designation to zone menu, then you can select the restricted area with 'i' and mark it restricted for civillians only. There should be at least 3 options :restricted off/for civillians/for all. This will help to totally block your entrance after all civillians are in to stop multiple job cancellations.
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Draco18s

  • Bay Watcher
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #9 on: July 12, 2008, 03:04:56 pm »

The problem with restricted traffic = infinity for the A* algorithm is that it already checks them last (i.e. treats them as a wall until 25 (depending on settings) normal tiles have been processed, then it checks that single tile, if there's another restricted on the other side, the algorithm needs to search outwards on normal tiles another 25 times).  Don't forget that it's searching in the direction it would like to go first.  So if you restricted area is east of a dwarf that's going west it'll NEVER search those tiles.

Making the pathcost 99999 just creates MASSIVE pathfinding lag when A* runs out of non-restricted tiles (as it will use up every single last one before pathing through a single restricted tile) removing the entire point of the optimization of A* algorithm.  Treating them as walls will instead cause unmessaged pathfinding errors (depending on what the dwarf is trying to do--they already get stuck after building walls and workshops and don't cancel ANY task, including eating).
« Last Edit: July 12, 2008, 03:08:06 pm by Draco18s »
Logged

Haven

  • Bay Watcher
  • Studiously Avoidant
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #10 on: July 13, 2008, 12:19:09 am »

I think this could be covered when burrows are introduced. Stay indoors could be supplemented by 'Stay in burrow', which'll keep the Entrance Dancers away... Unless their burrow IS the entrance, in which case they probably weren't your favorites anyways...
Logged

Faces of Mu

  • Bay Watcher
  • I once saw a baby ghost...but it was just a tissue
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #11 on: July 13, 2008, 08:53:15 am »

I think this could be covered when burrows are introduced. Stay indoors could be supplemented by 'Stay in burrow', which'll keep the Entrance Dancers away... Unless their burrow IS the entrance, in which case they probably weren't your favorites anyways...

Yup, these ideas sound like more limited versions, or prototypes even, of burrows.
Logged

Nazush Ebsas

  • Bay Watcher
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #12 on: July 13, 2008, 03:19:17 pm »

Perhaps just allow the user to set oneway areas, activatable by zoning menu or automatically linked through indoors/soldier indoors, if the dwarf has to pass through the oneway area the wrong way whilst outdoors is barred, he gets a job cancellation, if not, he carries on as usual.
Logged

Tiler

  • Bay Watcher
  • [ODOR_LEVEL:999]
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #13 on: July 13, 2008, 04:47:14 pm »

I think it'd be more efficient just to try to take out the incentives for going outside, rather than trying to screw around with their pathfinding. If it were possible, it'd be nice if the dwarves would just run a check to see if something was 'outside' before they begun their death march to go claim it. A cheap idea for short term would just be to autoforbid everything outside when the 'Stay Inside' order is given, but you'd still end up with those stupid dwarves obsessed with drinking river water and shooting animals full of arrows.

I think a solution for right now would be to design some kind of dwarven air lock, as someone said. I'm going to test it out with my current fortress, and the idea is to have the barracks next to the front entrance, and have lockable doors and areas with roofs dug out and covered up so it's marked as 'Light' instead of subterranean.
Logged

Kohana

  • Bay Watcher
    • View Profile
Re: Better sytem for "Dwarves Stay Inside" PLEASE!
« Reply #14 on: July 14, 2008, 02:21:53 am »

Unfortunately it's not very simple to define a tile as inaccessible and maintain pathfinding efficiency.  As far as I know Dwarf Fortress maintains an accessibility map which divides the map into separate accessible regions.  Any tile in one region can access any other tile in the same region.  Whenever any tile that was accessible becomes blocked or the other way around the game updates this map.  So when checking if something is reachable the game just compares the starting tiles region to the ending tile's region if it isn't the same the game already knows there is no path.  If it is the same then it runs A* to find the exact path there.  Without this the game wouldn't be able to know without testing every accessible tile from the start before it realizes there is not path.

Now after a long winded explanation of that the problem arises in that everything uses the same accessibility map including baddies which is why locking your doors and blocking off any targets break them since they have nothing in their region they can attack so they just act dumb.  So to make the idea work the game would have to maintain two accessibility maps one for the dwarves and one for everything else.  Since some things like fluids can cause changes to this frequently you effectively double that work frequently.  This is also a reason flying stuff can't path as well since to make them work right they'd need another accessibility map to be computed to properly tell where they can and can't go.

The simple solution to this problem is to just have dwarves completely ignore tasks which involve things on outside tiles and to suspend those jobs until they are allowed out and instead take other jobs.  That way the dwarves would continue to work on inside jobs or have no job and not dance around at the entrance continually taking tasks that lead them outside and promptly canceling them when they step on an outside tile.  This would fix most cases.  The only case it wouldn't would be if to get to a tile counted as inside the dwarf would have to pass outside and then they'd go stupid again.  But that'd never be an issue for the way I design my forts so good enough for me :P!
Logged
Pages: [1] 2