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 "40d:Maximizing framerate"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(→‎Fortress layout and gameplay: call out mass Ramp designations, which cause massive lag)
 
(20 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{av}}
+
{{quality|Masterwork|15:32 27 December 2011 (UTC)}}{{av}}
 
Dwarf Fortress is an extremely CPU-intensive application that currently requires a fast, modern machine ([[System_requirements|recommendations]]).  The objective of this page is to help you reduce game lag, a crippling problem for many players.
 
Dwarf Fortress is an extremely CPU-intensive application that currently requires a fast, modern machine ([[System_requirements|recommendations]]).  The objective of this page is to help you reduce game lag, a crippling problem for many players.
  
Please mark all advice with the most recent game version it is known to work for.  This game is under rapid development, Toady One clearly intends to reduce lag where possible, and so methods that worked in, say, v0.27.169.33g may not a few months later.
+
There exists [http://www.bay12games.com/forum/index.php?topic=50514 an accelerated version] of DF.  It utilizes OpenGL much more effectively. You might want to give it a try. Due to it being an alpha of an alpha you can expect anything from wonders to utter failure; most notably, certain parts of the user interface are rather buggy, such as the selection of mechanisms to link to [[lever]]s.
 
 
== Advice for v0.28.181.40d ==
 
There exists [http://www.bay12games.com/forum/index.php?topic=50514 an accelerated version] of DF.  It utilizes OpenGL much more effectively. You might want to give it a try. Due to it being an alpha of an alpha you can expect anything from wonders to utter fail.
 
  
 
=== OpenGL ===
 
=== OpenGL ===
Line 14: Line 11:
 
=== Water control ===
 
=== Water control ===
  
This is probably obvious, but i'm stating it anyway. If you use any form of water control, reservoirs, aqueducts, etc, make sure each intermediate section delimited by floodgates is either at 0/7 or 7/7 level. Having a reservoir with both 3/7 and 4/7 tiles will just make the 4/7 tiles 'move' around - probably to simulate waves or due to a randomness element in the code (although - why waves in closed spaces?). And it will _slow_ down your box.
+
If your fortress makes use of any water transportation or storage, make sure each intermediate section delimited by floodgates is either at 0/7 (empty) or 7/7 (full) level. If a reservoir is only partially filled, liquids of different depths will slosh around and cause lag, and transitions between 3/7 and 4/7 depth can cause ''significant'' lag due to constant pathfinding recalculations (as 3/7 is safe and 4/7 is dangerous) if they are reachable by your dwarves.
 
 
I've had an irrigation system set up with a measuring reservoir. After i filled the main area, i left the measuring reservoir with water tiles at 3/7 and 4/7, and the 4/7 tiles kept moving around. I filled it up to 7/7 and my fps increased.
 
 
 
== Advice for v0.27.176.38c ==
 
  
 
=== World size ===
 
=== World size ===
Line 26: Line 19:
 
* Generate the new world.
 
* Generate the new world.
 
* Start a new game in the smaller world.
 
* Start a new game in the smaller world.
Smaller is not always better.  If you make your world too small then there will be nothing interesting on it.  So try medium first before going smaller.  Pocket dimensions are generated extremely quickly but are mostly just for testing mods. Newer versions have world generation settings which can be used to create "perfect world" as small as pocket one but with most interesting things in. This however isn't easy and requires much time.
+
Smaller is not always better.  If you make your world too small then there will be nothing interesting on it.  So try medium first before going smaller.  Pocket dimensions are generated extremely quickly but are mostly just for testing mods. Custom world generation settings can be used to create a "perfect world" as small as a pocket one but with most interesting things in, but getting the parameters right can be time consuming.
  
 
== Advice for v0.27.169.33b-g ==
 
== Advice for v0.27.169.33b-g ==
Line 48: Line 41:
 
| [PARTIAL_PRINT:YES:2]:||This makes the game only refresh sections of the screen that need to be refreshed. From init.txt: "The number refers to how many frames it will redo a printed tile before skipping it, so you might try increasing it a bit." || Can hugely increase performance but doesn't work on all systems. Using a higher value than 2 may be necessary for it to work (many players report it working when it's set one higher than their [G_FPS_CAP]).
 
| [PARTIAL_PRINT:YES:2]:||This makes the game only refresh sections of the screen that need to be refreshed. From init.txt: "The number refers to how many frames it will redo a printed tile before skipping it, so you might try increasing it a bit." || Can hugely increase performance but doesn't work on all systems. Using a higher value than 2 may be necessary for it to work (many players report it working when it's set one higher than their [G_FPS_CAP]).
 
