Bay 12 Games Forum

Dwarf Fortress => DF Modding => Utilities and 3rd Party Applications => Topic started by: uBdead on May 24, 2022, 04:29:12 am

Title: DFA (DwarfFortressAnnouncements) version 1.0! Overlays gamelog on game GUI.
Post by: uBdead on May 24, 2022, 04:29:12 am
Presenting DFA: customizable overlay for displaying the announcements in real time in the game itself

After playing on my laptop for a while I noticed that it was not very comfortable to use the defacto AnnouncementsWindow+ GUI as it is a separate window. I often miss the little red combat "C" and I wanted to make my own version that could be a direct integration in the DF game window. After using DFHack for many years I only feel like it would be fair to share my new GUI to return the favour.

You can try it out, by downloading it here from the "releases" (or compile it yourself):

https://github.com/ZEN-ben/DwarfFortressAnnouncements

Let me know if you have issues and I'll do my best to help. I still have a lot of ideas to improve it, but I think this is already a huge help to a lot of people.

(https://preview.redd.it/jwkkfmuw6s091.png?width=1489&format=png&auto=webp&s=fbcf16cc8b1f75e38231c43b849de65ec1700a51)
Title: Re: DFA (DwarfFortressAnnouncements) version 1.0! Overlays gamelog on game GUI.
Post by: myk on May 25, 2022, 12:14:53 am
This looks very nice. If I may ask, why is this implemented as an external utility and not as a dfhack script? DFHack has facilities for overlays.
Title: Re: DFA (DwarfFortressAnnouncements) version 1.0! Overlays gamelog on game GUI.
Post by: uBdead on May 25, 2022, 04:52:32 am
Good question! The only reason is actually that I estimated that it would be far too difficult (for me) to implement a DFHack plugin compared to this overlay. I also assumed that having the overlay would give me a bit more flexibility. I would love to have some more access to game data other then just the text from the gamelog.txt. For example i'm currently not able to judge if an action is "good" (my dwarf hits enemy) or bad (enemy decapitates dwarf).

But it's a great suggestion, I might need to read up on DFHack for sure!
Title: Re: DFA (DwarfFortressAnnouncements) version 1.0! Overlays gamelog on game GUI.
Post by: myk on May 28, 2022, 11:45:57 pm
This would probably be better off as a Lua script rather than a C++ plugin, but either would likely work.

You might be interested in the onReport event from EventManager (https://docs.dfhack.org/en/stable/docs/Lua%20API.html#events-from-eventmanager), which could give you access to announcement metadata. For the overlay, you could subclass DwarfOverlay (https://github.com/DFHack/dfhack/blob/develop/library/lua/gui/dwarfmode.lua#L324) and use a Label (https://docs.dfhack.org/en/stable/docs/Lua%20API.html#label-class) widget to display the scrollable, colored text.

One thing you might lose, though, is truetype text, which might be a dealbreaker, considering how long the announcement text can be.