Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 170 171 [172] 173 174 ... 192

Author Topic: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)  (Read 868925 times)

Raul

  • Bay Watcher
  • El Psy Kongroo
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2565 on: November 07, 2012, 10:23:28 pm »

Do I understand correctly that DT does not work yet for the latest version of DF? (0.34.11)?
Did you try using splinterz's version?
Logged

martinuzz

  • Bay Watcher
  • High dwarf
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2566 on: November 07, 2012, 10:31:59 pm »

Could you provide a link? Typing 'splinter' in the search bar gives too many results to be of help.
Logged
Friendly and polite reminder for optimists: Hope is a finite resource

We can ­disagree and still love each other, ­unless your disagreement is rooted in my oppression and denial of my humanity and right to exist - James Baldwin

http://www.bay12forums.com/smf/index.php?topic=73719.msg1830479#msg1830479

Raul

  • Bay Watcher
  • El Psy Kongroo
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2567 on: November 07, 2012, 10:34:39 pm »

Rapidshare and Mediafire links here.
Logged

martinuzz

  • Bay Watcher
  • High dwarf
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2568 on: November 07, 2012, 10:35:23 pm »

Thanks for your quick reply!
Logged
Friendly and polite reminder for optimists: Hope is a finite resource

We can ­disagree and still love each other, ­unless your disagreement is rooted in my oppression and denial of my humanity and right to exist - James Baldwin

http://www.bay12forums.com/smf/index.php?topic=73719.msg1830479#msg1830479

falconne

  • Bay Watcher
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2569 on: November 07, 2012, 10:43:06 pm »

I think it's about time splinterz' version had its own thread, so it's easier to find info on it without searching this thread. I reckon there's a lot of people who're looking for the functionality it provides but don't know it exists.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

Intrinsic

  • Bay Watcher
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2570 on: November 08, 2012, 05:38:07 am »

Could dwarf therapist.ini be moved into the dwarf therapist folder, rather be buried in some deep app data folder.  The main reasoning I ask is because sometimes I have custom roles saved in there, and when moving the dwarf therapist folder from pc to pc, I have to dig this file out to and replace it.

I asked for this months ago but it was a no go ;p so i wrote a lil script with which i launch DT:

Code: [Select]
IF NOT EXIST "INI" md "INI"

IF NOT EXIST "%APPDATA%\UDP Software" md "%APPDATA%\UDP Software"

IF NOT EXIST "%APPDATA%\UDP Software\Dwarf Therapist.ini" (
    move /-Y "INI\Dwarf Therapist.ini" "%APPDATA%\UDP Software\Dwarf Therapist.ini" )

DwarfTherapist.exe

move /-Y "%APPDATA%\UDP Software\Dwarf Therapist.ini" ".\INI\Dwarf Therapist.ini"


Edit: i should add that you put this in your DT directory and i just have a shortcut to it on my desktop.
« Last Edit: November 08, 2012, 05:50:17 am by Intrinsic »
Logged
Start Duelyst with a bonus 100gold, use referral code: Buttfungus
Enter during signup or ingame under Settings.

knutor

  • Bay Watcher
  • ..to hear the lamentation of the elves!
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2571 on: November 08, 2012, 11:29:03 am »

I just removed a virus, pretending to be a virus scanner, from my AppData folder, the other night. 

I agree it would be nice to have all Therapist in the same place. 

Last time that AppData virus infected me, I lost my user profile and all its contents.  This time I caught it, trying to take over in time to lock the user profile and end its task from a safe user profile, one of course with privileges. 

Don't do what I did and foolishly hit that mini icon in the panel by clock, did that the first time.  I got it from an .mp3 file site and a dirty .mp3 file.  *blush*
« Last Edit: November 08, 2012, 11:31:30 am by knutor »
Logged
"I don't often drink Mead, but when I do... I prefer Dee Eef's.  -The most interesting Dwarf in the World.  Stay thirsty, my friend.
Shark Dentistry, looking in the Raws.