|-
 
|-
| [PRIORITY:HIGH]:||This option automatically makes the game run in high priority.  ||This will probably prevent your computer from effectively running anything at the same time as the game and, for some players, causes major lag in the DF interface as well. Still worth a try, though.
+
| [PRIORITY:HIGH]:||This option automatically makes the game run in high priority.  ||This will probably prevent your computer from effectively running anything at the same time as the game and, for some players, causes major lag in the DF interface as well. Using this is not recommended unless you have a dual-core CPU or better.
 
|-
 
|-
|[PRIORITY:REALTIME] ||devotes even more resources to Dwarf Fortress, but has been known to cause stuttering gameplay.  ||Increasing priority will make the game difficult to kill using task manager if it locks up. This happens because things like screen output and HD access are <em>not</em> entirely part of DF. However, a dual-core machine can use realtime priority without fear of consequences, at least as long as DF remains single-threaded.
+
|[PRIORITY:REALTIME] ||devotes even more resources to Dwarf Fortress, but has been known to cause stuttering gameplay.  ||Increasing priority will make the game difficult to kill using task manager if it locks up. This happens because things like screen output and HD access are <em>not</em> entirely part of DF. However, a dual-core machine can use realtime priority without fear of consequences.
 
|-
 
|-
 
| [TEMPERATURE:NO]: || Turns off temperature greatly increases speed.  ||It also kills off some rather nice lava warming effects, stops rivers from freezing and (importantly!) thawing, makes glacial maps less interesting, and prevents sudden deaths from exposure.  You're well-advised to stick with "warm" or "hot" fortress sites if you turn temperature off and your source of water is a stream.
 
| [TEMPERATURE:NO]: || Turns off temperature greatly increases speed.  ||It also kills off some rather nice lava warming effects, stops rivers from freezing and (importantly!) thawing, makes glacial maps less interesting, and prevents sudden deaths from exposure.  You're well-advised to stick with "warm" or "hot" fortress sites if you turn temperature off and your source of water is a stream.
Line 71: Line 64:
 
* Narrow paths and bottlenecks cause the pathfinding algorithm to repeatedly recompute a faster route for each dwarf (and pet) as the paths empty and clear.  Use large hallways and multiple stairways to connect any two spots where lots of dwarves will want to be.
 
* Narrow paths and bottlenecks cause the pathfinding algorithm to repeatedly recompute a faster route for each dwarf (and pet) as the paths empty and clear.  Use large hallways and multiple stairways to connect any two spots where lots of dwarves will want to be.
 
* Keep wandering pets and wild animals to a minimum and cage livestock.  The AI for all of these has become more efficient of late and each one costs much less CPU time than a dwarf, but sheer numbers matter.
 
* Keep wandering pets and wild animals to a minimum and cage livestock.  The AI for all of these has become more efficient of late and each one costs much less CPU time than a dwarf, but sheer numbers matter.
* Avoid designating very large areas for chopping, gathering, detailing, or mining, especially if many dwarves do these things.
+
* Avoid designating very large areas for chopping, gathering, detailing, or mining, especially if many dwarves do these things. Large areas of [[ramp]] designations are '''especially''' laggy and should be avoided at all costs.
 
