Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 ... 5

Author Topic: DwarfMonitor Plugin [Update: shows current date & weather in margin]  (Read 15296 times)

falconne

  • Bay Watcher
    • View Profile

Latest Version: Download
Link contains download archive with all my plugins.
See the included zip for installation instructions. The relevant file for this plugin is dwarfmonitor.plug.dll.
Note: This was built against the latest DFHack release (0.34.11 r3), so will not work in earlier versions. The version in the Lazy Newbie Pack is outdated.


This plugin does two things: displaying status overlays in the game margin and tracking fortress activity for reporting.

Status Overlays
  • Happiness levels in the fortress are displayed in the margin. See this post for details.
  • Current date and weather are shown in the margins. See this post for details.

Activity Tracking & Reports
When enabled, this plugin tracks all work and leisure activity in the fortress every 100 ticks (1/12th of a dwarf day) over a rolling window of 3 months. This data can be displayed in-game, to show how much time is spent in the fort on each activity, as a percentage. The data can also be displayed per dwarf, telling you what they've been doing and how much time they have spent on each activity.

The following screenshots show the two statistical screens that are available. All values are in percentages and only non-zero values are displayed. When you see a value of 0, this implies that actual value is between 0 and 1, but decimals are not displayed. Because of this and other rounding issues, the totals may not always add up to 100.



The above screen shows overall fort activity. The left hand column is a breakdown of all the activity groups that happened in the fort in the last 1 month (this can be switched between 1,2 and 3 months). When an activity is selected in the first column, the second column shows the dwarves who've participated in that activity and what % share of it they did. You can move the selection to the second column and use "Shift-Z" to find the unit on the map in View mode. Further, if you have a dwarf selected in the second column while pressing "Shift-D" to go to the Dwarf Stats screen (see below), that dwarf will already be selected when you arrive at that screen. The third column details the real activities that were grouped into the selected category and how much of each occurred in the selected time period.

Note that both these screens have "Search" functionality that's always on. You don't have to use a hotkey like in my search plugin, just start typing and the selected column will filter automatically. Shift-S still clears the search.

Also, both screens support the mouse.



Pressing Shift-D from the previous screen will take you to the above screen, where the first column is a list of all dwarves and the second column tells you how the selected dwarf has been spending their time. In the above example, the dwarf has spent 40% of their time milling. As before, you can use Shift-Z to View the dwarf on the map.


The plugin is disabled by default and statistics are not preserved in a save game. The easiest way to use the plugin is to add the following lines to your dfhack.init file:
Code: [Select]
dwarfmonitor enable all
keybinding add Ctrl-F@dwarfmode/Default "dwarfmonitor stats"
This will turn on monitoring when you start the game and bind the hotkey Ctrl-F to open the fort statistics screen.


These are the detailed usage instructions from the plugin's console view:
Spoiler (click to show/hide)


Just a note about "idle" time; because of the granularity of the samples, the plugin will always report some idle time, even in a fully occupied fort. That's because DF job assignment is periodic... when a dwarf finishes a job they do not immediately get a new job assigned, they have to sit idle until the job manager loop runs again. This plugin will register those periods as idle time for that dwarf as it has no way of telling the difference. If you select the "Idle" item in fortress stats, you'll see nearly every dwarf in the second column, but most will have a very small percentage of the total, most likely <2%. You only have to worry about dwarves who take up the larger percentage at the top of the list.
« Last Edit: June 07, 2014, 01:35:48 am by falconne »
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

Meph

  • Bay Watcher
  • Gone - Not here. No write PM. plz.
    • View Profile
    • Unlocked Achievements
Re: Plugin to produce statistical reports of work & leisure activity in a fort
« Reply #1 on: February 24, 2013, 06:59:05 am »

This sounds amazing as always with your plugins :)

I do have two questions:
 - Is there any noticable effect on FPS?
 - ALT+S... in the past I had some trouble with dfhack hotkeys.*

