Bay 12 Games Forum

Please login or register.

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

Author Topic: Any Tips For The Layput Of A Fortress  (Read 1887 times)

SpeardwarfErith

  • Bay Watcher
    • View Profile
Re: Any Tips For The Layput Of A Fortress
« Reply #15 on: August 11, 2018, 09:35:41 am »

You can play around with this site to see a demonstration of the pathfinding algorithm that dwarf fortress uses: https://qiao.github.io/PathFinding.js/visual/
Which algorithm on that page does DF use?

It uses a modified A*

Try it again with stairs, ramps are a whole different mess.
k

Setup:

||

Right:

||

Same as with ramps, moved to build from the left, returned through stairs on the right.

Left:

||

Same as before, moved to construct through stairs, returned over floor.

Huh, well thanks for that. I heard the claim about stairs in several places, but never bothered validating it myself. I wonder if ramps are actually better for FPS or if that's a myth too.
Logged
The swordsman Smoma Acaltekud: Hello Ago. Life is, in a word, death.
The swordsman Smoma Acaltekud stabs you in the lower body with his iron scimitar, tearing apart the muscle and tearing apart the left kidney!
The iron scimitar has lodged firmly in the wound!

Battle Royale Mode: A DFHack Script

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Any Tips For The Layput Of A Fortress
« Reply #16 on: August 11, 2018, 08:41:56 pm »

Well, they do take one less step to move from x,y,z to x+1,y,z+1. There's a reason why the stairs test was larger: had to add two straight tiles to the non-stair path.
But always good to test something before you plan your whole fort around it :v (I learned this lesson the hard way.)

I did a further test with this setup

||

Since it occurred to me that the previous test might suffer from acting like 1-way paths (noted on the wiki). Both ways were used again, right on movement, left on return. Ditto for this setup for exclusively up/down movements:

||

||

Here I also tested mining, since I recall it was supposed to have different job pathing rules than regular jobs, and the results were mirrors of each other. For building, on the left the dwarf took southmost stairs, and on the right first stairs they encountered. For mining, on the left they took first stairs, and on the right northmost stairs. But I tought a bit, and realized these result also make sense if mining and building are the same, but idle pathing is different, since in mining case they finished right second and returned with no job, while in building case they finished left second and returned with no job, and in both cases they took the first available stairs to the dwarf when taking a new job and preferred lowest available z-level for idle pathing.

Of course, that means the pathing algoritm did pick last suitable stair for the job, which kinda supports your claim.


But ultimately, the important part is fps effect (though the above tests are still useful for setting up pressure plates). I don't have any 3x3 staircase forts handy, but someone who has them could relatively easily test the effects of reduced number of staircases with bit of savescumming and gui/liquids. Set up bunch of large jobs that force taking it, record three times it took to pass a month (via dfhack to record the time, unpause at start and pause the game at that exact moment), then do it again but with some part of staircase replaced by obsidian walls. I also recall observations of some shortcut staircases hampering the fps due providing alternate longer path.

From efficiency point of view, I was bigger about cube forts 'till I realized that stockpile to workshop dominates the calcs.
« Last Edit: August 11, 2018, 08:48:03 pm by Fleeting Frames »
Logged

PlatinumSun

  • Bay Watcher
    • View Profile
Re: Any Tips For The Layput Of A Fortress
« Reply #17 on: August 12, 2018, 06:23:44 pm »