* Some observers suspect that having massive numbers of objects in stockpiles also impacts FPS; others believe any effect is minor{{verify}}.  Food stockpiles seem to be the worst offenders; if your fortress overproduces food, you may see a progressive slowdown even if your population and pathing complexity don't change.
 
* Some observers suspect that having massive numbers of objects in stockpiles also impacts FPS; others believe any effect is minor{{verify}}.  Food stockpiles seem to be the worst offenders; if your fortress overproduces food, you may see a progressive slowdown even if your population and pathing complexity don't change.
 
* Blocking off areas of the fortress entirely - especially (only?) with removable obstacles like drawbridges or forbidden doors - causes serious problems with pathfinding.
 
* Blocking off areas of the fortress entirely - especially (only?) with removable obstacles like drawbridges or forbidden doors - causes serious problems with pathfinding.
 
=== Cheating ===
 
* Fully revealed areas are faster than hidden ones. Running reveal.exe will make the game faster.
 
* As of 28.181.40d this appears to be quite the reverse.
 
  
 
=== Non-factors ===
 
=== Non-factors ===
Line 83: Line 72:
  
 
* Fullscreen or windowed (if OpenGL settings are compatible with the game)
 
* Fullscreen or windowed (if OpenGL settings are compatible with the game)
* Use of [[List of user graphics sets|custom graphics sets]], choice of graphics tileset
+
* Use of [[Graphics_set_repository|custom graphics sets]], choice of graphics tileset
 
* Size of tiles
 
* Size of tiles
 
