- 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.
Maximizing framerate
This article was migrated from DF2014:Maximizing framerate and may be inaccurate for the current version of DF (v50.14). See this page for more information. |
v50.14 · v0.47.05 This article is about the current version of DF.Note that some content may still need to be updated. |
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-game, go to settings - Game and turn Show frames-per-second to Yes. Then your FPS will be displayed on the bottom 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
In general, the more stuff the game has to keep track of, the slower the game will run. So, reducing the amount of stuff that's active keeps your game running fast. The vast majority of processing time in Dwarf Fortress is taken up by units taking their turns, over 60% in larger forts, of which less than 10% is actually pathfinding related, so the best way to prevent FPS loss is to reduce the amount of units spawned in general. The lists below separate ways to improve FPS into two categories: things that don't change the game in any fundamental way, and things that do.
Without Game Alterations
Fortress design is specific ways of building and planning, game setting changes are changes mostly in the init.txt and D_init.txt files that don't actually change how the game plays out.
World Generation
- Larger worlds require more background processing to update. The larger the civilizations, the more events occur in the world and the more complex they are. Generating too-large civilized populations can result in a permanent, unavoidable FPS drop. However, with how rich the game is with content, even a small world will be fairly interesting, while leading to a much higher framerate, though you may want to adjust some of the advanced world generation settings.
- Longer histories require more memory and storage space for historical figures and events.
- Reducing the number of civilizations, sites, beasts, and setting world population cap can limit the resources spent updating the rest of the world.
- Caverns can be an FPS hog due to the large amount of creatures that spawn there if fiddled with. Sometimes even trading caravans will try to path out of your fort underground.
- Adjusting the cavern layer number in advanced world generation parameters can reduce the number of cavern layers (default 3). However, this will restrict access to subterranean plants and creatures, and reduce the number of spawned forgotten beasts.
- Similarly, one could adjust Layer Openness and Layer Passage Density in advanced world generation to make the caverns have fewer tiles to path through. In general, the pathfinding algorithm heuristically treats distances as a chess king moving in 3D ("Chebyshev distance"), which means that it can tend to go to the right X/Y then start floodfilling dumbly through the entire Z from there until it can find a way up, at which point the whole process repeats, so having fewer cavern tiles is better and open areas are to be avoided.[1]
- Generating a world using a "REGION" template (instead of an "ISLAND" template which is used by "Create New World!") can significantly reduce the height of caverns and also place them closer together, resulting in fewer Z-levels. This generally also requires embarking in an area that isn't very close to an ocean or a mountain peak.
- Snow and ice melting can cause lag spikes.[Verify] You can generate a world without poles with a somewhat heightened temperature, or just embark somewhere which doesn't freeze over.
Fortress Design
- Larger embark sites dramatically increase the amount of terrain which DF needs to keep track of and path through.
- Reducing the size of your embark site from the default 4×4 squares to 3×3 or even 2×2 will have an enormous impact on FPS.
- Keep in mind that a 2×2 embark is only 25% of the size of a 4×4 embark. However, in 3D it is still a large enough area for many fortresses in normal play.
- Line-of-sight calculations, even after optimizations in v50.05, are the slowest part of the game by a wide margin. This is O(n^2) by nature, so the only way to truly reduce it is to reduce the amount of units. That said, there are still ways you can reduce the issues.
- Keep your dwarves spread far apart--units who are more than 26 units away from a given unit in any direction are not considered for line-of-sight calculations.
- Avoid having only one meeting area that has hundreds of dwarves in it.
- Try to break line-of-sight in various places to keep your dwarves from asking "friend or foe?" too often.
- Fewer items inside a fort means fewer items checked for temperature, which is the only major performance issue items cause.
- The obvious solution is not to generate so many items in the first place. Don't build such large farm plots and don't go overboard with multiple workshops constantly queued or set on perpetual repeat.
- Use a Dwarven atom smasher to remove items, or donate them to passing caravans to be taken away.
- Quantum stockpiles only help with game speed when you're looking at your stockpiles all the time.