I am currently trying to design an entire fort to upload into quickfort. My levels go like this:
  • Maze with traps
  • Barracks
  • Tavern/food
  • Wood industry
  • Stone industry
  • Furniture stockpile
  • Cloth industry
  • Soap/Hospital
  • Finished Goods stockpile
  • Meat/Leather
  • Metal industy
  • Farms (To set up a challenge and I don't like how dug out soil looks like)
  • Water/Magma reservoir
  • Cave outpost
Did I forgot anything? Also, where would you put places like nobles chambers, library or temple in my layout?

1. A 5-9 tile wide tunnel with traps and guard dogs and barracks (With quarters for military and a lever room) and ballista with the trade depot at the end with the finished goods stock pile surrounding it.

2. Non-specific industry/s with its own respective stock pile and quarters for the dwarves who work in said industry.

3. Non-specific industry/s with its own respective stock pile and quarters for the dwarves who work in said industry.

4. Non-specific industry/s with its own respective stock pile and quarters for the dwarves who work in said industry.

5. Non-specific industry/s with its own respective stock pile and quarters for the dwarves who work in said industry.

6. Non-specific industry/s with its own respective stock pile and quarters for the dwarves who work in said industry.

7. Lever-room, tavern, meeting hall, temples, crypt, museum, library, hospital, medical dwarf quarters, furniture stockpile, aqueduct (leading from aquifer, river or caverns), prison, colosseum, statue garden, and quarters for special dwarfs (Nobles, manager etc.)

8. Non-specific industry/s with its own respective stock pile and quarters for the dwarves who work in said industry.

What ever you want to do in caverns. EDIT: Set up farms and sheep and tanning and buthering in the caverns.

Before you can get lava furnaces just have regular furnaces for your metal industry a few levels above the magma level so later on you can upgrade you furnaces.

Between all the numbered layers have at least 3 blocks between them. Also if you want mine carts place everything with them in mind. So you have 4 wide corridors throughout the fort. Place and atom smasher on each floor to get rid of rocks and corpses and worn out items. Also place gates on each level to block stuff off.

EDIT: Also dont be afraid to be creative.

EDIT: I meant 3 layers between floors not 2.


Also you could just do everything I said here all on one floor. Other than the stuff that requires the caverns and magma of course. And also it doesnt hurt not to have a big gate to keep the goblins out or it gets boring. So once you get a metal industry and a decent military up and running you may want to remove the gate. Go with hammer/mace dwarves with crossbowdwarves to back them up. And if you do everything on only a one or a few levels dont forget to still have every floor I talked about in its own bloc. Also maybe build multiple hospitals and taverns and barracks as an example of being creative or build you colosseum surrounded by lava on in the caverns.. Maybe have a whole floor just for temples or the colosseum. The moral of the story is build blocs it doesnt matter if it has its own floor or not.   
Logged
It will probably take you 10 seconds to read this digital text on your monitor. And then ponder its metaphorical meaning.

Slaves To Kek God Of Creation
Chapter II: Meme Magic

mikekchar

  • Bay Watcher
    • View Profile
Re: Any Tips For The Layput Of A Fortress
« Reply #18 on: August 12, 2018, 10:18:42 pm »

From efficiency point of view, I was bigger about cube forts 'till I realized that stockpile to workshop dominates the calcs.

I play at 20 FPS *on purpose* and my forts rarely last longer than 10 years (because I get interested in doing something else), so I've never even come close to FPS death.  However, I continue to believe that this is the dominant issue for both efficiency and FPS.  Path finding is dramatically computationally easier when the paths are short.  If you have stockpiles 2 tiles from the workshops, then virtually nothing matters when the dwarf is pathing from the stockpile to the workshop.

But then you have to consider the path the dwarf will take to get to the stockpile. The key is to keep everything that the dwarf is likely to want in a small enough space that their paths remain short.  Now, it's hard to do this, admittedly.  But if you think of your work flows, it really helps.  Have a food stockpile near your farms.  Possibly keep staging stockpiles near that, to split up hauling jobs if the paths are long.  Keep your still near the farms (so that the seeds don't have to go very far).  Keep a bag stockpile nearby for the seeds.  Consider only enabling hauling for certain dwarfs -- so food industry dwarfs haul food, but nobody else does.

However, also consider having many small shrines and temples so that a dwarf has an option to pray near where they work and live.  Don't centralise the housings.  Allow dwarfs to live near their workshops.  The list goes on.  Basically, the shorter the paths, the better off you are going to be.  I hear people talk about their dwarfs hauling things for a week, and then complain about FPS.  It's much better to split up the hauling so each dwarf only hauls something for no more than half a day (say 50 tiles at full speed, much less if hauling heavy things).

The real difficulty, though, is when a dwarf decides to go to the tavern at the surface and then has to go back to work in the magma forges.  There isn't much you can do about that, but at least you can design the fortress so that it isn't *required* to do that kind of thing.

I also think that this kind of fortress looks a lot more interesting and "real".  It's also super challenging to do, which I enjoy.
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Any Tips For The Layput Of A Fortress
« Reply #19 on: August 13, 2018, 01:38:00 am »

Well, yeah, you can do all that and make things bit more efficient.

