Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
hailthefish
Oct 24, 2010

Whether they're idle or not they're still pathing around and interacting, wearing clothes, having feelings, etc.

Also having taverns and stuff can make the idlers number slightly deceiving since IIRC dwarves doing tavern relaxation activities don't count as idle.

Adbot
ADBOT LOVES YOU

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Okay, I see a lot of poetry, socializing, and meditating (temple), so these dwarves better be happy.

Moridin920
Nov 15, 2007

by FactsAreUseless
Before the temple/library/etc dwarves would need some idle time to get their needs fulfilled yeah. However now anything they do in those buildings counts as being active so even if they're just dancing in the tavern that's not 'idle' for the purposes of the counter. Ditto poetry, meditating, praying, etc.

Dieting Hippo
Jan 5, 2006

THIS IS NOT A PROPER DIET FOR A HIPPO
Is there such a thing as too many "Meeting Hall" locations? One fort I had had a regular meeting hall next to a kitchen, but then I made a large generic temple area and all the dwarves flocked to it. I then made a Library and all the dwarves ran to hang out there (before being torn apart by werellamas). They seemed to want to go to the latest meeting place I created and didn't care much about previous ones.

Nessus
Dec 22, 2003

After a Speaker vote, you may be entitled to a valuable coupon or voucher!



Dieting Hippo posted:

Is there such a thing as too many "Meeting Hall" locations? One fort I had had a regular meeting hall next to a kitchen, but then I made a large generic temple area and all the dwarves flocked to it. I then made a Library and all the dwarves ran to hang out there (before being torn apart by werellamas). They seemed to want to go to the latest meeting place I created and didn't care much about previous ones.
Gotta be on trend buddy. #dwarfthings

I imagine when you make a new zone it also provides a way to fulfill a bunch of leftover and previously unfulfilled desires.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Rocko Bonaparte posted:

Okay, I see a lot of poetry, socializing, and meditating (temple), so these dwarves better be happy.

Nope, they're sad. I'm running Dwarf Therapist and figured out how to look at their needs. There are three categories that seem to trouble them:
1. Crafting something
2. Be with friends
3. Be with family

For crafting something, is there some way to have them set up to all make something, feel good again, and then shut off the role? As for friends and family, I'm not sure what to do there. I have a meeting hall, a tavern, a library, and a temple. Am I screwing up with having too many places to go that they don't run into each other?

Mzbundifund
Nov 5, 2011

I'm afraid so.
Some dwarves have obnoxious personalities and can't seem to ever make friends, so their friends need never gets filled. Their obnoxious personalities mean they'll never find a spouse, so unless they have siblings or something in the fort the family need will be unfulfilled forever too and they'll become sour incels for the rest of their lives.

hailthefish
Oct 24, 2010

Sometimes this game is TOO realistic.





For the not crafting something sad thoughts, you can turn some labors on on your unskilled dwarves who are sad about not crafting anything and then occasionally run crafting jobs for garbage you don't care about that are restricted to poorly skilled dwarves.

To do this you will probably want separate workshops pulling from their own materials stockpiles set up such that the low skilled dwarves only get cheap, abundant materials and anything expensive or rare is available only to the workshops for high skilled dwarves.

hailthefish fucked around with this message at 02:55 on Jul 22, 2019

Shady Amish Terror
Oct 11, 2007
I'm not Amish by choice. 8(
I might be slightly behind on version changes, but typically family needs will very, very, VERY often go unmet in the normal playtime of a fort. Most migrants have and will always have sad thoughts about relatives they've left behind. This is understandable, though it can be a bit obnoxious since there isn't much you can do to affect that directly.

Zereth
Jul 9, 2003



Shady Amish Terror posted:

I might be slightly behind on version changes, but typically family needs will very, very, VERY often go unmet in the normal playtime of a fort. Most migrants have and will always have sad thoughts about relatives they've left behind. This is understandable, though it can be a bit obnoxious since there isn't much you can do to affect that directly.
They should be able to write letters home/receive letters from home to alleviate this.

