Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 15 16 [17] 18 19 ... 244

Author Topic: DFHack 50.14-r1.1  (Read 889207 times)

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #240 on: August 26, 2017, 10:59:43 am »

C++ doesn't have garbage collection.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #241 on: August 26, 2017, 01:39:55 pm »

C++ doesn't have garbage collection.
Exactly. Lua screens also contain a pointer to an underlying C++ object (that's what "_native" is), and that is what won't get garbage-collected (possibly other things as well).

I'm not entirely sure what you're saying with your benchmarking results. dismiss() shouldn't be leaking memory. It might use a bit more memory to actually run, and because Lua garbage collection happens at unpredictable times, it's hard to know when that will get cleaned up. Also, the script you posted won't work, because you're referring to "myscreen" and "newscreen".
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #242 on: August 26, 2017, 04:04:55 pm »

Ah well. Read that lua did have garbage collection(Programming in Lua : 11.6), and assumed it'd apply to the lua things I create. Ultimately, in the tests above I just displayed 9 lines of text.

And well, sure the code snippet won't work on it's own; myscreen is defined, but newscreen is a modified gui.Framedscreen obtained by a screen constructor function.

---

What/why am I benchmarking?
Well, you said that the main concerns would be  memory leaking and flickering in a different way, provided it doesn't crash. I'm testing how much memory does leak, and whether setting viewscreen to nil before dismissing  the gui.Framedscreen results in a bigger memory leak.

Hm, to further test that dismiss doesn't leak memory with something simpler...Using a simpler gui/hello-world with 100 frames to dismiss results in 381,4 MB → 385,7 MB and stays there, or 0,04 MB per screen. (Fair enough, the modified screen is more than a magnitude larger all right.)

Since that was kind of small difference, ran it 101 times again without closing down DF this time and it went from 385,7 to 387,2. 4,3 MB vs 1,5. A third 101 goes to 378,8.

Decreasing each time...going back to the more complex screen used in initial benchmarking last page, two x 101 dismiss-only runs bring it from 380,7 MB → 1,3 GB→2,6 GB→didn't run a third time (Also wtf.). Three runs that use the code snippet setting to nil before dismiss go 380,1 MB → 648,3→814,1 →813,6 MB.

----

Note that all the tests are performed on linux lubuntu distro with setfps 10 - the RAM drain is magnitudes smaller on higher fpses, which, combined with the stabilizing memory usage for 101 made-and-dismissed screen makes me thing that DF requests RAM space, resizes lazily unless total RAM is a concern, but keeps using same space if it is free.

This pretty much puts to rest my concerns about memory leaking with the code snippet, as long as I don't generate hundreds of screens at the same time.

Though, while they're not complete, wildly different RAM usages suggests something more is going on with my custom screens (that also interact with dfhack's keybinding, gui and probably onStateChange in the tests).

Given that, if you have enough free time handy, I'd ask you to check my code for mem leaks: tests used 101x `testenvtester aleph beta ral` that calls on `gui/construct-screen.lua` (whose .nonblinky_dismiss ends up being doing, like most of the code, ultimately zilch here) that calls on keybinding that can - though did not, for I pressed no keys into DF window - call on `gui/construct_screen_execute_hook`.

At commented 800ish lines for three files to save what will be, at worst in tests, around dozen MB of RAM for a single screen, it's kind of lot of effort for small benefit. Currently, I'll probably be end up using the simple :dismiss() with perhaps nilling the C++ viewscreen in onDestroy(). (doing it the other way around, like in tests above, doesn't have the nicest interaction with menus, as nilling the base of stack also poofs all above it without error or warning.)

The point of the code is to help simulate plugin indicator screens, such as x: additional options (DFHack) in z-status overlay. (Though, hm, not quite there yet seamlessly; only single color at one moment for one line atm, albeit you may wrap second half of line in color().)

(PS: For readers from the spacefuture of mid-september+, the links only worked for 2 weeks as to not burden pastebin.)
« Last Edit: August 26, 2017, 04:16:34 pm by Fleeting Frames »
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #243 on: August 26, 2017, 04:41:58 pm »

I'll take a closer look at that later, but the "x: additional options (DFHack)" is a script (gui/extended-status). Also, your way of getting rid of screens will leak memory. Maybe not a lot, but it will leak some, and that can accumulate over time.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #244 on: August 26, 2017, 05:12:09 pm »

...Well. Failed to get script starting from gui/hello-world to work without interfering with parent focus and hotkeys or with simple replacement of gui.FramedScreen → gui.Screen as I desired and assumed all command transparency can only be done by plugin, based on the likes of workflow and search and simply repeating dfhack.screen.paintString failing outside rendering contexts...

Perhaps having FramedScreen(s) that are apply properly both keybinding and native keys of ancestor(s) is not useless, but at glance at gui/extended-status it seems I could have accomplished all this a loooot simpler :<.

About half the code being a workaround to, say, allow one to move cursor around and hit Ctrl-C for spotclean, Ctrl-Shift-I for gui/dfstatus or z in unitlist to zoom while screen is up.

>_>

Though, before I rewrite it, got to ask: For things like clickable label, this is not possible with the indicator style used by gui/extended-status?

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #245 on: August 26, 2017, 05:48:48 pm »

gui/extended-status doesn't use widgets, but it could. (Also, the DFHack-provided Label widget supports mouse input too now - you probably don't need to use ClickableLabel.)
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #246 on: August 26, 2017, 07:29:58 pm »