*ALT+C for example: The Alt key toggled the C-keys usage. You press ALT once, and then everytime you press the C key it activates the plugin. You press ALT again, und the C key is back to normal. I got several reports like that, had to disable some plugins I included... is this the case here as well, or does the plugin only trigger if ALT and S is pressed simultaniously ? If yes, I would gladly add this as a default into my mod, next to your other plugins. :)
Logged
::: ☼MASTERWORK☼ Dwarf Fortress - A comprehensive mod pack with 25% higher FPS :::
::: Accelerated DF - The FPS boost of Masterwork with no other changes :::
::: www.unlocked-achievements.com - Follow my bike tours around the world :::
- Donate -

jwest23

  • Bay Watcher
    • View Profile
Re: Plugin to produce statistical reports of work & leisure activity in a fort
« Reply #2 on: February 24, 2013, 09:28:38 am »

This looks like yet another fine plugin.  Thank you.

I have a suggestion that I and perhaps others would find useful.  Could it be made to optionally keep stats over three different windows?  Configuring the plugin for a 10 day, a 30 day, and a 90 day window would let me see how things are trending a bit better.

Thanks for considering it!
Logged

falconne

  • Bay Watcher
    • View Profile
Re: Plugin to produce statistical reports of work & leisure activity in a fort
« Reply #3 on: February 25, 2013, 03:19:55 am »

I have a suggestion that I and perhaps others would find useful.  Could it be made to optionally keep stats over three different windows?  Configuring the plugin for a 10 day, a 30 day, and a 90 day window would let me see how things are trending a bit better.

Actually I was thinking of adding something similar, where a hotkey can toggle the average between 1x, 2x and 4x the default window but wondered if that was getting a bit much. It's not too hard to add in so I think I'll do that in a future update.

I do have two questions:
 - Is there any noticable effect on FPS?
 - ALT+S... in the past I had some trouble with dfhack hotkeys.*

*ALT+C for example: The Alt key toggled the C-keys usage. You press ALT once, and then everytime you press the C key it activates the plugin. You press ALT again, und the C key is back to normal. I got several reports like that, had to disable some plugins I included... is this the case here as well, or does the plugin only trigger if ALT and S is pressed simultaniously ? If yes, I would gladly add this as a default into my mod, next to your other plugins. :)

On my machine (core i7 2600) I don't see any drop in average FPS in my fort with 200 dwarves. However I don't know if there would be a noticeable drop... hopefully someone who's tried it on a lower spec machine can comment? If it does slow down on a lower end but still multicore cpu (e.g. on an i5), I could multithread the plugin and that should make it faster.

Since MasterWork is so much faster than vanilla anyway, there would probably be even less effect seen there.

The key binding I suggested for the dfhack.init is for ALT and S pressed simultaneously... I use a number of such keybindings for dfhack and haven't had any problems with them. I can see how ALT and a key pressed one after the other could cause problems and is a bit "emacs" like for a game, but my one is the conventional kind of key binding.

I'm planing to add a couple more small features so it's probably best to wait a little bit before adding it to MasterWork... also I want to see if anyone comes back with any issues. I tested pretty thoroughly but self testing is never very complete :)
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

Meph

  • Bay Watcher
  • Gone - Not here. No write PM. plz.
    • View Profile
    • Unlocked Achievements
Re: Plugin to produce statistical reports of work & leisure activity in a fort
« Reply #4 on: February 25, 2013, 09:59:18 am »

Well, before I add it I have to do another update myself. On the other hand you would have a lot more people testing it. I will let you know if I do an update. Thanks for the answers. :)
Logged
::: ☼MASTERWORK☼ Dwarf Fortress - A comprehensive mod pack with 25% higher FPS :::
::: Accelerated DF - The FPS boost of Masterwork with no other changes :::
::: www.unlocked-achievements.com - Follow my bike tours around the world :::
- Donate -

