- 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.
v0.34:Maximizing framerate
This article is about an older version of DF. |
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
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. The below lists 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 and init_d files that don't actually change how the game plays out.
Fortress Design
- Using the 'dwarf drops item when the path disappears' technique pioneered by Nil Eyeglazed link it is possible to eliminate bins and most stockpiles from a fort. This 'allows for near infinite item storage with almost zero impact on fps' as shown here and discussed forum.
- Fewer items inside a fort means fewer items to be stockpiled, checked for wear, and so on and so forth.
- Use a Dwarven atom smasher to remove items, or donate them to passing caravans to be taken away.
- Don't dig out so much of the ground, don't build such large farm plots, just don't generate so many items in the first place.
- 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.
- 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.
- The size of your embark site increases 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.
- Encountering HFS will dramatically reduce FPS AFTER you seal the breach (Bug:1340). Either avoid doing so or use the work around posted in the bug report.
Game Settings
- 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.
- Using creature graphics may reduce FPS. (Using a custom ASCII tileset should have no effect)
With Game Alterations
All changes in this area have some effect on the game itself, use at your own discretion.
Game Settings
- Consider running an older version of DF. 40d should run better than 2010 or 2012, and 23a, while severely lacking, should be significantly faster.
- 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.
- 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.
Mods
- 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.
Mac OS X Specific
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.