Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Best way to prevent FPS lag?  (Read 6062 times)

rojiru

  • Bay Watcher
    • View Profile
Best way to prevent FPS lag?
« on: September 02, 2011, 09:01:15 pm »

With about 10 dwarves my beginning forts zip around like I'm playing in real time.

At about 130 dwarves it's sluggish as hell.

I'm running a mix of graphics packs and sound sense.

What can I do to relieve the lag? I already crush socks, migrant pets and corpses on a ridiculously consistent basis.
Logged

Broseph Stalin

  • Bay Watcher
  • Dabbling Surgeon, Proficient Butcher.
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #1 on: September 02, 2011, 09:12:09 pm »

You can go into init and turn off temperature or change priority but what I found really helps is lowering the refresh rate.

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #2 on: September 02, 2011, 09:14:15 pm »

The simple response (not answer) is "Dwarf Fortress is complex.  It consumes a lot of data."  The only way to maintain high FPS is to maintain a small setting.

BeforeLifer

  • Bay Watcher
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #3 on: September 03, 2011, 12:06:29 am »

I do belive that in the news artical about DF (you can find it on the dev-log. just scroll down a bit.) somewere around half way or a little bit more than half, a friend of toady who is also a arodynamic enginer said that DF has more complex simulations that arodynamic simulations O_o If that doesent say something about how complex DF is idk what will.
Logged
Any thoughts on how this can be abused?
Around these parts It's called weaponized

Corneria

  • Bay Watcher
  • [TORTURE_FOR_FUN:ACCEPTABLE][TRESPASSING:SHUN]
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #4 on: September 03, 2011, 01:59:55 am »

You answered your own question. If it runs quickly at 10 dwarves, but slowly at 130, don't have 130 dwarves.
Logged
Oh yeah: Nazis.  Now I lost the argument.  So you can't argue with me anymore.  Nyah.

plynxis

  • Bay Watcher
  • Oh god I'm so tired, leave me alone...
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #5 on: September 03, 2011, 02:44:53 am »

lol before turning off temperature and stuff, make sure your pathing is optimized as much as reasonably possible (eg. try widening teh hallz), atom smash all excess stone, use ramps instead of stairs, pen/pasture animals etc.

then kill of excess dwarves
Logged
What? Go away, I'm sleep deprived...

Korva

  • Bay Watcher
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #6 on: September 03, 2011, 05:45:50 am »

Running water eats FPS, and reactors/power generators are especially notorious there so shut off what you can if you have those. Ambushes from stealthed enemies do the same; you can sometimes tell they're coming when your FPS plummets without apparent reason in the last month of a season. Finally, having the fort open to one or more of the caverns can reduce FPS as well because it opens up that much more terrain for pathfinding consideration (your dwarves' and the enemies').
Logged

Tevish Szat

  • Bay Watcher
  • [PREFSTRING:diabolical schemes]
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #7 on: September 03, 2011, 10:50:10 am »

I've tried to put this in rough order of priority

1) Tracking lots of objects strains the game, reducing your FPS.  Moving objects are especially hard, as they have to pathfind (see below).  Cage or butcher (or cage then butcher) all animals you don't strictly need.  Put all ghosts to rest.  Atom-smash refuse and use or atom-smash stone.  If you find FPS more useful than dwarves, dispose of surplus population.

2) Pathfinding eats calculations.  Seal off the caverns if you've opened them, and any unused wings of your fortress (old strip mines, say).  widen halls and use traffic designations

3) Extra complexity hurts.  Disable any water reactors or pump-stacks, especially magma pump stacks.  This is a REALLY BIG FPS hit, which is why it's so high, but these things tend to be mission-critical, hence why 1 and 2 come first

4) Turn off weather.

5) Turn off temperature and/or invaders in a last ditch effort to save a fortress from FPS-death
Logged
A medium-sized humanoid fond of fantasy and science-fiction.

Tevish Szat likes books, computers, board games, and cats for their aloofness. When possible, he prefers to consume hamburgers and macaroni and cheese. He needs caffeine to get through the working day.

rojiru

  • Bay Watcher
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #8 on: September 03, 2011, 10:56:13 am »

So let's see, aside from not having a lot of dwarves (which is critical to unlocking more of the game) I need to:

1) Get rid of excess stuff.
2) Use traffic designations and seal off caverns.
3) No moving liquid.
4) Get rid of weather.

What is this about lowering the refresh rate?
Logged

BoogieMan

  • Bay Watcher
  • Hi
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #9 on: September 03, 2011, 12:03:48 pm »

I made a massive improvement on my game speed by building a multi leveled fortress. Each level is small enough no scrolling is needed. Previously my floors were too big. So instead of expanding outwards much, go up/down. Additionally:

Things that seemed to have helped me quite a bit:

Walling off pointless areas.
Limiting/cutting access to large outdoor and cave areas.
2 or 3 wide hallways. This helps dwarves travel smoothly and lowers pet fighting - they seem MUCH more likely to fight each other if they are forced to occupy the same square.
Keep material relevant stockpiles very close to workshops that use that resource. Also significantly improves production response time and build efficiency.
Heavy use of traffic designations to make workshops, large stone stockpiles, and other low traffic areas less desirable for normal fortress traversing.