But take the bedrooms: dwarf sleeps twice a season, while being easily capable of doing more than 100 works (i.e. more than 1 work per day) in that time. Exact speed depending on skill and task; a legendary glazer can go over a magnitude faster for instance. So shaving off, say, even 20 tiles from average bedroom trip counts for less than 1 tile walked straight instead of diagonally.

And if they aren't that busy, well...Then they're just free to do whatever; free time doesn't have to be maximally efficient.

On that note, you can't get temple dances and recitals without dance floor nor take advantage of other mood bonuses with just tiny spots planted whenever, so that's one argument for central temples even while wanting them to be efficient.


However, I suppose daisy-chained stockpiles is an interesting idea in case of many branching paths. More jobs means less fps, but this way the pathing algoritm can be prevented from wandering into side tunnels without marking their entrances low traffic.

PS: You can do closer than 2 tiles with deconstructed floors (if you do this with still+farms, you can 100% skip bags on non-edibles). And 20 FPS is unacceptably slow for me, i.e. improve or abandon to fps death :v

PlatinumSun

  • Bay Watcher
    • View Profile
Re: Any Tips For The Layput Of A Fortress
« Reply #20 on: August 13, 2018, 10:30:54 am »

Also for the nobles rooms set up a water pipes and a flood gate so you can drown the nobles.
Logged
It will probably take you 10 seconds to read this digital text on your monitor. And then ponder its metaphorical meaning.

Slaves To Kek God Of Creation
Chapter II: Meme Magic

PlatinumSun

  • Bay Watcher
    • View Profile
Re: Any Tips For The Layput Of A Fortress
« Reply #21 on: August 13, 2018, 10:37:39 am »

From efficiency point of view, I was bigger about cube forts 'till I realized that stockpile to workshop dominates the calcs.

I play at 20 FPS *on purpose* and my forts rarely last longer than 10 years (because I get interested in doing something else), so I've never even come close to FPS death.  However, I continue to believe that this is the dominant issue for both efficiency and FPS.  Path finding is dramatically computationally easier when the paths are short.  If you have stockpiles 2 tiles from the workshops, then virtually nothing matters when the dwarf is pathing from the stockpile to the workshop.

But then you have to consider the path the dwarf will take to get to the stockpile. The key is to keep everything that the dwarf is likely to want in a small enough space that their paths remain short.  Now, it's hard to do this, admittedly.  But if you think of your work flows, it really helps.  Have a food stockpile near your farms.  Possibly keep staging stockpiles near that, to split up hauling jobs if the paths are long.  Keep your still near the farms (so that the seeds don't have to go very far).  Keep a bag stockpile nearby for the seeds.  Consider only enabling hauling for certain dwarfs -- so food industry dwarfs haul food, but nobody else does.

However, also consider having many small shrines and temples so that a dwarf has an option to pray near where they work and live.  Don't centralise the housings.  Allow dwarfs to live near their workshops.  The list goes on.  Basically, the shorter the paths, the better off you are going to be.  I hear people talk about their dwarfs hauling things for a week, and then complain about FPS.  It's much better to split up the hauling so each dwarf only hauls something for no more than half a day (say 50 tiles at full speed, much less if hauling heavy things).

The real difficulty, though, is when a dwarf decides to go to the tavern at the surface and then has to go back to work in the magma forges.  There isn't much you can do about that, but at least you can design the fortress so that it isn't *required* to do that kind of thing.

I also think that this kind of fortress looks a lot more interesting and "real".  It's also super challenging to do, which I enjoy.

Its best to design in blocs. So a bloc is bedrooms, workshops and there respective stockpile. And maybe a food stockpile but would this screw up pathing for dwarves in other blocs which then come another bloc to eat instead of there own? Or do the dwarves always go to the closest stock pile for what they need?

Is pathing in this game need an improvement and are the devs planning on one already?
Logged
It will probably take you 10 seconds to read this digital text on your monitor. And then ponder its metaphorical meaning.

Slaves To Kek God Of Creation
Chapter II: Meme Magic

HerbalistRanger

  • Bay Watcher
    • View Profile
Re: Any Tips For The Layput Of A Fortress
« Reply #22 on: August 13, 2018, 06:45:18 pm »

A compact 1 -3 levels design. Still working out kinks but I like where ive gotten.