hailthefish
Oct 24, 2010

I can see it now... assigning your dwarves to rotations working in the library to grind up their reading and writing skills...

Angry_Ed
Mar 30, 2010




Grimey Drawer

Zereth posted:

They should be able to write letters home/receive letters from home to alleviate this.

"Dear Slim, I wrote you but you ain't responding..."

Dwarf Stan cancels Write Letter, overcome by fell mood.

Maarak
May 23, 2007

"Go for it!"

Zereth posted:

They should be able to write letters home/receive letters from home to alleviate this.

This leads to minecarts full of unsorted letters being dumped into an arcane postal hub fortress, and I am here for it.

Zereth
Jul 9, 2003



hailthefish posted:

I can see it now... assigning your dwarves to rotations working in the library to grind up their reading and writing skills...
They dictate it to a scribe, obviously.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Is there anything I can do to profile slowdowns in the game? It now takes a few hours for a season to change, and I think movement now happens slower than real time would take.

I do have, well, 300 people now. Might be a problem.

Other things I worry about are some glitch with all the poo poo I have produced and possible lack of piles or storage. Is there a way I could check that?

My other fear is all the animals I have running around inside my fort across three pastures. It is getting a little cluttered.

I may have killed this fort from abundance.

Grey Hunter
Oct 17, 2007

Hero of the soviet union.
Accidental destroyer of planets

hailthefish posted:

I can see it now... assigning your dwarves to rotations working in the library to grind up their reading and writing skills...

Procedurally generated letters home. lets you get a real idea of what your dwarves are thinking.

"Dearest mother.
Blood! So much blood. Father is dead, my brothers are dead. the stench of their rotting corpses fills my nose.
I saw a ***masterwork**** table the other day, and I am still thinking about it.
I am happy. Hope goblins have not stolen to many children.

Yours. Urist. "

Prop Wash
Jun 12, 2010



Be careful what you wish for. What if your dwarves could also receive letters, and what if those letters were capable of provoking depression and tantrums? We’d be developing and sharing ways of murdering the postman the second they arrived on the map.

hailthefish
Oct 24, 2010

Rocko Bonaparte posted:

Is there anything I can do to profile slowdowns in the game? It now takes a few hours for a season to change, and I think movement now happens slower than real time would take.

I do have, well, 300 people now. Might be a problem.

Other things I worry about are some glitch with all the poo poo I have produced and possible lack of piles or storage. Is there a way I could check that?

My other fear is all the animals I have running around inside my fort across three pastures. It is getting a little cluttered.

I may have killed this fort from abundance.

There's not really any way to profile performance that I know of, no. That said, 300 dwarves is known to be deep into slowdown territory, and with that population it's always going to run like rear end, BUT there are some things you can do.

If you have dfhack, you can use it to clean up things like liquid coverings and leaves, as well as things like all the owned tattered clothing your dwarves have scattered all over creation. Replacing large stockpiles with 'quantum stockpiles' where all the stuff is packed on a single tile through various means (either dump zones or minecarts) can help a little too. Make sure all your busy hallways are at least two tiles wide, preferably 3 or 4.

Disabling weather and temperature can help, though this can come with some downsides. If you're relying on rainfall-fed surface ponds to draw your drinking water from, or if you rely on a river but live in a cold climate, then obviously you can screw yourself if you turn off 'rain' or 'thawing'.

Push comes to absolute shove, you can always enable fastdwarf in dfhack, which is literally cheating in a way a lot of other suggestions are not, but it will at least make it slightly less obnoxious to play when your framerate is in the toilet because your dwarves will all be literally The Flash.

https://dwarffortresswiki.org/index.php/DF2014:Maximizing_framerate goes into exhaustive detail about various sources of slowdown and ways to mitigate them.

Tunicate
May 15, 2012

Prop Wash posted:

