|This article is about the current version of DF.|
Time is an integral part of any simulation, none the least in a simulation as complex as Dwarf Fortress. Time is measured internally in unnamed units, commonly dubbed "ticks" by the community. Each tick represents one step in the Dwarf Fortress program, requiring calculations related to unit movement, fluid movement, temperature transfer, various event checks, combat checks, pathing checks, job changes, experience ticks - basically everything required to run the program, broken up between individual lumps of time. These ticks are then bundled up against days, months, seasons, and then years under the dwarven calendar, which are then further engrossed within individual, context-sensitive ages. For a discussion on the greater passage of time, see Calendar; this page is focused on the lower-level, "unit-based", in-game passage of time.
How much a tick in time is worth against the yearly dwarven calendar depends on the game mode, as time in fortress mode is much more heavily accelerated than it is in adventurer mode. Fortress mode counts 1200 ticks per day and 403200 per year, while adventurer mode counts 86400 ticks to a day and therefore 29030400 ticks per year. According to these rates, each tick is equivalent to a real-world second in adventurer mode, but 1.2 minutes in fortress mode, making adventurers 72 times faster than your dwarves tick-for-tick. This is intended behavior, as the pacing in fortress mode is much, much faster than when adventuring.
How quickly time appears to pass in your game, especially in fortress mode, has as much to do with your hardware as with the number of ticks in a year. The number of frames per second is a direct reflection of how many ticks a second your processor is working through. This should be distinguished from the frame refresh rate, which is how many frames appear on your screen per second - since there's a limit to how many frame changes the human eye can see, there's not much purpose to displaying every single one of them on-screen. You can set your FPS to be visible by changing [FPS:NO] to [FPS:YES] in your Init.txt file, which will display two numbers in the top-right corner of your game window, the first being the frames per second and the second being the refresh rate. By default the framerate is capped at 100 FPS, but this setting can be changed or even removed: see Frames per second#Controlling FPS for a technical discussion. For tips on maximizing framerate, see the (topically named) Maximizing framerate article.
Dwarf Fortress is an extremely processor-intensive game, and so how many frames you actually get per second will depend on the strength of your machine, how far into the game and how much clutter there is in it, whether or not you are taking any fps-saving measures, what mods or other programs you are running, and so on. Regardless of mode, there are 28 days in a month and 12 months in a year. Assuming an FPS of 100, not counting pauses an hour of fortress mode gameplay will translate into a year in-game.
At 100 FPS:
1 day=10.7 sec 1month=5 min 1 year=1 hour
At 60 FPS:
1 day=17.8 sec 1month=8 min 20 sec 1 year=1 hour 40 min
At 30 FPS:
1 day=35.7 sec 1 month=16 min 40 sec 1 year=3 hour 20min
In dwarf mode, the game starts with some announcement checks and considers autosaves, etc. A lot of the rest doesn't happen every tick. Every hundred ticks, for instance, it'll check job assignments and strange moods. Armies are moved on the world map. Every hundred ticks (staggered from the job check), it handles job applications by dwarves, a kind of invisible auction that it uses to manage the various competing priorities. Every ten ticks it advances the seasons, which actually does all kinds of things with the weather and map (both locally and in the world), and it also does a check for certain plot element advances (diplomats, sieges, etc.), and it checks whether your fort is still alive.
Then it hits some things that it does every tick. Fluids and other map tile information is advanced (though there are various optimizations here so that not every tile is necessarily checked every turn, and there are various flags so that entire sections of the map can be skipped if nothing has happened.) Vermin running around are updated. Other 'events' on the map, like active fires, are handled.
If a flag is set, wounded/thirsty/hungry dwarves that can't care for themselves get an update, and every so often, dead dwarves 'think' about their burial arrangements so that jobs can be set. Caged and chained creatures update their thoughts and situation periodically.
Then creatures leave the map if they are set to at the edges.
Every fifty ticks, staggered from other updates, all of the taverns, temples, libraries, etc. get their information updated. Stockpiles, staggered on a different tick, also work this way. Similarly with storage job creation, though that process is complicated with various optimizations and lengthening ping times and so forth, and it's still slow, since at some point, 50000+ boulders will cause trouble.
Every thousand ticks, objects that have been marked for deletion and removed from the game are actually deleted and freed. This happens more often with items, every fifty ticks, along with a building use check (mostly updates for wells and some other flags that often need checking.)
We hit another every tick update at this point. Projectiles are moved. Activities (which range from dances to martial training to storytelling) get updated as needed. Dwarves and other creatures decide on and advance their immediate actions (movement to an adjacent tile, working at a workshop, etc.) -- the bulk of their AI (outside of job selection) is here.
Every hundred ticks, items are rotted. Every tick, vegetation is advanced (though there are various staggers and flags here.) Building states are updated every tick as needed, and minecarts are moved. Hauling routes are advanced. Temperature is updated (there are various optimization flags here, but this is still an unfortunately slow process.)
Finally the camera is updated to follow the creature you are following, if any.
For projectile physics, such as dwarves being thrown from a bridge, ticks use an assumed duration of 1/10 seconds, together with an assumed tile size of 2m wide by 2.8m tall. This is derived by monitoring the internal memory for thrown dwarfs, which have a vertical speed that reduces by 0.035 tiles per second, and the fixed point math works in units that assume a tile to be 100,000 units wide by 140,000 tall. Using a gravity value of 9.8m/s^2 and a tile size of 2x2x2.8m results in exactly 10 ticks per second with no rounding needed, so it's safe to assume that this is the unit value intended by Toady.
Using this value for ticks results in a day being a very short 2 minutes, and a year being 46 days and 16 hours.
Syndrome effects are defined by creature effect tokens, which use ticks as a basal unit. An example token would be , of which the START:50:PEAK:1000:END:2000 end-line defines the timeline of the syndrome's effects. On a timer, START tells you how many ticks will pass before the poison starts to take effect, PEAK will tell you when it will peak, and END will tell you after how many ticks it will end. A syndrome that lists its effect as starting at "5" means that for all but the fastest characters, you will begin feeling the effects as soon as you take a step. "50" means 50 time units (or about five steps), and "500" reliably suggests that you'll be able to stagger all the way back to the hospital before your brain starts pouring out of your ears. Syndrome effects are stacked, and can cause short-term, medium-term, and long-term damage; for specifics see Syndrome.
Plants use a [GROWDUR:#] plant token to constrain their growth times. Each GROWDUR unit (short for "grow duration) is equivalent to a hundred ticks. The default value is 300 and it is usually set to 300 or 500 (30000 or 50000 ticks) for crops; there are 1008 GROWDUR units per season.
Additionally, plant growths such as leaves, flowers, and fruits express their time ranges in ticks - a flower that blooms on the first day of Summer would have a start tick value of 100800.
Hive harvesting time
Vermin in hives which produce items (currently only honey bees, which produce honeycombs and royal jelly) have the [HIVE_PRODUCT:#:#:I] creature token. The first variable is the number of the item produced, the second is the time in ticks that it takes for the item to be produced, and the third is an item token for the item produced. When multiple products are expected, multiple such tokens are used.
Aging and lifespan
Based on the fact that pressure plates take 100 steps to reset, some people have built various time-keeping devices to do various things around the fort, like flooding a trap once a month, or just for fun.
|"Time" in other Languages