|
| 1 | +timestream |
| 2 | +========== |
| 3 | + |
| 4 | +.. dfhack-tool:: |
| 5 | + :summary: Fix FPS death. |
| 6 | + :tags: fort gameplay fps |
| 7 | + |
| 8 | +Do you remember when you first start a new fort, your initial 7 dwarves zip |
| 9 | +around the screen and get things done so quickly? As a player, you never had |
| 10 | +to wait for your initial dwarves to move across the map. Do you wish that your |
| 11 | +fort of 200 dwarves and 800 animals could be as zippy? This tool can help. |
| 12 | + |
| 13 | +``timestream`` keeps the game running quickly by tweaking the game simulation |
| 14 | +according to the frames per second that your computer can support. This means |
| 15 | +that your dwarves spend the same amount of time relative to the in-game |
| 16 | +calendar to do their tasks, but the time that you, the player, have to wait for |
| 17 | +the dwarves to do get things done is reduced. The result is that the dwarves in |
| 18 | +your fully developed fort appear as energetic as the dwarves in a newly created |
| 19 | +fort, and mature forts are much more fun to play. |
| 20 | + |
| 21 | +Note that whereas your dwarves zip around like you're running at 100 FPS, the |
| 22 | +vanilla onscreen FPS counter, if enabled, will still show a lower number. See |
| 23 | +the `Technical details`_ section below if you're interested in what's going on |
| 24 | +under the hood. |
| 25 | + |
| 26 | +Usage |
| 27 | +----- |
| 28 | + |
| 29 | +:: |
| 30 | + |
| 31 | + enable timestream |
| 32 | + timestream [status] |
| 33 | + timestream set <key> <value> |
| 34 | + timestream reset |
| 35 | + |
| 36 | +Examples |
| 37 | +-------- |
| 38 | + |
| 39 | +``enable timestream`` |
| 40 | + Start adjusting the simulation to run at the currently configured apparent |
| 41 | + FPS (default is whatever you have the FPS cap set to in the DF settings, |
| 42 | + which is usually 100). |
| 43 | + |
| 44 | +``timestream set fps 50`` |
| 45 | + Tweak the simulation so it runs at an apparent 50 frames per second. |
| 46 | + |
| 47 | +``timestream reset`` |
| 48 | + Reset settings to defaults: the vanilla FPS cap with no calendar speed |
| 49 | + advantage or disadvantage. |
| 50 | + |
| 51 | +Settings |
| 52 | +-------- |
| 53 | + |
| 54 | +:fps: Set the target simulated FPS. The default target FPS is whatever you have |
| 55 | + the FPS cap set to in the DF settings, and the minimum is 10. Setting the |
| 56 | + target FPS *below* your current actual FPS will have no effect. You have |
| 57 | + to set the vanilla FPS cap for that. Set a target FPS of -1 to make no |
| 58 | + adjustment at all to the apparent FPS of the game. |
| 59 | + |
| 60 | +Technical details |
| 61 | +----------------- |
| 62 | + |
| 63 | +So what is this magic? How does this tool make it look like the game is |
| 64 | +suddenly running so much faster? |
| 65 | + |
| 66 | +Maybe an analogy would help. Pretend you're standing at the bottom of a |
| 67 | +staircase and you want to walk up the stairs. You can walk up one stair every |
| 68 | +second, and there are 100 stairs, so it will take you 100 seconds to walk up |
| 69 | +all the stairs. |
| 70 | + |
| 71 | +Now let's use the Hand of Armok and fiddle with reality a bit. Let's say that |
| 72 | +instead of walking up one step, you walk up 5 steps at once. At the same time |
| 73 | +we move the wall clock 5 seconds ahead. If you look at the clock after reaching |
| 74 | +the top of the stairs, it will still look like it took 100 seconds, but you did |
| 75 | +it all in fewer "steps". |
| 76 | + |
| 77 | +That's essentially what ``timestream`` is doing to the game. All "actions" in |
| 78 | +DF have counters associated with them. For example, when a dwarf wants to walk |
| 79 | +to the next tile, a counter is initialized to 8. Every "tick" of the game (the |
| 80 | +"frame" in FPS) decrements that counter by 1. When the counter gets to zero, |
| 81 | +the dwarf appears on the next tile. |
| 82 | + |
| 83 | +When ``timestream`` is active, it monitors all those counters and makes them |
| 84 | +decrement more per tick. It then balances things out by proportionally |
| 85 | +advancing the in-game calendar. Therefore, more "happens" per step, and DF has |
| 86 | +to simulate fewer "steps" for the same amount of work to get done. |
| 87 | + |
| 88 | +The cost of this simplification is that the world becomes less "smooth". As the |
| 89 | +discrepancy between the actual and simulated FPS grows, more and more dwarves |
| 90 | +will move to their next tiles at *exactly* the same time. Moreover, the rate of |
| 91 | +action completion per unit is effectively capped at the granularity of the |
| 92 | +simulation, so very fast units (say, those in a martial trance) will lose some |
| 93 | +of their advantage. |
| 94 | + |
| 95 | +Limitations |
| 96 | +----------- |
| 97 | + |
| 98 | +DF does critial game tasks every 10 calendar ticks that must not be skipped, so |
| 99 | +`timestream` cannot advance more than 9 ticks at a time. This puts an upper |
| 100 | +limit on how much `timestream` can help. With the default target of 100 FPS, |
| 101 | +the game will start showing signs of slowdown if the real FPS drops below about |
| 102 | +15. The interface will also become less responsive to mouse gestures as the |
| 103 | +real FPS drops. |
| 104 | + |
| 105 | +Finally, not all aspects of the game are perfectly adjusted. For example, |
| 106 | +armies on world map will move at the same (real-time) rate regardless of |
| 107 | +changes that ``timestream`` is making to the calendar. |
| 108 | + |
| 109 | +Here is a (possibly incomplete) list of game elements that are not adjusted by |
| 110 | +``timestream`` and will appear "slow" in-game: |
| 111 | + |
| 112 | +- Army movement across the world map (including raids sent out from the fort) |
| 113 | +- Liquid movement and evaporation |
0 commit comments