Bay 12 Games Forum

Please login or register.

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

Author Topic: Should all rooms be zones, like the hospital  (Read 3519 times)

Wyrm

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #15 on: June 08, 2011, 05:48:54 am »

But if you had a bedrooms zone that makes every room with a bed in it a bedroom that would be much quicker. Especially if you could assign that zone like a burrow with multiple z-levels and so on.
But then how do you detect rooms within the zone?
Logged

Starver

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #16 on: June 08, 2011, 08:15:22 am »

Best guess, an automated version of the room-resizer process.  For every tile spot that isn't already part of a room or on a wall-like barrier (includes doors, floodgates, raised(/raisable?) bridges, yadda ydada yadda, including ones designated but not yet fulfilled by te constructors/haulers) flood-fill to the greatest extent (stops at barriers and zone-edges) to say "this is a room".  Repeat while there are still zone-tile needing looking at.

Actually, simpler than that, for the situation as already given, because you only need to look at every bed in the zone and flood-fill outwards from these, ignoring all tiles that are bedoom-in-potentia but don't have the suitable furniture.  If you find a second bed, then it's probably a dormitory (maybe interface asks you which bed you want to be the 'head bed'?), but otherwise you've got a simple bedroom.

As per current situations, where temporary/yet-undug walls constraint the room expansion but the room designation stays static even when such obstacles are removed (and even if walls are built across a room?  ...don't know, I've never intentiaonally tried that and looked at the results), you may have to spark it off again to:
a) discover new rooms that didn't previously have beds, but now have, and,
b) recognise new room layouts altogether due to extensive
I wouldn't want to make it a dynamic process, for various reasons, but it shouldn't give a big CPU load to do on-demand.  And in the pause-mode that zone designation/management occurs during it shouldn't get in the way of all the real-time stuff, and vice-versa.
Logged

Neowulf

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #17 on: June 08, 2011, 10:18:26 am »

I just want to be able to set the area designation to be not only a bedroom, but also a study, dining room, and/or tomb.

Just make it a "Designate room from this furniture" instead of make bedroom or make dining room. Then, along with the assign option, toggles for bedroom/study/diningroom/tomb and a public/private/military option.
Public rooms work like unassigned dining rooms and dorm assigned bedrooms. Private rooms are assigned to specific dwarves, or if left unassigned will be claimed by a needy dwarf like current bedrooms are. Military rooms become squad use, like barracks/training rooms.

Room values should take a hit from being overlapping, just like it does now.


Wouldn't require a major rewrite of the room code, and it would lay the groundwork for designating workshops from furniture.
Logged

Starver

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #18 on: June 08, 2011, 11:04:47 am »

I just want to be able to set the area designation to be not only a bedroom, but also a study, dining room, and/or tomb.

That is a natural extension.  Perhaps by default, placing furniture should (assuming not already in a room) auto-expand until finding barriers or 1x1 gaps.  (Make it settable as to what the limit is?)

Unless already in such a designated room, in which case... well, several options.  You can work them out.
Logged

thunktone

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #19 on: June 09, 2011, 03:26:16 am »

But then how do you detect rooms within the zone?

I didn't really think about how, and since I'm only a dabbling programmer I won't try to guess the best algorithm. But I imagine it is possible to search for contiguous areas when the zone is created that are divided by walls, z-levels or non-internal doors. Then rooms with a bed become bedrooms etc.

I just want to be able to set the area designation to be not only a bedroom, but also a study, dining room, and/or tomb.

That would be good. I'm not sure how you'd tell the difference between a study and a dining room though. New furniture perhaps? A cupboard or something to make it a dining room?

You would also need to monitor changes within the zone. If new furniture is built in a room you decide its type again. If a tile is mined you check what rooms it is adjacent to. If one room then that room is extended, if two or more then they are merged and their function decided again. If a wall or fortification is built you'd need to check if a room has been split.

If this detection became good enough you may not even need to define a zone. Rooms could be worked out through the entire fortress based on their contents. In fact that shouldn't even hit fps much unless there is a lot of mining or construction going on at once.

As I say though, I'm only a dabbling programmer so I might be missing some big problem with all this.
Logged
Whenever dwarves get into melee, their first reaction is to place their baby on their head, to allow free use of both hands, and thus any headshot instead strikes the child.

Starver

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #20 on: June 09, 2011, 09:10:37 am »