Be careful what you wish for. What if your dwarves could also receive letters, and what if those letters were capable of provoking depression and tantrums? We’d be developing and sharing ways of murdering the postman the second they arrived on the map.

Sending letters always improves mood but receiving letters is dicey, so the cunning expedition leader has a mail service that dumps everything into an active volcano.

Tiler Kiwi
Feb 26, 2011
throwing poo poo posts into a volcano? talk about hot takes!!

Tuxedo Catfish
Mar 17, 2007

You've got guts! Come to my village, I'll buy you lunch.

Rocko Bonaparte posted:

Is there anything I can do to profile slowdowns in the game? It now takes a few hours for a season to change, and I think movement now happens slower than real time would take.

I do have, well, 300 people now. Might be a problem.

Other things I worry about are some glitch with all the poo poo I have produced and possible lack of piles or storage. Is there a way I could check that?

My other fear is all the animals I have running around inside my fort across three pastures. It is getting a little cluttered.

I may have killed this fort from abundance.

The two biggest drains on FPS are pathfinding and heat calculations.

Heat calculations can be turned off if you don't mind occasional weirdness surrounding lava, dragons, and water staying in the same phase state as when you first turned the setting off regardless of how hot/cold it is. Apart from those examples, it doesn't have a huge effect on gameplay. If you want to keep them on but want to minimize their impact, use a smaller map and make less stuff.

For pathfinding you mostly just need to have fewer entities. You can improve matters a little bit by walling off caverns and unused areas (especially complex ones with a lot of obstacles and paths), avoiding 1-tile-wide passages in your fort (since they cause blockages and blockages cause pathfinding to constantly be re-calculated) and by marking high- and low-traffic designations if you're able to do so in a way that's "smarter" than the modified A* pathfinding algorithm that Toady uses (not impossible, but complicated; good luck).

But really, you just need fewer dwarves and animals.

ninjewtsu
Oct 9, 2012

If I recall correctly, putting a bunch of doors in every wall is a bit easier on the path finding too, though I think usually the big killer on path finding is z level movement, so putting stairs everywhere would be helpful as well, if not much more so.

Ideally, you want a dwarf to be able to reach his destination by walking there in a straight line. This line is in 3 dimensional space, so ideally he gets to just phase through the ceiling and floor as well.

Ambaire
Sep 4, 2009

by Shine
Oven Wrangler

ninjewtsu posted:

If I recall correctly, putting a bunch of doors in every wall is a bit easier on the path finding too, though I think usually the big killer on path finding is z level movement, so putting stairs everywhere would be helpful as well, if not much more so.

Ideally, you want a dwarf to be able to reach his destination by walking there in a straight line. This line is in 3 dimensional space, so ideally he gets to just phase through the ceiling and floor as well.

Can one put stockpiles on up/down stairs? I'm having this hilarious vision of doing all dig designations as up/down stairs and removing the stairs where I need workshops etc.

WarpDogs
May 1, 2009

I'm just a normal, functioning member of the human race, and there's no way anyone can prove otherwise.

ninjewtsu posted:

If I recall correctly, putting a bunch of doors in every wall is a bit easier on the path finding too, though I think usually the big killer on path finding is z level movement, so putting stairs everywhere would be helpful as well, if not much more so.

Ideally, you want a dwarf to be able to reach his destination by walking there in a straight line. This line is in 3 dimensional space, so ideally he gets to just phase through the ceiling and floor as well.

I think it might be the other way around. The more stairs, doors, open spaces, etc. you have the more the pathfinding algorithm has to evaluate when calculating each route. I remember some big effort post on the official forum that basically concluded doors and open spaces were the two biggest bottlenecks to the game's performance

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

WarpDogs posted:

I think it might be the other way around. The more stairs, doors, open spaces, etc. you have the more the pathfinding algorithm has to evaluate when calculating each route. I remember some big effort post on the official forum that basically concluded doors and open spaces were the two biggest bottlenecks to the game's performance

