Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Trying to design an efficient fortress.  (Read 1406 times)

Talanic

  • Bay Watcher
  • Struggling author / pizza delivery guy.
    • View Profile
Trying to design an efficient fortress.
« on: December 18, 2015, 07:24:59 pm »

My wooden computer menaces with spikes of lag, so I'm always trying to bolster my flagging framerate.  Historically, I can't keep fps over 100 with over fifty dwarves, so I've been experimenting with smaller and smaller forts.

My latest is 11x11x12 with ramps in the corners and a double spiral in the middle.  I've only tested it once, but wound up able to fit all of my workshops on the first five floors, albeit with butcher and tanner on the surface.  I intend to use the central spire for a minecart path to load and unload quantum stockpiles by appropriate workshops, but am still having a few hitches with mine carts when I don't want to unload everything.

Spoiler: My quickfort. (click to show/hide)

My mining area connects to the southern edge of whichever level I decide contains my mason, mechanic, smelters and forge.  I made sure each ramp actually connects to the floor above, and the whole thing can be repeated again underneath the bottom layer for another four levels, if you want.  Unfortunately, I'm not so great at doing actual analysis of how efficient this really is; anyone who is want to weigh in?
Logged
I'm an aspiring Science Fiction and Fantasy writer.  I'm telling the tale of a hapless cyborg everyman lost in a savage fantasy world.

My first review from a real magazine!

Pseudo

  • Bay Watcher
    • View Profile
Re: Trying to design an efficient fortress.
« Reply #1 on: December 20, 2015, 08:35:46 am »

A couple thoughts:

  • You don't have space for bedrooms. They aren't absolutely necessary, but you can end up with happiness problems otherwise
  • It's generally more efficient to have unrelated workshops scattered in favor of keeping the tavern / bedroom(s) closer
  • Using stockpile links helps (as it means that dwarves at workshops won't try to path to that one bloodthorn log in the caverns if you're out of something)
  • Keep your item count down! Be without ruth. Note that this includes constructions.
  • Having your mines be completely unpathable from your main fort helps substantially (use a minecart lock to go between the two of them. Note that you'll need bedrooms / food / drink for your miner dwar{f}/{ves}). Be careful about anything in the mines though (see pathing, below)
  • Actually, in general anytime you have a large area, if you can make it completely separate from your main fort, do so (again, see pathing below though). If you can't, a trick I've found is designating the entire thing restricted, then every third row or column normal, then one column or row (respectively) normal as well, as well as all edges. Means that dwarves won't take optimum paths if they do need to get in there, but means that generally they won't have to explore the entire thing.
  • Creatures trying and failing to path is one of the worst FPS killers currently. A single turkey failing to get to a nest box can take 20ms or more.
  • Microoptimization, but note that DF paths from the target to the source, not vice versa. As such, having the target be blocked in is substantially better for FPS than having the source be blocked in (see above) - if the target is blocked in it'll explore just the area around the target, whereas if the source is blocked it it'll explore the entire rest of the map. (Note: not always, as DF keeps track of what areas it thinks are connected. But it isn't always accurate)
  • Ramps are good, but only make sense when they are between source and target. (If you go up/down and then turn around, they are no better than stairs)
  • Dwarves use Manhattan distance to find items before actually trying to path to them, which means that if, for example, you have a stockpile directly below/above a workshop, he'll think it's only ~one step away. Again, stockpile links can help, as can carefully-placed stockpiles
Logged
The lady the dog the paper the boy writ hit bit knit.

English is weird.

mobucks

  • Bay Watcher
    • View Profile
Re: Trying to design an efficient fortress.
« Reply #2 on: December 20, 2015, 10:14:45 am »

Try to find "thin" embarks. My current fort is only ~40z.

Gen worlds with only 1 cavern level helps with the above and also only one cavern helps FPS anyway.

I always embark on tundra or other vegetation sparse biomes. No trees on the surface helps a lot.

Make the entire fort on one z-level. The common central staircase design with the fort spread over many Z levels actually makes FPS drop as you gain more population. Pathfinding needs to check every level every time a dwarf moves so that all adds up with the higher pops.

I've been fighting for high FPS in this game for a few years now and these suggestions are what I perceive as the most helpful.
Logged

Wastedlabor

  • Bay Watcher
    • View Profile
Re: Trying to design an efficient fortress.
« Reply #3 on: December 20, 2015, 11:11:35 am »

My current fort is a FPS black hole and I'm ok with it, but when I wanted FPS I went for a shallow volcano embark and built a goblin melter at the entrance. The biggest FPS killer is having to pause to hunt for all those XX(troll fur shock)XX to get rid of them.
Logged
He stole an onion. Off with his head.
I wonder, what would they do if someone killed their king.
Inevitable, who cares. Now an onion...

Pseudo

  • Bay Watcher
    • View Profile
Re: Trying to design an efficient fortress.
« Reply #4 on: December 21, 2015, 08:59:17 am »

If you want FPS, don't go with a volcano at all. "Just" go for as shallow an embark as you can, and the magma sea is already close enough to the surface.

(Also: w.r.t. worn clothing, if you're looking for FPS, make everyone wear armor and have an auto-destroying (e.g. dumping into magma) stockpile for clothing. The only dwarves you then need to worry about are miners / hunters.)

And mobucks? You're right and you're wrong. As far as I know, adding vertical height doesn't add any more (or less) load on the pathfinding than adding an equivalent amount elsewhere. But people tend to underestimate how many tiles vertical forts actually take up. And people tend to build forts with a single central staircase without doing any traffic designations, which is pretty close to the pathological case for (reverse) A*. If you go vertical, marking the neighboring tiles of staircases low traffic helps a lot.

On a related note, a minor change to the pathfinder that could be helpful is a heatmap of how often tiles are part of a valid path, where the pathfinder breaks ties by exploring the tile that has the highest value first.
Logged
The lady the dog the paper the boy writ hit bit knit.

English is weird.

Slogo

  • Bay Watcher
    • View Profile
Re: Trying to design an efficient fortress.
« Reply #5 on: December 21, 2015, 10:24:44 am »

You can always use overlapping bedrooms (i.e a dormitory where you designate every bed) to save space.


If you want more inspiration I tried to make the tiniest complete fort I could once and this is what it looked like: http://mkv25.net/dfma/map-12321-smallabbey

By complete I mean it supported all the major industries: above ground farming, below ground farming, livestock, fishing, glass, clay, clothes, dyeing, carpentry, masonry, jail, crypt, forging, archery, and melee military training.


----
On pathfinding....

The problem with vertical designs normally is a similar problem to what you can have with a flat design. The pathfinding will expand its search across the floors the dwarf is descending if the target they are after is far away from the central staircase (ignoring z-level). That's because it would be as fast, if not faster, on each level to head towards the objective as if it were on that level then 'find' staircases leading down along the way.

But that can happen too if you had a centralized hallway with rooms coming off it.

The general key to good pathfinding is quite simple: The straighter the path between two points the less it costs for pathfinding.

More practically what you want to avoid are large areas (either single or multiple rooms) that are 'along the way' from point A to B but are actually dead ends.

So like in my Small Abbey above the pathing works really well because each floor is tiny and it doesn't have to search too many tiles inefficiently when it wants to find a path. I could make the pathfinding even better though by adding additional stairs around the edge of the fortress.


« Last Edit: December 21, 2015, 10:32:10 am by Slogo »
Logged