I just want to be able to set the area designation to be not only a bedroom, but also a study, dining room, and/or tomb.

That would be good. I'm not sure how you'd tell the difference between a study and a dining room though. New furniture perhaps? A cupboard or something to make it a dining room?

Not being necessarily an advocate for this system, but certainly playing around with the idea enough in my head, I envisage that either the zone is "Dining Room", and thus any contiguous area within the DR-zone (note, I was on the same lines as you... :) ) becomes a dining room as soon as it is made so, or if it's a generic room (or, as zones can be multi-type, e.g. meeting area/fishing zone/water zone/pasture, all at once) then I might imagine that the first item sets the role, and/or a subsequent different-type furniture gives a pop-up/menuised option to become the "head item".

i.e. in a room in the "room" zone with a chair is initially a meeting room (you may be able to de-designate, as per doors being internal or not as far as natural room boundaries are concerned), placing a table gives an option to become a dining room, placing an armour stand gives an option to become a barracks/muster area, placing a statue gives an option to become a statue park.  But maybe you, as the player, still intend it to be your mayoral office and are just jazzing it up with some of the required or room-buffing items you want to put into it.

To that extent, how about the time you want to replace the basic, no-quality wooden bed in your Baron's suite with the moodcrafted bluemetal bedstead studded with diamond, hung with rings of electrum and spikes of sea-monster leather?  Currently, I might have to decide whether I want it in the same place as before, perhaps deprive the noble of a working bed for a while while the first is deconstructed until the new one is built in its place then re-create the from-the-furniture room designation.  Or put it to one side, de-designate and re-designate once the second is built, allowing the first to be deconstructed (if needed elsewhere) without the risk the baron claims J Future Peasant-Migrant's intended bedroom just by sleeping in it, and causing problems (never mind the possibility of mandates through not being satisfied in the bedroom department...  *fnar fnar*).

But how about placing a second bed in an existing (bed)room zone?  Either by pop-up or by examining the room properties you could set that bed to be the new 'main' furniture item with no discontinuity of room itself (thus any and all aspects of configuration are retained easily, including military unit associations in the case of armour stand/weapon rack rooms).  If you were happy to have the new bed elsewhere than the first, then it's a virtually one-step process.  If you're all OCD about it, you build a temporary new bed to 'take over' then set moodcrafted one over the original location to take control back again so you can free up the temporary one as well.

Quote
You would also need to monitor changes within the zone. If new furniture is built in a room you decide its type again. If a tile is mined you check what rooms it is adjacent to. If one room then that room is extended, if two or more then they are merged and their function decided again. If a wall or fortification is built you'd need to check if a room has been split.
I'd say that you wouldn't have it happen dynamically.

We're all used to bedrooms and how placing one somewhere where a large room size would spill out into a corridor while trying to make fill the corners of a room it will eventually be enclosed within.  You can set Any Old DoorTM in the doorway, however, set the room size and spread based upon that potential door and then de-designate that AOD's construction, and the room is still the same size.  (Whether or not you intend to later fill the door with your as-yet-unmade mastwork marble doorway.) Also, if if you dig more room out, or otherwise adjust the 'natural' boundaries, you do need to manually re-size, and I can't see it being better to be done more dynamically and real-time.

Quote
As I say though, I'm only a dabbling programmer so I might be missing some big problem with all this.
Regardless of my level of programming (dabbling or otherwise) I think the bigger stumbling block involved is that we don't know how Toady's code is (dis-)organised.  I always try to make practical suggestions along the lines of "well, there's code for <foo> which we can re-use", but I have no way of knowing if there's any code-re-use that can be done at all.  (Worst case scenario, the idea behind the inspirationally-equivalent process can be re-used, but has to be totally re-written to work with the different data-structures involved in the new scenario.)  I don't think that what you've said is impossible (as, of course, with my own utterances on the subject), but it may be awkward or just not mesh with the actuality.
Logged

Neowulf

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #21 on: June 09, 2011, 10:56:30 am »