3x ramps down to center with trade depot. Two barracks when hit stone. Under depot with down stairs industry buildings. Storage room under craftshops. From 4 edges of Trading Depot - dining room and hospital with waterfalls/wells. Noble rooms/prison/generic temple/artifact stockpile. Block of 3x3 40 bedrooms when dormitory is worn out and set to dining room for residents. I make stairs up from dining room for plant/farm/still/kitchen. Up stairs from that to farm plots/mill/quern under windmill. Made 40 more bedrooms underneath ones already build.

Defense so far is bit too easy I need to micro caverns more for fun. I put a square wall with entrance for wagons. 2 short 2x offshoots with traps. Walled trail for wagon down center that only they bother to go.
I put the masterwork weapons/armor behind the artifact storage hopefully gives my military happy thoughts preparing for battle. A bit out of the way and through prison to prevent thieves. Dining room has 4 waterfalls, ive gotten pretty good at making those, though I shamelessly fixed a mistake with dfhack liquids rather than pull a lever lol. I'm not sure if my fort is FPS Pathfinding friendly. Seems good so far as long as I keep up with autodump hauling bodies. I was under undead siege for a year they kept killing arriving guests. Ended up cleaning 4thousand items from map. Was quite a learning experience yay atom smashers.







« Last Edit: August 13, 2018, 07:33:17 pm by HerbalistRanger »
Logged

mikekchar

  • Bay Watcher
    • View Profile
Re: Any Tips For The Layput Of A Fortress
« Reply #23 on: August 13, 2018, 09:55:01 pm »

And maybe a food stockpile but would this screw up pathing for dwarves in other blocs which then come another bloc to eat instead of there own? Or do the dwarves always go to the closest stock pile for what they need?

Where they go for the things they need is highly dependent upon what they are getting, but usually they go to the closest place (in absolute terms: i.e. in a straight line -- not how close it is to walk to it).  For food, there is a thread that discusses that dwarfs will sometimes seek out their favourite foods within a certain (complicated) area.

Dwarfs will sometimes go far out of their way for stuff, but my opinion is that having *more* choices is better.  The item is determined *before* pathing calculations, so on average it should provide a better experience.

Quote
Is pathing in this game need an improvement and are the devs planning on one already?

There are still some pathing bugs, but mostly it works OK.  A lot of people have difficulty with "FPS death" and Fleeting Frame's view is much more common (by orders of magnitude ;) ) than mine.  There have been a few FPS improvements in the last couple of updates, but I don't think that major pathing upgrades are on the table.  But to be fair, I occasionally increase my FPS cap and I don't think I've *ever* had a fortress with less than max 100 FPS -- and this is with a 3 year old Intel Core i5 laptop.  Though I probably have not thought to measure it during a siege.  Some things in my favour, though -- I run Linux in text mode, limiting my graphics FPS to 20, and I don't have swap turned on.  So it's probably going to be quite a bit quicker than what the average player does.

Interesting points about dances, Fleeting Frames.  I've still yet to see a dance in a temple.  Does it actually happen?  Because of the increased friendliness of small taverns, too, I have given up on dances altogether.  In my latest fortress, though, I'm intending to make at least one large temple, just because it is fun for me (even if it doesn't matter to the dwarfs).
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Any Tips For The Layput Of A Fortress
« Reply #24 on: August 14, 2018, 01:33:07 am »

Yeah, fair few improvements. A 3x2 oceanside 14..7? dwarf fort that got 35 fps above/38 fps below in 43.05 got 96 above/106 below in 44.12 in a brief test i.e. about 2,7* increase.

Temple religious dances, recitals, etc. are dependent on the world and generally seem to be much rarer than their tavern equivalent (I think I've posted a screenshot a religious performance somewhere). I've seen them happen in a world with long history where I've had consistently 2 dwarves in particular start them whenever they were in, but it feels like worlds where your dwarves will merely pray are more common, especially as people keep their histories short for fps. Though even in that case, they could walk through a waterfall, pass by a ⛭statue⛭ and open a ⛭hatch⛭ while petting a dog on the way there.

You refer to one of those recent 2-wide, walkable area=fortress population/2 furnitureless strip taverns, I take it?
« Last Edit: August 14, 2018, 01:34:51 am by Fleeting Frames »
Logged
Pages: 1 [2]