Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: accessing fortress stock data  (Read 645 times)

doomchild

  • Bay Watcher
  • Official Pace Car for the Apocalypse
    • View Profile
accessing fortress stock data
« on: March 12, 2010, 11:24:41 am »

So I've got an idea for a little utility to make reading/searching stocks a little easier, as it's more of a pain than it needs to be at the moment.  I'd like to use DFHack if possible, since the memory reading legwork has already been done.  Two questions:

  • Can I use something other than C++ to interface with the DFHack library?  Are there bindings for other languages like Python, etc?
  • After looking through the Memory.xml file in the DFHack source, I can't seem to find anything related to the stocks data.

DC
Logged
Quote from: webadict
I could care less what you are now, because what you will be is dead.

ArPharazon

  • Bay Watcher
    • View Profile
Re: accessing fortress stock data
« Reply #1 on: March 12, 2010, 03:31:13 pm »

I was just thinking of hacking together an imagesearch based script to do the same, and possibly add standing production order functionality. If it can be done in a less hackish way then I'd be very interested in knowing about it.

I'm concerned about a thing or two though, isn't the stock data generated on-demand? Why else does the game pause when you scroll past stone if you have too much?
Logged

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: accessing fortress stock data
« Reply #2 on: March 12, 2010, 05:59:43 pm »

I'm concerned about a thing or two though, isn't the stock data generated on-demand? Why else does the game pause when you scroll past stone if you have too much?

... and seeds.  For some odd reason, seeds are much worse.

Maybe it could work a little more like the way Dwarf Therapist works now, though, and only periodically update?

You might actually just want to contact the people making Dwarf Fortress, and try to intigrate the whole thing into the package.  I'd definitely be interested in having my stocks information in a window I can mouse over to on demand, without losing my place in the DF interface. 

It's a major nuicance that DF forces you to start back over at the top of the list every time you exit the units or stocks menu.  Just having a backdoor to that same interface in another window would be lovely.
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

Zaranthan

  • Bay Watcher
  • Plump Helmet Smelter
    • View Profile
Re: accessing fortress stock data
« Reply #3 on: March 12, 2010, 06:53:11 pm »

I'm concerned about a thing or two though, isn't the stock data generated on-demand? Why else does the game pause when you scroll past stone if you have too much?

The stocks screen is, indeed, generated on demand. The reason it takes so long is because (wild mass guessing based upon my own programming experience) the game stores a list of each individual item, and when you highlight that item's heading in the stock screen, the game scans through that list for the details. Reading the count takes but a moment (thus why loading the Z screen in the first place doesn't take ten minutes), but polling each item to determine what it is (gneiss, gabbro, plump helmet spawn, sweet pod seed, etc.), if it's part of a building, forbidden, marked for dumping, or simply lying about takes a similar moment PER STONE. It's easy to accumulate thousands, even millions of stones (even a 2x2 site contains OVER NINE THOUSAAAND stones per Z-level) over the course of your fortress's life.

The pro trick for avoiding that lag if you want to look at other items on the third page is to move the cursor down to at least the fifth item before hitting Page Down. You can also Page Down to the fourth page and move up one item at a time.

... and seeds.  For some odd reason, seeds are much worse.

Seeds can get really bad if you grow many different crops. Your typical seed will be inside a bag, inside a barrel, placed in a stockpile. That's three of those "moments" to find each seed and figure out if it's being eaten by vermin.
Logged
Quote from: Howard, Nerf This, by Scott D. Ferguson
Villains sleep with hookers, heroes sleep with destiny.

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: accessing fortress stock data
« Reply #4 on: March 12, 2010, 08:42:09 pm »

It's easy to accumulate thousands, even millions of stones (even a 2x2 site contains OVER NINE THOUSAAAND stones per Z-level) over the course of your fortress's life.

Not to nitpick in a really odd tangent, but you know, Over Nine Thousand has a page of its own (or at least, a redirect, stupid renaming jihad.)

Quote
... and seeds.  For some odd reason, seeds are much worse.

Seeds can get really bad if you grow many different crops. Your typical seed will be inside a bag, inside a barrel, placed in a stockpile. That's three of those "moments" to find each seed and figure out if it's being eaten by vermin.

Yeah, that's pretty much it, plus I have a big farm, which I assume loads data on its growth rate (because it is still a seed until the moment it has fully ripened).  Plus the elf tradesplosion I did gave me a few thousand extra seeds I have yet to actually atom smash yet (I am STILL cleaning this crap up, and it's basically a full year later)
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare