Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Anything I can do to reduce lag?  (Read 1081 times)

MetalGear

  • Bay Watcher
    • View Profile
Anything I can do to reduce lag?
« on: December 08, 2009, 10:05:44 pm »

I love Dwarf Fortress, but unfortunately it's a demanding game and my PC is a pile of crap. The game lags like crazy. It sometimes takes my dorfs/Adventure character a fulls second to move a tile (Okay, maybe not that much, but it's pretty close). Does anyone know if I can do something to decrease lag (especially in Fort Mode, since that's the one I'm most interested in). I realize that I won't be able to get the game running at a decent rate, but I at least want to make it playable.
Thanks in advance.
Logged

Lemunde

  • Bay Watcher
    • View Profile
Re: Anything I can do to reduce lag?
« Reply #1 on: December 08, 2009, 10:16:18 pm »

If you have a slow PC the first thing you'll want to do is lower the max population and max child population in the data/init.txt file.  Personally I use a max pop of 30 and a max children of 5.  You'll miss out on a couple of advanced features like getting a king and economy but it will be much more playable.

When you embark, lower the size of the embark area.  The default is 6x6.  4x4 might be good for you or you could push it to 3x3.  Even lowering it to 5x5 should have a significant impact.

Keep most of your animals in cages.  Not only will this decrease the birth rate(especially for cats) it will keep them from running path finding calculations all the time.
« Last Edit: December 08, 2009, 10:20:14 pm by Lemunde »
Logged

Amalgam

  • Bay Watcher
    • View Profile
Re: Anything I can do to reduce lag?
« Reply #2 on: December 08, 2009, 10:21:21 pm »

See this article. In short, try embarking with a smaller map (4x4 is the size I use and is significantly faster while still being able to accommodate a very large fort, albeit one being a little more vertical) and avoid features like chasms, towns (lots of denizens pathing everywhere) rivers (due to flow; brooks are the least laggy of them) extreme cliffs (no idea why), and magma (clunky temperature engine). Cage all creatures or put them in 1 tile pens with a restraint so they don't path all over the darn place. If you use that method make sure to make the doors non pet passable.

Probably one of the most significant sources of lag in any fort though is the number of dwarves. 200 dwarves, the default population cap in the init is insane, 100 dwarves is the max anyone should use unless your computer really can handle more, that's more dwarves than anyone should need. I set it to 40 (which usually equates to ~50 due to it not being a hard cap but a simple immigration check) and it's enough for me to get by with 50fps on a mountain map with a 1.8ghz cpu, though I won't be raising any massive armies.

Besides that, avoiding lag entirely in DF is pretty much impossible, especially since IIRC it only uses one core in any cpu. Everyone gets it. Embrace the lag.
Logged

Yagrum Bagarn

  • Bay Watcher
    • View Profile
Re: Anything I can do to reduce lag?
« Reply #3 on: December 08, 2009, 10:23:25 pm »

In addition to everything in the FPS article, try to keep your fortress space compact.  If dwarves have to trek halfway across even a 4x4 world on a regular basis, you're going to take a hit.  Take the extra time that first year to found your fortress where you want to build.

This is the only reason that I use reveal.exe.  The wiki utilities page can tell you how to get and use it.  Very useful when I want to embark on an underground river or magma pipe, but don't want to spend years trying to find it, especially when it could turn out that I need to move my entire fortress to increase FPS.

Don't make huge rooms unless you use d-o to create high traffic lanes.

If you want an underground river, dam it up right away and don't let the cave creatures breed out of control.  Killing them off and damming the river helps immensely.  (To dam an underground river, collapse a ceiling of the exact right size into the water.)

If you want magma, turn off temperature.  Sure, it's cool to toast enemies with it, but if you're having FPS problems you shouldn't be pumping it much anyway.  You can still use it to process goblin gear.  Just save, turn on temperature, reload for a couple minutes, then save and turn temperature back off.

Animals are fine to keep caged as long as you're not breeding them.  1x1 pits let them keep breeding, but whenever you butcher you'll probably let them out inadvertently.  Try putting the pit in a room with your butcher's workshop.  Let the butcher go in to do his work, and lock the door behind him.  That will help him work faster and not have to go chasing animals halfway across the map.

When you do exploratory mining, arrange the shafts so you can wall them off later.  That way you don't have dwarves and pets pathing down there uselessly.

Force caravans to enter the map at a single, nearby place.  That prevents them from pathing from the opposite map edge.

I don't find that high cliffs cause that many problems.  Nor chasms, once you clear out the creature that live there.

HFS related:
Spoiler (click to show/hide)

There's more, certainly, that you can do.  Most of it won't have as big an effect as turning off the temperature, using (at max) a 4x4 embark tile, keeping pathfinding short, or keeping the population low.

Edited to add more from my personal experience.  Amalgam beat me to the wiki article.

Another Edit:
If you don't mind having vermin and keep you dwarves generally happy in other ways, don't bring cats.  If dwarves bring male cats, fine.  If they bring female cats, arrange an accident for the feline friend.  It's worth it for framerate.
« Last Edit: December 08, 2009, 10:40:43 pm by Yagrum Bagarn »
Logged
DF gives "Last Living Dwarf" a whole new meaning.

.gif credit (and thanks) to Whitney

Amalgam

  • Bay Watcher
    • View Profile
Re: Anything I can do to reduce lag?
« Reply #4 on: December 08, 2009, 10:32:59 pm »

...There is some good news though, because some kind of pathfinding overhaul is probably due sometime in the future, which could mean significant performance increases, particularly where dwarves are concerned since they're usually the most populous and path-heavy units on any given map. Which means more dwarves! The temperature engine is also probably going to get redone, so having magma on your map won't be as crippling. If you absolutely need magma you should embark in an area with a pool, it's not nearly as bad as a vent from what I know.
Logged

wagawaga

  • Bay Watcher
  • He is utterly unaware of his own intentions.
    • View Profile
Re: Anything I can do to reduce lag?
« Reply #5 on: December 09, 2009, 11:37:29 am »

You could also try the newest 40d#. When I Installed it I realy missed the [GRID:X;Y] in the init file, but my new fort hit the 100 fps, instead of the usual 50.

So either the new ver, or the fact that i could see less on one screen, helped.
Logged

Hobbie

  • Bay Watcher
    • View Profile
Re: Anything I can do to reduce lag?
« Reply #6 on: December 09, 2009, 02:20:04 pm »

Why do all the fun things have to cause lag?!
Logged

darthbob88

  • Bay Watcher
    • View Profile
Re: Anything I can do to reduce lag?
« Reply #7 on: December 09, 2009, 05:27:18 pm »

Why do all the fun things have to cause lag?!
Simple. Fun things cause extra calculation, which causes extra lag. Everything has a cost.
Logged

Overspeculated

  • Bay Watcher
  • euklid on pth
    • View Profile
Re: Anything I can do to reduce lag?
« Reply #8 on: December 09, 2009, 05:28:08 pm »

Kill all the wildlife on your map, they create lagg.
Kill all the traders and invaders on the map, they create lagg.
Kill all the domestic animals on your map, they create lagg.
Kill all the dwarves on your map, they create lagg.

Now you have the perfect lagg-free dwarf fortress, where nothing lives, nothing moves and your FPS rate skyrockets.
Logged