Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Tile Occupancy and Stacking  (Read 1039 times)

PTTG

  • Bay Watcher
    • View Profile
    • http://www.2funnyguys.com
Tile Occupancy and Stacking
« on: July 31, 2007, 06:17:00 pm »

Theres a lot of discussion about quantum stockpiles and stacking items. I was looking over them and I kind of combined them into something like this:

Tiles have a weight limit. If a new item is added that exceeds the limit, it shifts to a random adjacent tile, until it finds a space to stay. If none of the nine nearby tiles has room, it goes to the next highest Z-level and the original tile becomes impassable.
The end effect is that, for instance, lose rock moved by a flood may block a passage, that a chasm will fill up in a piramidal pile, and that piles of goblin corpses will build up into walls around your entrance! If this weight limit includes dwarves and buildings, then two dwarves may be able to pass in a narrow but clear tunnel, while they must move one at a time in a cluttered mine.

Logged
A HREF="http://www.2funnyguys.com">www.2funnyguys.com

,".,''.,,''..,'',.'',,.''
.'',G''(Im in ur fotrez)
''.,.,(steln ur babyz:0)

Captain Mayday

  • Bay Watcher
  • A Special Kind of Terrible
    • View Profile
Re: Tile Occupancy and Stacking
« Reply #1 on: July 31, 2007, 06:31:00 pm »

That's a pretty nice idea.
Logged
Why not join us on IRC? irc.newnet.net #bay12games

Deathworks

  • Bay Watcher
  • There be no fortress without its feline rulers!
    • View Profile
Re: Tile Occupancy and Stacking
« Reply #2 on: August 01, 2007, 05:42:00 am »

Hi!

A nice idea.

If that isn't done, there are two other thoughts I just had how to improve tile reality (one might already be implemented, I am not sure about that).

1. Dwarves should consider all tiles with furniture or ore or rock in them to be the equivalent of tiles occupied by creatures. Thus, they would avoid them if possible. This should stop the dwarves from climbing over tables on a whim. And it could use the routines already used for creatures, I think, so it should be easy to implement.

2. If they do need to cross such a tile, they should have a good chance of tripping and hurting themselves. I find this especially annoying about loose rock. I mean, these things must be big enough that they can carve a door or flood gate out of it, but yet they walk over it as if it didn't exist. At least that is the impression I have.

Deathworks

Logged

KrunkSplein

  • Bay Watcher
    • View Profile
Re: Tile Occupancy and Stacking
« Reply #3 on: August 01, 2007, 06:21:00 pm »

Deathworks, that would be nice for realism, but it would make the pathfinding algorithms choke and die.  There is already noticeable slowdown in crowded fortresses, it's not wise to complicate things further for relatively minor changes.
Logged

Mechanoid

  • Bay Watcher
  • [INTELLIGENT]
    • View Profile
Re: Tile Occupancy and Stacking
« Reply #4 on: August 01, 2007, 06:38:00 pm »

Technically you could already stop dwarves from climbing over furniture in the next version, because in the next version there's a traffic flow designation, which can be changed between low traffic/medium traffic, and restricted, with high traffic being the default for every tile.

That way you can designate the spaces over your tables as "restricted" and the spaces over your chairs and other furniture as "low traffic"

It shouldn't be too hard to allow the game to give you the option in the init folder to set at what weight a tile will automatically designate itself as a different traffic flow level...

[AUTOTRAFFICDESIGNATE:NO]
[HIGHTRAFFICWEIGHT:0]
[MEDTRAFFICWEIGHT:250]
[LOWTRAFFICWEIGHT:750]
[RESTRICTEDWEIGHT:1250]
[BEDTRAFFIC:NO]
[DOORTRAFFIC:NO]
[PILETRAFFIC:YES]
[FURNITURETRAFFIC:YES] //anything that isn't a door or bed
[CORPSETRAFFIC: YES] //like loose bodies, parts, bones, etc, outside a stockpile
[RESOURCETRAFFIC:YES] //as above, but for stone, ore, bars, gems, wood, etc
[FINISHEDGOODSTRAFFIC:NO] //as above, but for finished goods, arms/armor, clothing, etc
[OTHERTRAFFIC:NO] //as above, but for everything else


Settings like that, which allow the game to precisely monitor and respond to weight changes in an area, and auto-designate with the proper traffic setting.
[Obviously, creatures shouldn't count, otherwise you'll end up with an absolutely horrifying situation when the dwarf picks up a chainmail and plate armor...]

[ August 01, 2007: Message edited by: Mechanoid ]

Logged
Quote from: Max White
"Have all the steel you want!", says Toady, "It won't save your ass this time!"

Deathworks

  • Bay Watcher
  • There be no fortress without its feline rulers!
    • View Profile
Re: Tile Occupancy and Stacking
« Reply #5 on: August 02, 2007, 06:53:00 am »

Hi!

KrunkSplein: I have to object. Why would the algorithms drop over and die? Usually, furniture is placed at the sides or into rooms and dead ends for the most part. The table and chair in the corridor is something you may have in the first year when your meeting hall is not created yet, but it is usually not there when you really have a lot of dwarves.

As far as I can tell, the algorithms only care about stuff the dwarf actually encounters, so a table in a meeting hall or dining room will only affect people who have business in that location (unless you have a fortress layout where such rooms are part of your main roads).

Of course, there would be one case where you would have a major slow down, namely when the corridors of the fortress are cluttered with rock and ore lying around. But then again, I think that would be just fitting. As I said, judging from what you can make out of those rocks, they must be mighty big, so leaving them lying around should be a problem bigger than just a few cats running around the place.