What I mean is this:
The room designation code works as it does currently, (r) then resize the area to fill whatever you wish.
Once designated, the room has multiple options for what type of room it will be:
(r)esize room
(a)ssign room     -this gets grayed out if the room is set public
(m)ake room: [public/private/military]     -public rooms are dorms/dining rooms, private are assigned as normal, military adds the squad toggle options like a barracks
room is a (b)edroom: [yes/no]     -gray out if there isn't a bed in the room area
room is a (s)tudy/office: [yes/no]     -gray out if the room area lacks a chair
room is a (d)iningroom: [yes/no]     -gray out if the room lacks a table
room is a (t)omb: [yes/no]     -gray out if the room lacks a coffin, public tombs are general use graveyards, military tombs are used if the person died while on duty
room is a (j)ail/zoo: [yes/no]     -gray out if the room lacks a chain or cage, add toggle for justice usage, if a public justice enabled room then the room becomes a jail cell, if assigned to someone then they will be incarcerated in their assigned room if they break the law


Check for the furniture availability when you (q)uery over a room's base object, any other time is a waste of cycles.
Logged

thunktone

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #22 on: June 09, 2011, 11:07:33 am »

i.e. in a room in the "room" zone with a chair is initially a meeting room (you may be able to de-designate, as per doors being internal or not as far as natural room boundaries are concerned), placing a table gives an option to become a dining room, placing an armour stand gives an option to become a barracks/muster area, placing a statue gives an option to become a statue park.  But maybe you, as the player, still intend it to be your mayoral office and are just jazzing it up with some of the required or room-buffing items you want to put into it.

Yeah, that's pretty much what I was thinking.

To that extent, how about the time you want to replace the basic, no-quality wooden bed in your Baron's suite with the moodcrafted bluemetal bedstead...

My idea for this would be that if you remove the bed, the room still exists. It isn't a bedroom anymore but it still belongs to the same dwarf. It could temporarily be an "empty room" or a "walk-in wardrobe" or whatever. Then when you build the new bed you would get the option to turn it back into a bedroom.

I'd say that you wouldn't have it happen dynamically.

I still would, but we can agree to disagree there.
Logged
Whenever dwarves get into melee, their first reaction is to place their baby on their head, to allow free use of both hands, and thus any headshot instead strikes the child.

Wyrm

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #23 on: June 09, 2011, 10:23:59 pm »

Using contiguous areas for rooms (terminated at walls and non-internal doors) would work for closed room architecture, but not open rooms. Unless we're doing away with having a room with no door.
Logged

thunktone

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #24 on: June 10, 2011, 01:17:41 am »

Using contiguous areas for rooms (terminated at walls and non-internal doors) would work for closed room architecture, but not open rooms. Unless we're doing away with having a room with no door.

That's what I was assuming. I currently use rooms without doors occasionally but I wouldn't miss them. You could still have multi-purpose rooms. I mean how is a bunch of bedrooms without doors any better than a dormitory?
Logged
Whenever dwarves get into melee, their first reaction is to place their baby on their head, to allow free use of both hands, and thus any headshot instead strikes the child.

Starver

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #25 on: June 10, 2011, 01:25:26 am »

Using contiguous areas for rooms (terminated at walls and non-internal doors) would work for closed room architecture, but not open rooms. Unless we're doing away with having a room with no door.
Apart from as-yet-undoored doorways, I don't tend to use completely open/freeform/unwalled rooms.  Which is why I thought about  "treat <N>-tile-gaps as boundaries, also" configuration option, and I acknpw;edge that it's not a panacea, probably needs a re-think.

Several things, recently, have made me think "Hmm, doesn't DFhack supposedly have some sort of analogue we can use to test".  I really must download it and see if I'm right, and perhaps it can prototype the process.  (Maybe not make bedrooms, per se, but I'm sure it's supposed to be able to set to be smoothed (or make so, for extra cheaty-goodness?) all walls and floors within the 'room and boundaries' of all bed-bound tiles so as to demonstrate the principle.
Logged

sockless

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #26 on: June 10, 2011, 01:33:08 am »

The reason that hospitals are zones is because they were brought in with the 31.01 release, Toady is moving towards using zones I believe. Taverns are probably going to be zones.
Logged
Iv seen people who haven't had a redheaded person in their family for quite a while, and then out of nowhere two out of three of their children have red hair.
What color was the mailman's hair?

greenskye

  • Bay Watcher
    • View Profile
Re: Should all rooms be zones, like the hospital
« Reply #27 on: June 10, 2011, 08:39:31 am »

While I don't use open room designs, I hear about many other people that do and don't think that we should remove support for non-walled off rooms.
Logged
Pages: 1 [2]