Meph

  • Bay Watcher
  • Gone - Not here. No write PM. plz.
    • View Profile
    • Unlocked Achievements
Re: Plugin to produce statistical reports of work & leisure activity in a fort
« Reply #5 on: February 27, 2013, 11:49:14 am »

Sorry for the double post/bump, but I figured it out.

If you minimze DF with ALT+TAB (for dfhack or therapist for example) and go back to the game, it thinks that you are still pressing ALT. Now whenever you press S, your plugin pops up. Stockpile Stone? Nope, Plugin. The only way to stop this is by pressing ALT once. Aparently DF does not notice that you let go of ALT, because you let go of ALT after DF is not the active process. (you alt-tab back into windows and then release the ALT key)
Logged
::: ☼MASTERWORK☼ Dwarf Fortress - A comprehensive mod pack with 25% higher FPS :::
::: Accelerated DF - The FPS boost of Masterwork with no other changes :::
::: www.unlocked-achievements.com - Follow my bike tours around the world :::
- Donate -

falconne

  • Bay Watcher
    • View Profile
Re: Plugin to produce statistical reports of work & leisure activity in a fort
« Reply #6 on: February 27, 2013, 02:31:39 pm »

Sorry for the double post/bump, but I figured it out.

If you minimze DF with ALT+TAB (for dfhack or therapist for example) and go back to the game, it thinks that you are still pressing ALT. Now whenever you press S, your plugin pops up. Stockpile Stone? Nope, Plugin. The only way to stop this is by pressing ALT once. Aparently DF does not notice that you let go of ALT, because you let go of ALT after DF is not the active process. (you alt-tab back into windows and then release the ALT key)

Ah right. The keybinding of ALT-S was only a suggestion (you have to manually add it to dfhack.init as mention in the first post - in MasterWork you probably want to include a binding by default I expect). I'll change the suggestion CTRL-F (for (F)ort Stats). Doesn't change the bug of ALT-TABing out though... be interesting to find out if that's just with DFHack or happens in the base game too.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

falconne

  • Bay Watcher
    • View Profile
Re: Plugin to produce statistical reports of work & leisure activity in a fort
« Reply #7 on: February 28, 2013, 05:27:02 am »

I've added functionality to the plugin to show a live overlay in the game margin displaying the happiness levels of your citizens. The overlay comes up on the bottom left and consists of 7 numbers, each representing the number of dwarves at a certain level of happiness. The levels correspond to the 7 distinct happiness categories in both Dwarf Therapist and the DFHack Dwarf Manipulator, ranging from "Miserable" as bright red on the far left and "Ecstatic" as bright green on the far right.



This overlay will be enabled by default. Please see the first post for the download link and let me know if you notice any problems.

With regards to locating the unhappy dwarves, the easiest way in-game is to open the Dwarf Manipulator screen and sort by ascending happiness.
« Last Edit: February 28, 2013, 02:03:18 pm by falconne »
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

raquo

  • Escaped Lunatic
    • View Profile
Re: DwarfMonitor Plugin [Update: Live overlay of happiness levels]
« Reply #8 on: February 28, 2013, 12:39:42 pm »

I'd love to use this plugin (really, many of your plugins) on the mac. dfhack compiles its other plugins as "plug.so" files for osx rather than dll - I did try renaming without success - but I'm unsure of how much work that is for you. I searched around for info on what has to be done to create plugins for mac dfhack but I didn't find anything. I'm happy to take a shot at it if the source is on github or something similar though.
Logged

falconne

  • Bay Watcher
    • View Profile
Re: DwarfMonitor Plugin [Update: Live overlay of happiness levels]
« Reply #9 on: February 28, 2013, 02:02:25 pm »

I've just uploaded a new version that has the happiness overlay enabled by default, as I figure most people using the plugin would want that anyway.

I'd love to use this plugin (really, many of your plugins) on the mac. dfhack compiles its other plugins as "plug.so" files for osx rather than dll - I did try renaming without success - but I'm unsure of how much work that is for you. I searched around for info on what has to be done to create plugins for mac dfhack but I didn't find anything. I'm happy to take a shot at it if the source is on github or something similar though.

You can download Mac versions of my other plugins from here. I don't have a Mac to compile on, so these were compiled by another forum member, falsefaith. When he has time he will most likely compile this one as well and I'll update the archive then. If you want to have a go at it yourself, my repo is here and there are Mac compile instructions here.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

Meph

  • Bay Watcher
  • Gone - Not here. No write PM. plz.
    • View Profile
    • Unlocked Achievements
Re: DwarfMonitor Plugin [Update: Live overlay of happiness levels]
« Reply #10 on: February 28, 2013, 02:03:04 pm »

I tested it, and I think that 7days is a bit short. I personally would prefer 1month min. or 1 season. But thats just my personal experience. One week goes by too fast, people party that long sometimes. ^^

I think seasonal would be most useful, at least for me. You have your seasonal trade, seasonal autosave, and a seasonal work report ;)

Edit: The happyness screen is awesome of course, and I will gladly include it in my modpack. I already mentionted it in the thread, I think its great. :)
Logged
::: ☼MASTERWORK☼ Dwarf Fortress - A comprehensive mod pack with 25% higher FPS :::
::: Accelerated DF - The FPS boost of Masterwork with no other changes :::
::: www.unlocked-achievements.com - Follow my bike tours around the world :::
- Donate -

falconne

  • Bay Watcher
    • View Profile
Re: DwarfMonitor Plugin [Update: Live overlay of happiness levels]
« Reply #11 on: February 28, 2013, 02:48:36 pm »

Thanks, makes sense. I never got used to the dwarven clock so needed the feedback to find a good balance. I can make track up to 1 season (is that 3 * 28 days?). I'll also have a toggle in the stats screen so you can change the averaging window of the displayed stats, so you can see the change between the last season, last month, last fortnight etc.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

Meph

  • Bay Watcher
  • Gone - Not here. No write PM. plz.
    • View Profile
    • Unlocked Achievements
Re: DwarfMonitor Plugin [Update: Live overlay of happiness levels]
« Reply #12 on: February 28, 2013, 02:59:27 pm »

Yes, 3*28.

My reasoning behind the longer time is that people probably use this to improve the assigned labors. But if you have a perfectly well assigned dwarf who just happened to party/take a break this week, he will show as heavily idle. Which is of course false. Except you list it as party/break of course, in which case I am just making of fool of myself ;)
Logged
::: ☼MASTERWORK☼ Dwarf Fortress - A comprehensive mod pack with 25% higher FPS :::
::: Accelerated DF - The FPS boost of Masterwork with no other changes :::
::: www.unlocked-achievements.com - Follow my bike tours around the world :::
- Donate -

falconne

  • Bay Watcher
    • View Profile
Re: DwarfMonitor Plugin [Update: Live overlay of happiness levels]
« Reply #13 on: February 28, 2013, 05:30:16 pm »

Yes, my aim was for it to be a way for checking if productivity improvements in your fort are working, so it needs a long enough window to gather meaningful data, without being so big that it obscures trends.

I'll also add some more logical grouping. For e.g., I think all "Manufacturing" in the fort can be grouped as one productive activity.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

Meph

  • Bay Watcher
  • Gone - Not here. No write PM. plz.
    • View Profile
    • Unlocked Achievements
Re: DwarfMonitor Plugin [Update: Live overlay of happiness levels]
« Reply #14 on: February 28, 2013, 05:31:20 pm »

Can it handle fighting, sparring and training (archery) ?
Logged
::: ☼MASTERWORK☼ Dwarf Fortress - A comprehensive mod pack with 25% higher FPS :::
::: Accelerated DF - The FPS boost of Masterwork with no other changes :::
::: www.unlocked-achievements.com - Follow my bike tours around the world :::
- Donate -
Pages: [1] 2 3 ... 5