Well, at least that is the way I am seeing this.

Deathworks

Logged

Axehilt_VuP

  • Bay Watcher
    • View Profile
Re: Tile Occupancy and Stacking
« Reply #6 on: August 02, 2007, 08:15:00 am »

Game designers can't work on stuff like "usually furniture is placed on the sides of the room".   If crap gets placed in the middle of a hallway - on accident or on purpose - the game cannot simply mire down into uber slowndown just because dwarves now have to consider every obstacle in their chosen path.

That said, I'm honestly not sure of the actual performance impact of your suggestion.  But Krunk's comment rings true, it wouldn't really add much to the game but it's likely it would slow down pathfinding algorithms at least by a bit.

The original suggestion is good, though it might have performance concerns too.  A simpler calculation based on item weight might still be good too.  Possibly reworking Weight into an "encumbrance" stat, which modifies item weight by it's size and/or ease of carrying.

[ August 02, 2007: Message edited by: Axehilt_VuP ]

Logged

Deathworks

  • Bay Watcher
  • There be no fortress without its feline rulers!
    • View Profile
Re: Tile Occupancy and Stacking
« Reply #7 on: August 02, 2007, 11:41:00 am »

Hi!

I still don't think that the game would be mired down by a table standing in the middle of the road. As for the slowdown, my suggestion of using the mechanism used for creatures would lead me to believe that the table would be handled about just as fast as a kitten being in that spot. So, I don't see how this would suddenly mire the game down to a halt. As far as I can tell, the game checks the tile the dwarf currently wants to move into, if there is a creature in there, the dwarf checks for a neighboring tile to evade otherwise crawls over/under the creature. That seems to be the way it is handled now. My suggestion is merely to have dwarves when looking at that single next tile to also check for other obstacles. So, where does the miring come from?

On the other hand, having dwarves walk over ludicrous obstacles without any penalty might be seen as a bug since the game seems to strive for realism in many aspects (just look at the discussions about metals and other materials and the amount of research Toady One has done). In that case, all those nice designs of stacked rooms or cramped fortress corridors would suddenly be exploiting a bug in a current version. If that bug is fixed resulting in problems for those designs exploiting it, what would be so wrong about it?

Deathworks

Logged

irmo

  • Bay Watcher
    • View Profile
Re: Tile Occupancy and Stacking
« Reply #8 on: August 02, 2007, 04:16:00 pm »

quote:
Originally posted by Deathworks:
<STRONG>Hi!

I still don't think that the game would be mired down by a table standing in the middle of the road. As for the slowdown, my suggestion of using the mechanism used for creatures would lead me to believe that the table would be handled about just as fast as a kitten being in that spot. So, I don't see how this would suddenly mire the game down to a halt. As far as I can tell, the game checks the tile the dwarf currently wants to move into, if there is a creature in there, the dwarf checks for a neighboring tile to evade otherwise crawls over/under the creature. That seems to be the way it is handled now. My suggestion is merely to have dwarves when looking at that single next tile to also check for other obstacles. So, where does the miring come from?
</STRONG>


The pathfinding algorithm freaks out if there turns out not to be any path to the destination.  To avoid this, there's a connectivity table that tells what parts of the map are reachable from what other parts.  This has to be updated whenever there's a change such as mining out a new room or a connection between rooms, raising a bridge, or locking a door.  If furniture blocked movement, then any movement of furniture would require a map update.  (Water movement does this, which is why floods lag the game so badly.)

Creatures don't have this problem because they don't absolutely block movement, just slow it to a (literal) crawl.

Logged

Axehilt_VuP

  • Bay Watcher
    • View Profile
Re: Tile Occupancy and Stacking
« Reply #9 on: August 02, 2007, 05:29:00 pm »

Well irmo he does bring up a good point - furniture doesn't exactly move that often so it'd get treated like walls for pathfinding purpose.

After his last post I realize that what he's asking for could probably happen fairly easily without too much overhead - particularly if a "traffic" system is already in the works.  The game could just automatically flag furniture as orange or red in terms of traffic.

Logged

Deathworks

  • Bay Watcher
  • There be no fortress without its feline rulers!
    • View Profile
Re: Tile Occupancy and Stacking
« Reply #10 on: August 03, 2007, 04:39:00 am »

Hi!

Irmo: I think I made it clear that I never considered furniture tiles completely blocked.

In my first post, I said:

Dwarves should consider all tiles with furniture or ore or rock in them to be the equivalent of tiles occupied by creatures

In my latest post, I said:

As far as I can tell, the game checks the tile the dwarf currently wants to move into, if there is a creature in there, the dwarf checks for a neighboring tile to evade otherwise crawls over/under the creature. That seems to be the way it is handled now. My suggestion is merely to have dwarves when looking at that single next tile to also check for other obstacles

I never said that dwarves should be unable to move through furniture or rock tiles. It should just have a penalty and they should try to avoid them - which is exactly how they behave when dealing with other creatures right now.

I am sorry I got so excited in my last post, but I think it would be feasible and sometimes I simply get very excited. Sorry.

Deathworks

Logged

irmo

  • Bay Watcher
    • View Profile
Re: Tile Occupancy and Stacking
« Reply #11 on: August 03, 2007, 05:43:00 pm »

Dwarves should consider all tiles with furniture or ore or rock in them to be the equivalent of tiles occupied by creatures

Ah.  My mistake.

Logged