I think I read it was using A*, and if a linear direction in 3d is the best then the heuristic is a basic linear calculation. That would mean any candidate path in-progress with some cost will be compared against the best one using that heuristic. If it cannot at all get there any better in that straight, perfect line, it can just throw it out right then and there instead of following it to its end. So both things can be right at the same time: straight 3d paths and narrowish spaces.

Having some open space would reduce disruptions from bumping into other things that are pathing, but too much would imply it would try a lot more possibilities along the way before hitting a hard stop at a wall.

I'm suspecting one of my problems is this pasture system I set up. I have three pasture zones, all of the largest size the GUI allowed. I'm assuming the animals are trying to go all over the place within those larger spaces while constantly bumping into my crazy zoo of other animals. So I'm wondering if I would do better penning the livestock. Sure, they'd bump into each other, but I'd have them in a tiny zone that isn't making too many calculations.

There are also a ton of trees. Do they calculate often? I actually had blocked a caravan from visiting half a year before since the trees had swallowed up all the routes to the depot. I had to knock out a route and build a road to make sure it stayed.

ninjewtsu
Oct 9, 2012

WarpDogs posted:

I think it might be the other way around. The more stairs, doors, open spaces, etc. you have the more the pathfinding algorithm has to evaluate when calculating each route. I remember some big effort post on the official forum that basically concluded doors and open spaces were the two biggest bottlenecks to the game's performance

:shrug: at the time a neat little program was being passed around that let you design mazes and then run a pathfinding algorithm to see how expensive getting through the maze was. i built a number of common dwarf fortress arrangements and put the start and end points in various places inside that, and how expensive the pathfinding was went way, way, waaaay down as soon as i started adding little holes everywhere

the basic thing with these pathfinding algorithms is they draw a straight line to the goal, then try to follow it until something is in the way. then, they try to find the closest gap in that thing, and then try to follow a new line to the objective. with A* in particular, that "try to find a way around this obstacle" phase got expensive pretty quick, but very dramatically so if it ever had to move in the direction opposite from the objective (like if you were, say, in a square room with one entrance, and the objective was on the other side of the wall opposite that door. the algorithm would essentially grind up against the wall, testing every possible space along the wall, before finally considering a move that takes it "further away" from its goal)

at the same time, narrow entrances (like doors) tend to get clogged up really easily, at which point the entire algorithm is run a second time, so yeah if all your dwarves are getting funneled through one door, that one door becomes a massive bottleneck

a theoretical fortress that consists entirely of up/down stairs, and also with all workshops and stockpiles and any other point of interest spaced well apart to avoid collisions, would be ridiculously easy on the pathfinding algorithm.

ninjewtsu
Oct 9, 2012

i found the program, it's here to mess around with:

https://qiao.github.io/PathFinding.js/visual/

to demonstrate my point real quick, here's the basic example i gave in my last post



