Bay 12 Games Forum

Please login or register.

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

Author Topic: Dwarf Foreman 0.7.2 - Tool to automatically dispatch jobs to your workers  (Read 109441 times)

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile

Download http://dffd.wimbli.com/file.php?id=2806

Google code http://code.google.com/p/dwarf-foreman/

Wiki Page http://df.magmawiki.com/index.php/Utility:DwarfForeman

Supports DF 0.31.19-25(possibly higher)

Dwarf Foreman is a simple utility to uses your manager dwarf to dispatch jobs to your worker based off your current needs. For example you could tell it to always have at least 100 drinks on hand and it would dispatch jobs to brew more when you ran low.

You must load this program after you load your world and close it before you save.

0.7.3 - Added "all" job support, allowing you to melt all metal. Also added plant, shell, soap, tooth, horn, pearl support to the job tag(thank Quietust).
0.7.2 - Added full subtype support for jobs and fixed OTHER material bug introduced in 0.7.1.
0.7.1 - Added silk, cloth, leather, and yarn material types for job matching. Separated boxes and chests as items while ignoring full ones. Fixed inorganic job bug.
0.7.0 - A few more jobs, and the introduction of the yet to be functional <source> tag.
0.6.9 - Added support for jobs that create multiple items.
0.6.8 - Better supported for modded DF(tested with genesis). Default item buffer is 5 to prevent a rare race condition.
0.6.7 - More progress on handling complicated jobs with a few more jobs supported. Updated QT to 4.7.3
0.6.6 - Small update. Added clay, pearlash, and potash from lye. Should work on more versions of DF, including future ones.
« Last Edit: April 26, 2011, 12:22:08 am by devek »
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

spooq

  • Bay Watcher
    • View Profile

If DFs memory allocator doesn't know about this segment you are using, it is liable to use it for something else. If DF application code tries to free the memory, it will almost certainly crash. If it doesn't, it will just leak.
Logged

Omegastick

  • Bay Watcher
  • Crazy musician man
    • View Profile

You've spelled 'foreman' wrong...
Logged
I make music under the name Flag Red, check me out:
Soundcloud
Youtube
Facebook

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile

If DFs memory allocator doesn't know about this segment you are using, it is liable to use it for something else. If DF application code tries to free the memory, it will almost certainly crash. If it doesn't, it will just leak.

The DF process knows about the segment, I allocated it myself with VirtualAllocEX. It won't leak either, I wrote my own memory management to make sure the area I allocated for jobs stays nice and compact. DF itself has no way to free my memory, even if it tries. What concerns me is what happens when if it tries and fails?

You've spelled 'foreman' wrong...

Lol, english isn't my first language :/ How embarrassing..
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

spooq

  • Bay Watcher
    • View Profile

If DFs memory allocator doesn't know about this segment you are using, it is liable to use it for something else. If DF application code tries to free the memory, it will almost certainly crash. If it doesn't, it will just leak.

The DF process knows about the segment, I allocated it myself with VirtualAllocEX. It won't leak either, I wrote my own memory management to make sure the area I allocated for jobs stays nice and compact. DF itself has no way to free my memory, even if it tries. What concerns me is what happens when if it tries and fails?

I was going to mention VirtualAllocEx, but you're already using it.

No good is going to come of DF assuming it allocated that memory and trying to free it, that's for sure. How are you telling DF to process those jobs? The function you are calling might not own the objects, in which case you'd be fine. Best to just try it and see. I'll grab a copy and give it a go.
Logged

TomiTapio

  • Bay Watcher
  • OldGenesis since 2012
    • View Profile
    • My Flickr animal photos

Couldn't the external program just send keystrokes to DF?
"j,m,q, charcoal, cursor down?, enter, 10, esc, esc"
Logged
==OldGenesis mod== by Deon & TomiTapio. Five wood classes, four leather classes. Nine enemy civs. So much fine-tuning.
47.05e release: http://dffd.bay12games.com/who.php?id=1538
OldGenesis screenshots: https://twitter.com/hashtag/OldGenesis?src=hashtag_click&f=image
My Finnish language file: http://dffd.bay12games.com/file.php?id=14884

spooq

  • Bay Watcher
    • View Profile

Where's the fun in that?
Logged

Shade-o

  • Bay Watcher
  • It's my greatest creation yet!
    • View Profile

This could very well allow for completely automated fortresses.
Logged
Apparently having a redundant creature entry causes the game to say, "Oh, look, it's crazy world now. Nothing makes sense! Alligators live in houses!"

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile

I was going to mention VirtualAllocEx, but you're already using it.

No good is going to come of DF assuming it allocated that memory and trying to free it, that's for sure. How are you telling DF to process those jobs? The function you are calling might not own the objects, in which case you'd be fine. Best to just try it and see. I'll grab a copy and give it a go.

Well, it keeps the list of manager jobs in a vector. I move the data part of the vector to the memory I allocated and change its length to 1000(should be enough) so that the vector will stay in place and not be moved when stuff is added to it. Currently it kills any jobs you had already, but that is ok and in later versions I will copy the jobs over.

Than it is just a matter of adding jobs to the vector. The jobs are 60 bytes and those I allocate them in my own space and write them out myself. When DF finishes the job it removes it from the vector, and before I add stuff to the vector I see which jobs are using what memory and assign the next job to the first free spot. If there is already a job pending for something I want, I simply add to its quantity instead of making a new job.

The right way to do it is to actually hijack's df main loop with a code cave and have DF call its own function to do this work, there is nothing that can go wrong there. But if nothing goes wrong here, I will stick with it since it seems to work pretty well on my machine and I can get to work on an interface to add lots of different types of tasks.
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

spooq

  • Bay Watcher
    • View Profile

You might want to make the vector even bigger, better to use a bit more memory to avoid a crash.

I don't see the jobs being updated. I made a manager and wood furnace, then turned the knobs on your program. Number of logs is getting updated properly though. I'll fiddle with it a bit more.
Logged

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile

It "ticks" every 60 seconds, you may not have been patient enough.

You need to wait or force it before checking the manager window. (hint, it can add the job to the manger window without a furnace or a manager.. the job just won't complete lol).

It won't crash if it runs out of space on the vector either, DF will just get uppity and move it somewhere else with more room. It has room for 1000 jobs though, which is a lot of things to enter in...
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

spooq

  • Bay Watcher
    • View Profile

I'll give it some more time. I did try to force the tick though, if that is working.
Logged

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile

Oh ya, and below pending shows how many jobs are in the manager window.

Try adding a job manually and you'll see that number increase, it won't mess up anything.
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

spooq

  • Bay Watcher
    • View Profile

I did try that, and your number did not update. Seems like you and DF are working from two separate lists of jobs. Only the number of logs is being shared.
Logged

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile

Hrm weird.. which version of df?

I don't support all the versions that dfhack does, since I use offsets it doesn't know about.
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"
Pages: [1] 2 3 ... 32