Hm, cool....Though, upon relook, seems I cursed/cheered too soon. gui/extended_status still changes path, so something like keybinding add Shift-Alt-G@overallstatus "gaydar -citizens" in dfhack.init will fail to work with it activated...So, yeah. Seems I just unknowingly duplicated small part of it's code. Not sure now if I made any entirely superfluous functions, given that it'd need pretty much the same code to inherit keybindings and such.

Jerry The Hellbound

  • Bay Watcher
  • Professional "Knife-ear" torturer 1-800-elfgod
    • View Profile
    • This is also for my Custom Race: Solari!
Re: DFHack 0.43.05-r2
« Reply #247 on: August 26, 2017, 07:50:32 pm »

Is there a way to remove a tag from a unit by commands?
Or must it be removed by an interaction or syndrome? if so, how do i input those?
Logged
Jerry.
This is also for my Custom Race: Solari! (Currently outdated)
http://www.bay12forums.com/smf/index.php?topic=155455.0
Also made that awesome avatar. took me hours with Gimp: (also the two light & dark sprites are from Stardew Valley)
http://i.imgur.com/8x7aX7T.png

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #248 on: August 26, 2017, 08:44:31 pm »

Hm, cool....Though, upon relook, seems I cursed/cheered too soon. gui/extended_status still changes path, so something like keybinding add Shift-Alt-G@overallstatus "gaydar -citizens" in dfhack.init will fail to work with it activated...So, yeah. Seems I just unknowingly duplicated small part of it's code. Not sure now if I made any entirely superfluous functions, given that it'd need pretty much the same code to inherit keybindings and such.
Yeah, that's a downside. There's been talk of adding ways for Lua scripts to modify screens like that, but it'd be a lot of effort.

It's worth noting that "keybinding" supports multiple contexts (although this isn't a great solution, since you'd potentially have to add contexts for multiple overlays):
Code: [Select]
keybinding add Shift-Alt-G@overallstatus|dfhack/lua/status_overlay "gaydar -citizens"

Is there a way to remove a tag from a unit by commands?
Or must it be removed by an interaction or syndrome? if so, how do i input those?
It depends on what tag you're referring to. There's no way to "remove a tag" in a text-based way for a specific unit, as you would in a text editor. However, some tags cause certain flags/fields/etc. to be set on units, which you can change in-game on a per-unit basis. What tag(s) are you interested in?
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #249 on: August 26, 2017, 09:23:02 pm »

@lethosor: Well, I guess that part of what my above scripts is still useful then.

For, say, a small temperature indicator in loo(k) at -28, -1 that one wants to work with spotclean, it queries keybinding for all bindings and tells it to activate those in current context as long as screen is up with the gui/construct_screen_execute_hook that basically removes the screen and runs spotclean and adds screen back 1 frame later.
« Last Edit: August 26, 2017, 09:25:32 pm by Fleeting Frames »
Logged

Jerry The Hellbound

  • Bay Watcher
  • Professional "Knife-ear" torturer 1-800-elfgod
    • View Profile
    • This is also for my Custom Race: Solari!
Re: DFHack 0.43.05-r2
« Reply #250 on: August 27, 2017, 12:08:52 pm »

I'm interested in the NOSTUN tag in particular.
Logged
Jerry.
This is also for my Custom Race: Solari! (Currently outdated)
http://www.bay12forums.com/smf/index.php?topic=155455.0
Also made that awesome avatar. took me hours with Gimp: (also the two light & dark sprites are from Stardew Valley)
http://i.imgur.com/8x7aX7T.png

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #251 on: August 28, 2017, 01:23:43 pm »

I'm interested in the NOSTUN tag in particular.
That looks like something that can only be done by modifying the creature raws (which would affect every creature of that race) or through a syndrome.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Jerry The Hellbound

  • Bay Watcher
  • Professional "Knife-ear" torturer 1-800-elfgod
    • View Profile
    • This is also for my Custom Race: Solari!
Re: DFHack 0.43.05-r2
« Reply #252 on: August 28, 2017, 06:08:19 pm »

I'm interested in the NOSTUN tag in particular.
That looks like something that can only be done by modifying the creature raws (which would affect every creature of that race) or through a syndrome.
Just like that?
I probably should say it first, that its without generating a new world.
« Last Edit: August 28, 2017, 06:37:40 pm by Jerry The Hellbound »
Logged
Jerry.
This is also for my Custom Race: Solari! (Currently outdated)
http://www.bay12forums.com/smf/index.php?topic=155455.0
Also made that awesome avatar. took me hours with Gimp: (also the two light & dark sprites are from Stardew Valley)
http://i.imgur.com/8x7aX7T.png

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #253 on: August 29, 2017, 02:27:24 am »

It's possible to modify the creature raws inside a save, However, when I did that it only affected new creatures, not existing ones (I changed cats and dogs to into tomcats/cats and dogs/bitches respectively, i.e. gave separate names to the genders, This was using 0.40.X).
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #254 on: August 29, 2017, 09:12:38 am »

I was talking about modifying the in-game representation of the creature raws, actually, not the raw files, although that would probably have the same limitations as editing the raw files if certain changes only apply to new creatures.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.
Pages: 1 ... 15 16 [17] 18 19 ... 244