I use the Lazy Newb Pack launcher and I set the game at 100 Calculation FPS cap and 30 Graphical FPS cap. You can do this by editing the init.ini as well. My print mode is VBO, seems to work good on my card. I also use Soundsense (which is awesome) and the Ironhand graphic set. I have an Intel Core2Duo @ 2.93Ghz each core, and 4GB of gaming RAM that is about two years old. Windows 7. My graphics card is an MSI TwinFrozr 1G OC which is basically a faster NVIDIA GeForce GTS 250 with 1GB of memory. I haven't change any other things about the game like the temperature and weather, that's all stock.

I have the FPS counter displaying in game and it shows two numbers. I believe the first number is the calculation speed (how quickly everything moves and such) and the second is frames per second, which is just graphics. My current Fortress is about 5 years old, 143 Dwarves, around 220 pets. I have 2 waterfalls that go about 3 or 4 z-levels. One natural, one artificial. I use them for mist generators, two from the natural waterfall and one from the artificial one. But my game typically holds around 62-73 calculations and 29-30 FPS, which is capped at 30 anyway so it's basically unchanged. My previous less efficiently designed fortress had roughly the same Dwarf/Pet population, fortress age, and map complexity. When I decided to give up on it and it ran much, much worse. I've yet to ever utilize these atom smashers I hear about though, so maybe I could get even more with that but so far it's a nice improvement as that still feels like a reasonable steady speed. So it seems to me efficient design is the single best thing you can do besides having a good computer. Followed by finding which print mode works best for you.

You could try lowering the population cap, but if you do look into what you need for nobles and other things that advance your fortress as it seems many are governed by your population.
« Last Edit: September 03, 2011, 12:06:36 pm by BoogieMan »
Logged
(╯°□°)╯︵ ┻━┻ BoogieMan, Forumscrub cancels tantrum: Seeking Dr. Pepper

Corneria

  • Bay Watcher
  • [TORTURE_FOR_FUN:ACCEPTABLE][TRESPASSING:SHUN]
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #10 on: September 03, 2011, 12:16:11 pm »

Fewer nobles seems like a rather convincing side benefit of lower population.
Logged
Oh yeah: Nazis.  Now I lost the argument.  So you can't argue with me anymore.  Nyah.

UberNube

  • Bay Watcher
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #11 on: September 03, 2011, 07:04:36 pm »

It's worth having a decent understanding of the pathfinding system DF uses. I believe it is a simple A* implementation with some caching, which means there are a few ways to optimise layout for pathfinding efficiency:

1. Have your popular areas close together. If the dwarves don't have to path far, then it will be much faster. To make the distances even shorter, I suggest a vertical layout, with stockpiles above and below workshops, rather than beside them.

2. No big open spaces - the caverns are the worst culprits here, especially if your dwarves have to path to objects on the other side of them. Some industries require this though, so it's personal preference. I would recommend a GCS silk farm though, rather than harvesting. Also, it's worth noting that wide corridors increase movement speed, but actually reduce your framerate since every single tile in the corridor must be checked for pathing. In fact, if you want to speed things up, make liberal use of pathing restrictions to encourage dwarves to stick to the core of the fort.

3. Minimise hauling. If the dwarves don't have to move around as much, then there will be less strain on the processor. Expect lag if you suddenly un-forbid all the dropped equipment from the last 10 sieges.
Logged
This guy gets it, the problem with the child torture dungeon is that they weren't set on fire first.

thegoatgod_pan

  • Bay Watcher
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #12 on: September 04, 2011, 04:49:02 am »

Small world and small embark areas heavily improve f.p.s
Logged
More ridiculous than reindeer?  Where you think you supercool and is you things the girls where I honestly like I is then why are humans on their as my people or what would you?

Forumite

  • Bay Watcher
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #13 on: September 04, 2011, 05:46:32 am »

On Magma Pumpstacks

There was a thread a while ago that explained how the massive drop in FPS from magma pumpstacks came from temperature changes, how each level of the stack changes temperature when full and empty. Widening the stack, 1x3 instead of 1x1 wide magma compartment, so that there is always magma present at each level, ensure that the temperatures is constant while pumping. Without temperature changes, a magma pumpstack taxes the FPS just like a water pumpstack, which is much less.
Logged
"The ability to quote is a serviceable substitute for wit." - W. Somerset Maugham

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Best way to prevent FPS lag?
« Reply #14 on: September 04, 2011, 05:58:21 am »

A floating pumpstack is pretty amazing, actually.  The idea is, you build a regular magma pumpstack, except every level is pumping out into open air.  The magma doesn't fall because the pump above it "catches" the flow before it falls, and the magma progresses upwards without ANY temperature changes to any stone.  The only problem is, once cut off, any magma in-flight will fall, but for moving fluids it's not a bad method.