* Number of z-levels mined out (fortress pathfinding complexity matters; mere distance up and down doesn't)
 
* Number of z-levels mined out (fortress pathfinding complexity matters; mere distance up and down doesn't)
 
== Advice for v0.27.169.33a ==
 
*  Upgrade.
 
 
 
== Advice for earlier versions ==
 
* If framerate is always slow at startup, your graphic card's interaction with the OpenGL code used by the game is likely to be at fault.  Turning off vertical synchronization and updating your drivers usually works.
 
*  Put animals in cages.  Never keep them behind locked doors and reduce wandering pets to a reasonable number.
 
*  Do not specify huge areas for mining or (especially) detailing.
 
*  Open up \data\init\init.txt.  Turn off TEMPERATURE and WEATHER and reduce POPULATION_CAP.
 
 
  
 
== Hardware- and OS-specific Advice ==
 
== Hardware- and OS-specific Advice ==
  
 
=== Dual Processors ===
 
=== Dual Processors ===
* Go into task manager and set the affinity of Dwarf Fortress to one processor, and then set all the programs that use significant resources to the other. If Dwarf Fortress ever utilizes more than one processor, this will of course become irrelevant; currently, however, very few programs do and the best use of a dual processor is to give DF its own processor.  This is ''not'' recommended for laptop computers, which will switch betwee processors as a heat management technique.  Pinning to one processor will cause the processor to start slowing down instead.
+
* Go into task manager and set the affinity of Dwarf Fortress to one processor, and then set all the programs that use significant resources to the other. Most programs do not use more than one processor and the best use of a dual processor is to let DF have one to itself.  This is ''not'' recommended for laptop computers, which will switch between processors as a heat management technique.  Pinning to one processor will cause the processor to start slowing down instead.
 
 
 
* Vista's START command can be used to set affinity with the /AFFINITY switch, so basically you can create a shortcut and you won't need to set affinity manually.
 
* Vista's START command can be used to set affinity with the /AFFINITY switch, so basically you can create a shortcut and you won't need to set affinity manually.
 
+
* If you are using version 0.28.181.40d19, set PRINT_MODE to 2DASYNC in init.txt
* In 40d#, set PRINT_MODE to 2DASYNC in init.txt
 
  
 
=== Laptop computers ===
 
=== Laptop computers ===
Line 120: Line 96:
 
*[[One-way|One-way paths]]
 
*[[One-way|One-way paths]]
  
[[Category:Guides]]
+
{{Category|Guides}}
 
{{Game_Interface FAQ}}
 
{{Game_Interface FAQ}}

Latest revision as of 15:16, 1 October 2021

This article is about an older version of DF.

Dwarf Fortress is an extremely CPU-intensive application that currently requires a fast, modern machine (recommendations). The objective of this page is to help you reduce game lag, a crippling problem for many players.

There exists an accelerated version of DF. It utilizes OpenGL much more effectively. You might want to give it a try. Due to it being an alpha of an alpha you can expect anything from wonders to utter failure; most notably, certain parts of the user interface are rather buggy, such as the selection of mechanisms to link to levers.

OpenGL[edit]

  • If framerate is extremely slow with an otherwise CPU-friendly fortress and a decent machine, your graphic card's interaction with the OpenGL code used by the game may be at fault. Updating your drivers usually works; you may also have to adjust some settings in your graphic card's control software, such as turning vertical synchronization off.

However, the acceleration program above works by altering the way DF interacts with OpenGL. It may be worth a try too.

Water control[edit]

If your fortress makes use of any water transportation or storage, make sure each intermediate section delimited by floodgates is either at 0/7 (empty) or 7/7 (full) level. If a reservoir is only partially filled, liquids of different depths will slosh around and cause lag, and transitions between 3/7 and 4/7 depth can cause significant lag due to constant pathfinding recalculations (as 3/7 is safe and 4/7 is dangerous) if they are reachable by your dwarves.

World size[edit]

Reducing the generated world size will make a large improvement in speed on computers with low physical memory. The world itself is generated faster, smaller, and it will take less time to save and load.

  • When starting the game pick the "Design New World With Parameters" option.
  • Select medium or smaller by using the arrow keys.
  • Generate the new world.
  • Start a new game in the smaller world.

Smaller is not always better. If you make your world too small then there will be nothing interesting on it. So try medium first before going smaller. Pocket dimensions are generated extremely quickly but are mostly just for testing mods. Custom world generation settings can be used to create a "perfect world" as small as a pocket one but with most interesting things in, but getting the parameters right can be time consuming.

Advice for v0.27.169.33b-g[edit]

Game options[edit]

In the folder "\data\init" is a file named "init.txt". Edits to this file can greatly increase game speed. Keep backups for safety and to save yourself having to re-enter values every time you upgrade.

Parameter Effect Speed Improvement
[SOUND:OFF] Disables sound. Slight increase in speed.
[FPS:YES], [FPS_CAP:100]: Handy indicator of how fast your game is running.
[G_FPS_CAP:15]: Controls refresh rate. Lower values often boost speed dramatically ... at the cost of less frequent visual updates, which can pose a problem during battles.
[VSYNC:OFF]: Attempting to synchronize refreshes can kill game speed for some players (depending on your OS, graphics card, and OpenGL settings).
[PARTIAL_PRINT:YES:2]: This makes the game only refresh sections of the screen that need to be refreshed. From init.txt: "The number refers to how many frames it will redo a printed tile before skipping it, so you might try increasing it a bit." Can hugely increase performance but doesn't work on all systems. Using a higher value than 2 may be necessary for it to work (many players report it working when it's set one higher than their [G_FPS_CAP]).
[PRIORITY:HIGH]: This option automatically makes the game run in high priority. This will probably prevent your computer from effectively running anything at the same time as the game and, for some players, causes major lag in the DF interface as well. Using this is not recommended unless you have a dual-core CPU or better.
[PRIORITY:REALTIME] devotes even more resources to Dwarf Fortress, but has been known to cause stuttering gameplay. Increasing priority will make the game difficult to kill using task manager if it locks up. This happens because things like screen output and HD access are not entirely part of DF. However, a dual-core machine can use realtime priority without fear of consequences.
[TEMPERATURE:NO]: Turns off temperature greatly increases speed. It also kills off some rather nice lava warming effects, stops rivers from freezing and (importantly!) thawing, makes glacial maps less interesting, and prevents sudden deaths from exposure. You're well-advised to stick with "warm" or "hot" fortress sites if you turn temperature off and your source of water is a stream.
[WEATHER:NO]: Turns off weather increases speed noticeably.
[CAVEINS:NO]: Turns off cave-ins increases speed only fractionally.
[POPULATION_CAP:40]: Keep your population under control to prevent the game bogging down. Pathfinding for numerous dwarves can bring even a fast machine to its knees.

Fortress site[edit]

  • Moving fluids are the major source of lag in most maps at game start. Magma and (to a lesser extent) running water are CPU hogs in the current version. If you haven't got the hardware to run DF with a magma site, suck it up and go without. Gigantic major rivers lower the framerate significantly. Aquifers (until tapped) and stagnant pools seem not to cause major speed issues.
  • Avoid elevation extremes. The fewer the z-levels, the faster the game runs.
  • Minimize map size. Smaller maps get you substantially more speed.
  • Avoid caves, towns, ruins, or anything populated. Everything in them invokes the pathfinding code frequently.
  • Hidden Fun Stuff can cause a substantial slowdown once you break into it, though it's not a problem while it's still hidden.

Fortress layout and gameplay[edit]

  • Narrow paths and bottlenecks cause the pathfinding algorithm to repeatedly recompute a faster route for each dwarf (and pet) as the paths empty and clear. Use large hallways and multiple stairways to connect any two spots where lots of dwarves will want to be.
  • Keep wandering pets and wild animals to a minimum and cage livestock. The AI for all of these has become more efficient of late and each one costs much less CPU time than a dwarf, but sheer numbers matter.
  • Avoid designating very large areas for chopping, gathering, detailing, or mining, especially if many dwarves do these things. Large areas of ramp designations are especially laggy and should be avoided at all costs.
  • Some observers suspect that having massive numbers of objects in stockpiles also impacts FPS; others believe any effect is minor[Verify]. Food stockpiles seem to be the worst offenders; if your fortress overproduces food, you may see a progressive slowdown even if your population and pathing complexity don't change.
  • Blocking off areas of the fortress entirely - especially (only?) with removable obstacles like drawbridges or forbidden doors - causes serious problems with pathfinding.

Non-factors[edit]

The following things don't have a significant effect on game speed, at least as tested.

  • Fullscreen or windowed (if OpenGL settings are compatible with the game)
  • Use of custom graphics sets, choice of graphics tileset
  • Size of tiles
  • Number of z-levels mined out (fortress pathfinding complexity matters; mere distance up and down doesn't)

Hardware- and OS-specific Advice[edit]

Dual Processors[edit]

  • Go into task manager and set the affinity of Dwarf Fortress to one processor, and then set all the programs that use significant resources to the other. Most programs do not use more than one processor and the best use of a dual processor is to let DF have one to itself. This is not recommended for laptop computers, which will switch between processors as a heat management technique. Pinning to one processor will cause the processor to start slowing down instead.
  • Vista's START command can be used to set affinity with the /AFFINITY switch, so basically you can create a shortcut and you won't need to set affinity manually.
  • If you are using version 0.28.181.40d19, set PRINT_MODE to 2DASYNC in init.txt

Laptop computers[edit]

  • Frame rate is higher when running off mains power. This is because laptops reduce CPU performance to extend the battery life.
  • You can disable that feature in MS Windows, at the expense of the battery running out much more quickly.
  • Some laptops may overheat if you run Dwarf Fortress for too long, keep your laptop cool if you find that after a while FPS suddenly drops. (This is due to CPU throttling intended to prevent possible damage from heat building up.)

Dual monitors[edit]

  • Display DF entirely on one screen (no overlap to the second screen whatsoever).

See also[edit]