malmstrom

  • Bay Watcher
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2572 on: November 08, 2012, 12:21:53 pm »

Dears, is there a DT or similar that work with the last DF version under OSX?
Thanks for the support!
Logged

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2573 on: November 08, 2012, 11:17:13 pm »

fyi, I'm working on a weighted matrix labor assignment program

either will be in dfhack, or more preferably therapist.

I think i'm on my own, but I may have the tools to get it up at least with dfhack, I think I have the tools for Therapist as well, but reading advanced qt code is a bit much for me.  I might post a snippet of what I got when I finish the prototype tonight.

here's my code for anyone that know's programming

Spoiler (click to show/hide)

I've hit my beer limit for coding tonight/today... will try to implement this hopefully soon.

Update:

Now it outputs some relevant information...

What it does:

Creates a 1 dimensional array sorting highest role rating to lowest role rating (after multiplying each role rating by a role weight), then assigns starting from the top of the list on down until is finishes going through the list.  So it doesn't do it by dwarf or by role, but highest % first and working down.

The role weight is used to weight some roles as more important than others, effectively reducing the role % (and it's position in the 1 dimensional list).  I think I have the prototype working satisfactory that I can now go to a production version inside DT.

Update:
w00t!  Got a clear_Labors button working!
now onto creating my superStruct inside DT...

then the optimize_Labors button and matching function!

Update:
My clear_Labors only works on ALL dwarves... which is no good.  I need to limit it to filtered dwarves... which is a pain in the ass!

Update:
clear_labors works on only selected dwarf's!  Now the real fun begins!
« Last Edit: November 12, 2012, 08:02:54 pm by thistleknot »
Logged

dreamt

  • Escaped Lunatic
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2574 on: November 13, 2012, 01:30:16 pm »

I'm running Snow Leopard, 10.6.8. The version of DT that comes with MacNewbie fails to launch for me, so I poked around here and tried updating the memory offsets but no dice. I decided to try compiling it myself and managed to get it to build, updated the memory offsets, and now when it runs it freezes Dwarf Fortress (the music stops and the game stops and I get a spinning cursor), then DT hangs and then quits. DF remains frozen until I force quit it.

I tried compiling splinterz's version, but it won't build for me.

Any ideas?
Logged

knutor

  • Bay Watcher
  • ..to hear the lamentation of the elves!
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2575 on: November 13, 2012, 01:49:58 pm »

My version craps out at that point, just when you describe, Dreamt, when my graphics settings in the DF init files are set too optimistic for my machine. 

Or more specifically when my graphics folder doesn't contain the tileset, the init files thinks it should contain.  Maybe check that MacNewbie doesn't call the wrong tileset, or something similar in the init settings. 
Logged
"I don't often drink Mead, but when I do... I prefer Dee Eef's.  -The most interesting Dwarf in the World.  Stay thirsty, my friend.
Shark Dentistry, looking in the Raws.

dreamt

  • Escaped Lunatic
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2576 on: November 13, 2012, 02:12:54 pm »

I just tried resetting my graphics settings to default using MacNewbie and had no success. DF and DT both still crash right when DT tries to connect. Is there anything in particular that I should look for in my init file to change by hand? It's presently running at 80x25, using curses_640x300.png.
Logged

knutor

  • Bay Watcher
  • ..to hear the lamentation of the elves!
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2577 on: November 13, 2012, 04:40:32 pm »

Yes.  Linux/OS X users may also use PRINT_MODE:TEXT for primitive ncurses output.

By default this is 2D.  Try TEXT.
Logged
"I don't often drink Mead, but when I do... I prefer Dee Eef's.  -The most interesting Dwarf in the World.  Stay thirsty, my friend.
Shark Dentistry, looking in the Raws.

dreamt

  • Escaped Lunatic
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2578 on: November 13, 2012, 06:05:12 pm »

Strangely, it tells me TEXT is unsupported and defaults back to 2D. I tried several other graphics modes and saw no change in the crashing.
Logged

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: Dwarf Therapist (LATEST 0.6.12 5/23/12 see first post)
« Reply #2579 on: November 16, 2012, 12:07:12 am »

Follow-up

http://www.bay12forums.com/smf/index.php?topic=66525.msg3773408#msg3773408

Here's me loading up roles into DT via a csv file... (csv file consists of these entries role_name, labor_id, priority_weight, num_to_assign)

Code: [Select]
void MainWindow::initializeSuperStruct()
{
    QList<Dwarf*> m_selected_dwarfs = m_view_manager->get_selected_dwarfs();
    int d_count = m_selected_dwarfs.size();

    //get labors per dwarf
    bool ok;
    QString labors_p = QInputDialog::getText(0, tr("Labors per dwarf"),
         tr("How many dwarves do you want to assign per labor?"), QLineEdit::Normal,"", &ok);
    if (!ok)
        return;
    int labors_per = labors_p.toInt();

    //get csv filename
    ok = 0;

    QString file_name = QInputDialog::getText(0, tr("CSV input file"),
         tr("Name of input file for assigning labors?"), QLineEdit::Normal,"", &ok);
    if (!ok)
        return;
    //int file_name = csv_n.toInt();

    using namespace std;
    //dwarf count, to be pulled from selection
    //labor count, to be pulled from init .csv
    int role_count = 0;
    //does not work

    string st;

    //SUPERSTRUCT!
    QVector <superStruct> sorter;

    QVector <roles> ListOfRolesV;

    //ifstream f( filename.c_str() );
    //ifstream f("role_labor_list.csv");
    string f_holder = file_name.toStdString();
    ifstream f(f_holder.c_str());
    //ifstream f (file_name.c_str());


      //loops through each line in the file
      while (getline (f, st))
      {
          int pos = 1;
          //placeholder
          roles p_holder;

          //gets the line for processing
          istringstream iss( st );

            //loops through each , in one line
            while (getline (iss, st, ','))
            {
                //role_name, labor_id, priority_weight, num_to_assign
                if (pos == 1)
                {
                    p_holder.role_name = QString::fromStdString(st);
                }
                else if (pos == 2)
                {
                    int fieldValue = 0;
                    istringstream (st) >> fieldValue;

                    p_holder.labor_id = fieldValue;
                }
                else if (pos == 3)
                {
                    float fieldValue = 0.0f;
                    istringstream (st) >> fieldValue;

                    p_holder.priority = fieldValue;
                }
                else if (pos == 4)
                {
                    int fieldValue = 0;
                    istringstream (st) >> fieldValue;

                    p_holder.numberToAssign = fieldValue;
                }
                p_holder.numberAssigned = 0;
                pos++;
            }
            ListOfRolesV.push_back(p_holder);
            pos = 1;
        }

        f.close();

        role_count = ListOfRolesV.size();

    //now time to initialize the superStruct

        //count # dwarf's
        //foreach(Dwarf *d, m_view_manager->get_selected_dwarfs()) {d_count++;}

        //resize based on # dwarfs * # of roles
        sorter.resize(d_count*role_count);
        QString *temp;

        int sstruct_pos = 0;
        //for(int sstruct_pos = 0; sstruct_pos < sorter.size(); sstruct_pos++)
        {
            //cycle through each Dwarf,
            foreach (Dwarf *d, m_view_manager->get_selected_dwarfs())
            {
                int dwarf_count = 0;
                //cycle through each Role in ListOfRolesV
                for (int role_entry = 0; role_entry < ListOfRolesV.size(); role_entry++)
                {
                    //problem here... need a role per dwarf which I have, but Dwarf doesn't have anywhere to save a w_percent...
                    //Could just load into superStruct, but it won't be a pointer...
                    sorter[sstruct_pos].d_id = d->id();
                    sorter[sstruct_pos].labor_id = ListOfRolesV[role_entry].p_l_id();
                    //QString role_name = ListOfRolesV[role_entry].p_r_name();
                    //not sure if this is what I want
                    sorter[sstruct_pos].role_name = ListOfRolesV[role_entry].p_r_name();

                    //can't use pointers with this
                    sorter[sstruct_pos].r_percent = d->get_role_rating(ListOfRolesV[role_entry].role_name);
                    sorter[sstruct_pos].w_percent = ListOfRolesV[role_entry].priority * d->get_role_rating(ListOfRolesV[role_entry].role_name);

                    sstruct_pos++;
                }
                //probably not needed
                dwarf_count ++;

            }
        }
        //used for debug pause
        int test = 0;

        //sort superstruct by w_percent

        //runs through list
        for (int i = 0; i < sorter.size(); i++)
        {
            //checks against lower element
            //cout << *s->at(i).pPercent << endl;
            for (int j = 1; j < (sorter.size()-i); j++)
            {
                //using pointer dereferences messed this up, but, not using them doesn't sort right
                if (sorter[j-1].w_percent < sorter[j].w_percent)
                {
                    swap(sorter[j-1], sorter[j]);
                }
            }
        }

    //now to assign labors!

        //vs running through each labor, and assigning up to max # dwarf's...
          //1. need to start from top of allRoles
          //2. see what labor is, see if goal is met.
            //DONE (via csv input) for DEPLOY APP, need to change this to see if labor is asked for
          //3. Y - Skip (use while statement)
          //4. N -
            //a. Check Dwarf to see if he is available (again, while Statement),
                //not available if has conflicting labor
            //  Y - Assign
            //  N - Skip

        //start from top of list.
        for (int sPos = 0; sPos < sorter.size(); sPos++)
        {

            //dwarf position (used for searching of name)

            //I would like to set these to pointers, but I was getting out of bound issues...
            int dPos = 0;
            //role position
            int rPos = 0;
            //cycle through each dwarf? I should, but, I can use the *s->at(x).name to find the Dwarf #
            //no, need to compare roleName to dwarfName

            //search for Dwarf (y) for that role           

            for (int d = 0; d < d_count; d++)
            {
                //dPos is never getting updated.
                //int temp = d->id();
                if (sorter[sPos].d_id == m_selected_dwarfs.at(d)->id())
                {
                    dPos = d;
                    //break;
                };
                //dPos++;
            }

            //match superStruct roleName to myRoles name position (to check if filled up)
            for (int r = 0; r < ListOfRolesV.size(); r++)
            {
                if (sorter[r].role_name == ListOfRolesV[r].role_name)
                {
                    rPos = r;
                    //break;
                };

            };

            //search if role @ rPos is filled up
            //role check started...
            if (ListOfRolesV[rPos].numberAssigned < *ListOfRolesV[rPos].n_assign())
            {

                //need to compare to total_assigned_labors,
                //this will be used for Custom Professions

                int currentAssigned = m_selected_dwarfs.at(dPos)->total_assigned_labors();

              //is Dwarf (d) laborsAssigned full? Used in proto-type
              if (currentAssigned < labors_per)
              {
                  //another check to check for conflicting laborid's,
                  //AND
                  //to see if labor_id flag is checked in Options.
                  int debug = ListOfRolesV[rPos].labor_id;
                  //m_selected_dwarfs.at(dPos)->toggle_labor(ListOfRolesV[rPos].labor_id);
                  m_selected_dwarfs.at(dPos)->toggle_labor(debug);
                  //assign labor (z) to Dwarf @ dPos
                  //add labor (z?) to Dwarf's (d) labor vector

                  //m_selected_dwarfs.at(dPos).laborsAssigned.push_back(r->at(rPos).name);

                  //increase labors assigned to roles vector
                  //role check completed
                  ListOfRolesV[rPos].numberAssigned++;
                }
            }

        }
     m_model->calculate_pending();


};

If I didn't have kids, I could probably finish it tonight... but they crawl all over me likes monkeys and I'm made out of banana's...

But... I am making progress...  I think by next weekend I'll have a version to post up that people can try out that will optimize labors...

I only need to do two more things to get it to work

1. Clear labors - check
2. Load roles from CSV - check
3. Load dwarf values into superStruct & sort by weighted_percent - started...  the dwarf ID is loaded at the moment...
4. Assign Labors by going through superStruct weighted_percent descending...

btw, loading all your libraries/ide onto an ssd, and building on a ramdrive SERIOUSLY decreases the build time of DT.  I can go to the bathroom and rebuild all vs waiting 15-20 minutes.

Update:
step 3 looks like it's completely loaded :)  46 roles were completely loaded, and my superstruct was completely setup for a ton of dwarfs and all values were present, there was a minor bug I fixed in a loop operation where it skipped the first role, but that was fixed :)

Just need to sort by w_percent, and then optimize the labors!  I'll have to have a flag to check for the Miner, Ambusher/Hunter, Woodcutter labors, but that should be REALLY easy since I only have to do simple checks for laborID's

there is a good chance this will be completed this weekend!

Update:
I don't have much time this morning before my Pathfinder game, but... I was able to ask the player for how many labors per dwarf once he clicks optimize, as well as the name of the .csv input file (that contains all the roles, labors, priority, number to assign per labor).

Maybe before I leave, I can get it to sort...

Update:
fyi, if you've been following the spreadsheet version... this actually does some things that the spreadsheet can't, such as sort by role % vs sort by roles.

Example... before, each labor was assigned as such

x = labor colum
y = dwarf row
role % (z) = x,y

labors were assigned by x column, picking top num per role

now...
labors are assigned by
z = x,y position

so now assignments are assigned by z vs x

so all role %'s are sorted, and then the matching x,y is looked up, and assign up to number of dwarfs per x, and number of labors per y.

Update:

I'm kind of stuck right now... Splinterz says I shouldn't bother with pointers... but even the dwarf object is a pointer in most things, and that's an issue as well.

So... have to work through this, but I'm on the labor optimization.  Chances are, I'll still have it done this weekend.  Going to sleep, I sent him a notice on it, I only had about an hour to work on this today.

Update:
I've finished the coding, now to debugging...having weird problems...
labor 11 maps to carpentry and not farming... I know it does because I hard coded 11 into QT creator and it still enables carpentry, but 12 is stone detailing (i.e. engraving), yet, that one matches the script editor's labor_id map...

and not just that... it's not assigning all my labors right... I think it's a loop issue, but... making progress.

Update: updated code posted...
Here's a link to the updated code (not working correctly!) but you can see where I'm going with this
http://www.mediafire.com/?46zx8x6tt8ennb7

AND SUCCESS!

http://tinypic.com/m/fvwz86/4

So... the problems were.
I had an rPos not getting updated correctly due to a wrong counter variable.
and my labor_id's were off because I was using skill_id's.

fixed, now all I have to do is implement the Miner, Hunter, Woodcutter check, and it's ready!

Update:

it's not respecting labor per dwarf, will have to get back to that this eve

Update:
IT WORKS NOW!

So far what it does

is clear currently assigned labors
assign labors based on a role that maps to a labor_id (specified by the user).

currently does not support custom professions.

Here it is!
http://www.mediafire.com/?9wwp1xo6ws9ls5h

source
http://www.mediafire.com/?dnnqqv9pmiin1j9
 
intro
http://www.youtube.com/watch?v=Hm0X6LWsNpg&feature=youtu.be
« Last Edit: November 20, 2012, 06:15:06 pm by thistleknot »
Logged
Pages: 1 ... 170 171 [172] 173 174 ... 192