you can see how many operations the algorithm had to perform in the bottom left (time isn't terribly important for these purposes, there's many other factors that can affect that, such that if you keep hitting restart on the same configuration you'll get wildly varying times. length is just how long the final path is)

and if we put a hole in the wall between them:



that number of operations goes way, waaaay down.

in this program, the blue spaces are spaces that were considered for movement. you can see that in the first image, literally the entire room was checked, while in the second image it just bee-lined right to the objective

here's maybe a less ideal case, and one that slightly better resembles an actual fort situation::



here you can see that not only does the algorithm consider every square in the starting room, but also every square in every room on that half of the structure.

and if we put a door in every wall:



this more-direct path has way fewer operations

so, the short of it is the algorithm is very much biased at considering any step that takes it "closer" to the objective, in the short term. it's like a blind person playing colder/warmer, any time it hears "warmer" it's going to aggressively check that direction, even if there's a solid wall further along in that direction

ninjewtsu fucked around with this message at 19:25 on Jul 22, 2019

ninjewtsu
Oct 9, 2012

for funsies, here's a ridiculously extreme example:



if your dwarf needs to get somewhere, and your main dining hall is between your dwarf and that somewhere, and your dwarf can't just run straight through the dining hall, the dwarf will check every tile of your entire dining hall before trying another route

Hihohe
Oct 4, 2008

Fuck you and the sun you live under


When dwarves pick an item to workshop with do the consider z levels when seeing what's closest? Like if there's a iron ingot 1 z level above them will they ignore the stockpile of iron 5 spaces away and walk 40 spaces just to go up one z level?

ninjewtsu
Oct 9, 2012

yes that is exactly what they will do

don't leave poo poo laying around above your workshops unless you're also putting stairs next to your workshops

megane
Jun 20, 2008



Basically the easiest space to pathfind around in is a huge empty sphere, where you can get wherever you're going by just walking straight at it. So the more your fort resembles that, the less futzing around the pathfinder has to do.

Lpzie
Nov 20, 2006

share your fort designs. maybe i have an old one somewhere here...

Tuxedo Catfish
Mar 17, 2007

You've got guts! Come to my village, I'll buy you lunch.
I've been using variations on this design for years -- it (partly by design, partly by happy accident) mostly follows the best practices laid out in ninjewtsu's post, except for the apartment blocks in the corners (but hopefully dwarves aren't pathing to or from those as often as they are between job and stockpile locations anyways) and at the entrance to the fortress, located at the top (where pathfinding efficiency had to take second place to security concerns).

Maarak
May 23, 2007

"Go for it!"

Tuxedo Catfish posted:

I've been using variations on this design for years -- it (partly by design, partly by happy accident) mostly follows the best practices laid out in ninjewtsu's post, except for the apartment blocks in the corners (but hopefully dwarves aren't pathing to or from those as often as they are between job and stockpile locations anyways) and at the entrance to the fortress, located at the top (where pathfinding efficiency had to take second place to security concerns).



There's alot I like in this, but I think with some z-level layering things could be even more efficient.


At the circled locations, carve an up/down stair way and create stock piles right above relevant workshops.

Also consider a small dining and drinking hall near the workshops for quicker breaks. For industries where every tick of output matters, build bedrooms offset by a z-level from the workshops in a similar manner to the stockpiles.

Herbotron
Feb 25, 2013

It's been a while since I played DF a lot but it was definitely best practice to put a stockpile next to any workshops and assign it to that workshop. It does help prevent some needless pathfinding, and makes it easy to control exactly what materials are used by filtering what goes into the stockpile.
Mainly it stops experienced dwarves from wasting all their time hauling, especially since they won't use wheelbarrows when gathering materials for crafting iirc.
A classic example is having a mason spend 6 months dragging a boulder from your labyrinthine mines 20 z levels below instead of the stone on the original z level 21 tiles away.

Tuxedo Catfish
Mar 17, 2007

You've got guts! Come to my village, I'll buy you lunch.
My stockpiles are in fact directly underneath their respective workshops.

As for some of the other suggestions, well, I've got a pretty beefy CPU and tend to run 20-40 dwarf microforts anyways; at some point aesthetics trump further optimization and having holes in the walls that are only accessible via the diagonal is my breaking point.

Lpzie
Nov 20, 2006

one of mine from a year ago. z+1, z, and z-1. red box's show the same location at different z's.





Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
My 321 pets/livestock might be a problem, right?

Edit: and only five cats!

ninjewtsu
Oct 9, 2012

Animals aren't going to be going on across the fortress adventures or finding new places to be as often as dwarves are, but they do generate pathfinding calls as well so yeah. Depending on where they are they can also cause blockages, which will result in many pathfinding calls being made.

My off the cuff guess is that cats are probably the most computer resource intensive animals to have around, since they wander so much. Conversely, pastured animals are probably relatively small resource sinks compared to dwarves.

Adbot
ADBOT LOVES YOU

animist
Aug 28, 2018
i always wonder if it'd be possible to patch in more efficient pathfinding with dfhack. then i consider what that project would actually be like and decide not to pursue it

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply