v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "v0.31:Maximizing framerate"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
 
(55 intermediate revisions by 35 users not shown)
Line 1: Line 1:
{{quality|Fine|08:00, 22 May 2010 (UTC)}}
+
{{quality|Fine|01:51, 19 January 2011 (UTC)}}
 
+
{{av}}
''Caution: This article is dated and needs a rewrite.''
 
 
 
 
 
 
[[File:Frames_Per_Second_Meter.png|300px|thumb|bottom|A picture of Dwarf Fortress with Frames Per Second displayed.]]
 
[[File:Frames_Per_Second_Meter.png|300px|thumb|bottom|A picture of Dwarf Fortress with Frames Per Second displayed.]]
  
{{L|Frames per second|Framerate}} is used in Dwarf Fortress to measure the speed at which the game is running. To check your FPS (frames per second) in Dwarf Fortress, simply change [FPS:NO] to [FPS:YES] in {{l|init.txt}}, and your FPS will be displayed near the top right corner of the screen.
+
[[Frames per second|Framerate]] is used in Dwarf Fortress to measure the speed at which the game is running. It is measured in "frames per second", or FPS for short. To check your FPS in Dwarf Fortress, simply change [FPS:NO] to [FPS:YES] in [[init.txt]], and your FPS will be displayed on the top row of the screen. The first number is the current frame rate, while the number in parentheses is the current graphical frame refresh rate.
 
 
==Ways to increase your framerate==
 
 
 
* Decreasing the G_FPS in the init text file can drastically improve your fortress' overall FPS. Be careful however, decreasing it too much can subject you to incomprehensible graphic instabilities. G_FPS refers to the "maximum graphical frame refresh rate during play." In other words, the maximum number of times it repaints the graphics of your game per second. When I said incomprehensible graphic instabilities, I'm referring how hard and critical it will be to have a really low G_FPS during battle or when arrows are flying over your Dwarves' heads. The default is 50 G_FPS, but it's been reported that 20 G_FPS is fine. Others report being able to play at even 5 G_FPS. There is no set number, just remember to test out a variety of numbers to see which one is right for you and your computer.
 
 
 
*Disabling [[Temperature]] and [[Weather]] in the init file increases speed for obvious reasons (fewer calculations).
 
 
 
*Limiting the number of dwarves and other moving units (cage/butcher animals!) greatly helps keep speed up.
 
 
 
*World size and fortress site size increase RAM usage and decrease speed. Check if you are happier with an embark rectangle of 3x3 and a medium or small world.
 
 
 
*Some people claim using ramps insteads of stairs increases speed, possibly due to ramps allowing fewer paths between levels.
 
 
 
*Using Baughn's Accelerator program. This was written for the old 40d stuff before most of the recent graphics updates. It is generally reported to increase performance in both windows and WINE DF games, though there have been some reports of a blue tinge and instability arising from the accelerator. See the Bay12 thread  [http://www.bay12games.com/forum/index.php?topic=51957.0 here]. Please note that this is intended solely as a stopgap until the 40d-graphics merge, so if it doesn't work, don't use it. Baughn has stated that he will not devote time to bugtesting it.
 
:: ''Obsolete as of 31.04 which introduced the 40d-graphics merge. Trying to use it will only cause DF to crash at launch.''
 
 
 
*In Baughn's program, changing [PARTIAL_PRINT:NO:2] to [PARTIAL_PRINT:YES:2] often dramatically improves performance.
 
:: ''In 31.04 partial printing is currently disabled as a workaround for other problems according to a forum post by Baughn and will likely be back in future versions.''
 
 
 
*Lowering the pathfinder cost for normal tiles to 1 can reduce lag created by open space and dwarf but does this at the cost of beeing able to use high traffic options. Alternatifly you can cover the entire map with high trafic tiles and simply make everything you don't want your dwarf low or restricted.
 
 
 
== Lockdowns ==
 
 
 
*It has been reported that some people experience "lockdowns" (severe drops in fps for several seconds) when building a well. You may want to try removing yours.
 
  
*Sometimes placing statues can also cause "lockdowns".
+
==Increasing your Framerate==
 +
In general, the more stuff the game has to keep track of, the slower the game will run. So, reducing the amount of stuff active keeps your game running fast.  Some possible reasons for slowdown, and ways to reduce and/or eliminate them:
  
*Similarly, "lockdowns" can often occur when {{L|water}} is seasonally {{L|ice|freezing}} or thawing, as it requires changing the properties of a large number of tiles at once, and thawing requires recalculation of all fluid dynamics. This is particularly problematic as many {{L|temperate|temperate zones}} experience seasonal freezing due to recent changes to {{L|weather|outside temperature ranges}}{{version|0.31.05}}
+
* Fewer items inside a fort means fewer items to be [[stockpile]]d, checked for [[wear]], and so on and so forth.
 +
** Use a [[Dwarven atom smasher]] to remove items, or donate them to [[Trading|passing caravans]] to be taken away.
 +
** Don't dig out so much of the ground, don't build such large [[Farming|farm plot]]s, just don't generate so many items in the first place.
 +
* Flowing [[water]] slows the game down.
 +
** Don't build [[mist]] generators, [[Screw pump|pump stacks]], or other major water-moving projects.  If you do build them, build a [[Lever|way to switch them off]]. 
 +
** Don't embark on a [[river]] or [[ocean]].  Rivers aren't too bad in their natural state, because the game only needs to calculate at where the water enters and where the water leaves, more-or-less skipping the water in between.  Then you start damming them and pumping water out, and it gets worse.
 +
** [[Aquifer]]s don't impose load until you start digging around in them.
 +
**[[Water wheel#Perpetual motion|Dwarven water reactors]] also slow down the game, often significantly.
 +
* Each dwarf needs to keep track of where he's going.
 +
** Limit the number of dwarves by setting the population cap.
 +
* Each animal needs to pathfind, too.
 +
** Tame animals can be put into [[cage]]s, keeping them from having anywhere to go.  Or you can butcher them.
 +
* Invaders also need to pathfind.
 +
** Turn off invasions using the option in [[D_init.txt]]. Or you can kill them all.
 +
* Contaminants, including [[blood]] spatters, accumulate on the ground and on dwarves and creatures.  When they walk over contaminants, these sometimes get smeared and spread.  There is a bug ({{bug|296}}) which makes contaminants continuously multiply and another bug ({{bug|3270}}) which prevents blood spatters from ever disappearing.
 +
** There is a setting in D_init.txt (as of {{version|0.31.16}}) that prevents them spreading from dwarf (or animal) to ground.  For [[v0.31:Fortress_mode|Fortress Mode]], this is [[v0.31:Technical_tricks#More_Game_Options|WALKING_SPREADS_SPATTER_DWF]] and is already turned off by default.
 +
** If the contaminants are outside, isolate the area and let [[v0.31:Weather|rain]] slowly wash it away. Pets can be kept out with a [[Activity_zone#Pen.2FPasture|pen/pasture]] or a [[v0.31:Activity_zone#Pit.2FPond|pit]]. Similarly, setting the [[traffic]] designation to restricted and/or assigning [[Activity_zone|Activity Zones]] strategically may keep dwarves away.
 +
** Add in some in-fortress means of cleaning dwarves and pets. The "Dwarven Bathtub" is one example. And make sure you have the [[cleaning]] labor enabled. Details of these and other suggestions can be found on the [[cleaning]] page.
 +
** Finding the above cleaning measures too tedious or lacking, some players opt to [[v0.31:Cheating|cheat]] by using the [[v0.31:Utilities#dfcleanmap|dfcleanmap]] tool from the [[v0.31:Utilities#DFHack|DFhack]] library.
 +
* G_FPS is a setting in the [[init.txt]] file.  It controls how often Dwarf Fortress redraws the screen.  It also controls how often the game checks for keyboard or mouse input.
 +
** Reducing G_FPS can speed up the rest of the game.  The default choice of 50 works well, but many people reduce it down to 20 with no ill effect.
 +
** Reducing G_FPS too far can make the game unresponsive and glitchy.  Some people can cope with 5;  most cannot.
 +
* PRINT_MODE is another init setting.  It controls the method Dwarf Fortress uses to draw the screen.
 +
** More advanced methods allow DF to make more use of OpenGL features and therefore your graphics card.  STANDARD and VBO are good starting points.
 +
** More advanced methods may still have bugs.  2D is more likely to be reliable.
 +
* [[Temperature]] and [[Weather]] are two more features which users may or may not notice.
 +
** Disabling them, using the settings in d_init.txt, can speed things up.
 +
** But then rain won't refill [[murky pool]]s, [[magma]] won't melt [[goblin]]s, etc.
 +
** One user [http://www.bay12forums.com/smf/index.php?topic=86761.msg2352509#msg2352509 reported] an FPS boost from 35 to 90 upon disabling temperature.
 +
* The size of your world and embark site both increase the amount of terrain which DF needs to keep track of.
 +
** If you don't mind going vertical, try reducing your embark site from the default 4x4 squares to 3x3 or even 2x2.
 +
** World size probably doesn't matter except for the size of the save files, but reducing the number of cavern layers (default of 3) will help.  You need at least 1 cavern layer to get underground [[crop|plants]], and 2 caverns to get all the underground [[tree]]s.
 +
* Proper use of [[traffic]] designations will help.
 +
** Setting corridors to "high" traffic, and dead-end workshop rooms next to them to "low" traffic, means the pathfinder algorithm will search more quickly along the corridor, and waste less time searching in the rooms.
 +
** Changing the normal traffic weight to 1 in d_init.txt will optimize the pathfinder at the cost of High traffic zones not making a difference ([http://www.bay12forums.com/smf/index.php?topic=97763.msg2841109#msg2841109 source])
 +
* Closing off unused areas with raised [[bridge]]s and locked [[door]]s can help.
 +
** Reducing the area which the pathfinder algorithm has to search lets it run faster.
 +
** In general the pathfinder algorithm is good about not searching irrelevant areas.  Caverns are probably the worst offender.
 +
* Disabling your Dwarven civ from wearing clothing as a mod (required regen of world) may help maintain higher fps later in the game{{bug|3942}}, if you don't mind naked dwarves running around. Alternatively, finding a way to dump excess/worn out clothing might help restore fps on existing fortresses. Requires research.
 +
* Encountering [[HFS]] will dramatically reduce FPS if you seal the breach ({{bug|1340}}). Either avoid doing so or use the work around posted in the bug report.
 +
* Use the default ASCII Graphics Tileset. Custom tilesets (such as Ironhand, Mayday, and Phoebus) can decrease your framerate.
 +
** Citation needed; if you don't use creature graphics, it handles it the exact same way as the normal ASCII tileset; they're both just images.
 +
*Mac OSX: Spotlight indexes files on your mac. Since DF constantly changes files, spotlight will keep indexing them using 60-70% of your CPU. Exclude DF in system preferences: spotlight's privacy settings and you can get a factor of two in FPS. This can easily provide benefits of over 30 FPS, even on multicore computers that do not need to worry about CPU.
  
*Another way to get "lockdowns" is by having large bridges going up or down at the same time.
+
{{Category|Guides}}

Latest revision as of 20:20, 31 July 2012

This article is about an older version of DF.
A picture of Dwarf Fortress with Frames Per Second displayed.

Framerate is used in Dwarf Fortress to measure the speed at which the game is running. It is measured in "frames per second", or FPS for short. To check your FPS in Dwarf Fortress, simply change [FPS:NO] to [FPS:YES] in init.txt, and your FPS will be displayed on the top row of the screen. The first number is the current frame rate, while the number in parentheses is the current graphical frame refresh rate.

Increasing your Framerate[edit]

In general, the more stuff the game has to keep track of, the slower the game will run. So, reducing the amount of stuff active keeps your game running fast. Some possible reasons for slowdown, and ways to reduce and/or eliminate them:

  • Fewer items inside a fort means fewer items to be stockpiled, checked for wear, and so on and so forth.
  • Flowing water slows the game down.
    • Don't build mist generators, pump stacks, or other major water-moving projects. If you do build them, build a way to switch them off.
    • Don't embark on a river or ocean. Rivers aren't too bad in their natural state, because the game only needs to calculate at where the water enters and where the water leaves, more-or-less skipping the water in between. Then you start damming them and pumping water out, and it gets worse.
    • Aquifers don't impose load until you start digging around in them.
    • Dwarven water reactors also slow down the game, often significantly.
  • Each dwarf needs to keep track of where he's going.
    • Limit the number of dwarves by setting the population cap.
  • Each animal needs to pathfind, too.
    • Tame animals can be put into cages, keeping them from having anywhere to go. Or you can butcher them.
  • Invaders also need to pathfind.
    • Turn off invasions using the option in D_init.txt. Or you can kill them all.
  • Contaminants, including blood spatters, accumulate on the ground and on dwarves and creatures. When they walk over contaminants, these sometimes get smeared and spread. There is a bug (Bug:296) which makes contaminants continuously multiply and another bug (Bug:3270) which prevents blood spatters from ever disappearing.
    • There is a setting in D_init.txt (as of v0.31.16) that prevents them spreading from dwarf (or animal) to ground. For Fortress Mode, this is WALKING_SPREADS_SPATTER_DWF and is already turned off by default.
    • If the contaminants are outside, isolate the area and let rain slowly wash it away. Pets can be kept out with a pen/pasture or a pit. Similarly, setting the traffic designation to restricted and/or assigning Activity Zones strategically may keep dwarves away.
    • Add in some in-fortress means of cleaning dwarves and pets. The "Dwarven Bathtub" is one example. And make sure you have the cleaning labor enabled. Details of these and other suggestions can be found on the cleaning page.
    • Finding the above cleaning measures too tedious or lacking, some players opt to cheat by using the dfcleanmap tool from the DFhack library.
  • G_FPS is a setting in the init.txt file. It controls how often Dwarf Fortress redraws the screen. It also controls how often the game checks for keyboard or mouse input.
    • Reducing G_FPS can speed up the rest of the game. The default choice of 50 works well, but many people reduce it down to 20 with no ill effect.
    • Reducing G_FPS too far can make the game unresponsive and glitchy. Some people can cope with 5; most cannot.
  • PRINT_MODE is another init setting. It controls the method Dwarf Fortress uses to draw the screen.
    • More advanced methods allow DF to make more use of OpenGL features and therefore your graphics card. STANDARD and VBO are good starting points.
    • More advanced methods may still have bugs. 2D is more likely to be reliable.
  • Temperature and Weather are two more features which users may or may not notice.
    • Disabling them, using the settings in d_init.txt, can speed things up.
    • But then rain won't refill murky pools, magma won't melt goblins, etc.
    • One user reported an FPS boost from 35 to 90 upon disabling temperature.
  • The size of your world and embark site both increase the amount of terrain which DF needs to keep track of.
    • If you don't mind going vertical, try reducing your embark site from the default 4x4 squares to 3x3 or even 2x2.
    • World size probably doesn't matter except for the size of the save files, but reducing the number of cavern layers (default of 3) will help. You need at least 1 cavern layer to get underground plants, and 2 caverns to get all the underground trees.
  • Proper use of traffic designations will help.
    • Setting corridors to "high" traffic, and dead-end workshop rooms next to them to "low" traffic, means the pathfinder algorithm will search more quickly along the corridor, and waste less time searching in the rooms.
    • Changing the normal traffic weight to 1 in d_init.txt will optimize the pathfinder at the cost of High traffic zones not making a difference (source)
  • Closing off unused areas with raised bridges and locked doors can help.
    • Reducing the area which the pathfinder algorithm has to search lets it run faster.
    • In general the pathfinder algorithm is good about not searching irrelevant areas. Caverns are probably the worst offender.
  • Disabling your Dwarven civ from wearing clothing as a mod (required regen of world) may help maintain higher fps later in the gameBug:3942, if you don't mind naked dwarves running around. Alternatively, finding a way to dump excess/worn out clothing might help restore fps on existing fortresses. Requires research.
  • Encountering HFS will dramatically reduce FPS if you seal the breach (Bug:1340). Either avoid doing so or use the work around posted in the bug report.
  • Use the default ASCII Graphics Tileset. Custom tilesets (such as Ironhand, Mayday, and Phoebus) can decrease your framerate.
    • Citation needed; if you don't use creature graphics, it handles it the exact same way as the normal ASCII tileset; they're both just images.
  • Mac OSX: Spotlight indexes files on your mac. Since DF constantly changes files, spotlight will keep indexing them using 60-70% of your CPU. Exclude DF in system preferences: spotlight's privacy settings and you can get a factor of two in FPS. This can easily provide benefits of over 30 FPS, even on multicore computers that do not need to worry about CPU.