Elitist Jerks
Register
Blogs
Forums


Go Back   Elitist Jerks » Class Mechanics » Rogues

Reply
 
LinkBack Thread Tools
Old 06/09/08, 12:46 AM   #1
• Aldriana
Mike Tyson
 
Night Elf Rogue
 
Doomhammer
RogueCalc

Edit: Just to be clear, this is not currently functional for Wrath of the Lich King, so stop sending PMs asking me why you get errors when you try to run it. It will be updated at some point. I don't know when that will be. When it is, I'll let you know.

Astute readers of my assorted posts in the Rogue Gear Spreadsheet thread may have noticed me express a certain level of discontent regarding the spreadsheet format in terms of doing good rogue modeling. I've repeatedly expressed the sentiment that Rogue modeling would benefit by being done in an actual programming language. And it's this notion in particular I had in mind when I asserted that the Rogue Gear Sheet is not the framework I'd want to do expansion modeling in.

So, that said: I figured it was about time that I work on putting such a framework together, so over the past weekend I finished off the code I've been working on on and of for the last several months and now believe I have it to a point where it's worth letting you fine people take a look at it; hence, at the end of this post, you'll find RogueCalc v0.1.

Now, lets be clear: it's called 0.1 for a reason. Those of you that remember Rogue Gear Spreadsheet v0.1 will recall that it was a far cry from it's current incarnation... and the same thing applies here. This is not a finished product, and isn't as functional or fully-featured has the current spreadsheet. But, there's enough to give you the idea, so I figured I'd let people have a look.

At the moment, this is just a command-line damage calculator. Eventually, I want to get gear recommendations akin to the Rogue Gear Sheet's in here, but there's a few problems that need to be solved first - more on that later. It also needs a GUI, more cycle calculations, and the like... but that, too, comes later. For the moment, what this program does is simple: you enter your name and realm, plus choice of buffs; it fetches your gear + spec from the armory, applies the selected buffs, and gives you a sorted list of damage estimates for every cycle of the form XsYr. This will cover most SS and Hemo builds - for dagger-centric builds, this admittedly does not work so well - that's another one of those problems to be solved later.

I imagine a lot of this will become clearer once you have the chance to play with this a bit, so before I go any further I suppose I should tell you how to use this thing. I should warn you that in this early form this is a bit more complicated to use than the spreadsheets, so if you're looking only at doing some quick gear comparisons, I'd recommend that you not use this; however, for those of you that would like to help me debug this and turn it into a more useful tool for the masses, I'd love to have your feedback.

Usage
1) You will need Python to run this. Eventually, I have some ideas for removing this restriction... but for the moment, you'll need to download and install Python. To get it, stop by the python website, download your favorite package, and install it. For most of you, that will probably be the Windows Installer for 2.5.2.
2) Once you have Python installed, download and unzip the attached file. It will create a folder with two files in it, RogueCalc.py and RogueCalcConfig.txt. The first is the brains of the program, and the second is the equivalent of the front page of the existing spreadsheets. So, the first thing you're going to want to do is open up RogueCalcConfig.txt in your favorite text editor, and adjust the settings there as you see fit. Initially, this probably consists of just entering your character name and realm so it can pick up your stats; further down, there's options for your buffs, plus the ability to enter in different talent specs if you so desire. Make sure to read the explanations in the file for everything. If you do not enter values exactly as specified, there's a very good chance that the program won't work
3) Once you have the config file set up to your taste, open up a command-line prompt and navigate to the RogueCalc directory. Once in this directory, type the command line "python RogueCalc.py". At this point, it'll think for a second or two, and then spit out damage estimates for every possible XsYr cycle.

Notes
1) If you're specced daggers, it's not going to find your optimal cycle correctly, and you'll probably wind up with a damage recommendation somewhat below what the Gear Sheet comes up with for you.
2) Your DPS will probably be 1% or so higher than the Rogue Gear Sheet will tell you for the same gear and buffs. This is because this sheet models certain things - notably WF - more accurately than the spreadsheet can, and the effect of this turns out to be slightly higher DPS in general.
3) Pretty much everything that the Rogue Gear Sheet supports is supported here as well... and a whole bunch of other stuff besides. There are no new procs or set bonuses added, but if you are wearing gear with no such complications, the program should pick it up correctly. The only item I'm specifically aware of being missing is Might of the Scourge (and if you have Might of the Scourge on in your armory, please let me know so I can add it).

What I'm looking for
Mostly, what I'm hoping for at this stage is to have some assortment of you fine people out there run this against your armory, and perhaps the armory of any other rogues you happen to feel like trying it on. Yes, it's primitive, and yes, it's not very useful right now, but it's not going to get to the point where it is without testings. So if some of you out there would like to be guinea pigs and try running this with a range of buffs and abilities and try to find anything I might have done wrong, that would be great. If you run into a situation where you're getting answers significantly different the the Gear sheet (other than the above-mentioned notes), please let me know.

What to do if something doesn't work
This is a very early release of this project. As such, it contains bugs. Hence, sometimes when you run it, you may get answers that seem like nonsense. You may get not answers at all, simply a message asking you to tell me about it and a bunch of garbage. In either event, I would like to know about it. Post in this thread, or PM me about it, and send me the following 3 things:

1) Any and all output generated.
2) Your config file.
3) In whatever directory you ran RogueCalc from, there should be a log file called RogueCalc.log. Please send me this as well.

Next Steps
So, as noted, this is a very early version of the tool, and it needs quite a bit of work. If there are any of your out there with coding experience, I'd love to have your help on any part of this you feel like helping with - and believe me, I have a whole laundry list of things that I'd like to add. However, there's one thing - more than anything else - that is going to be needed for the tool to move forwards. And that one thing is the ability to scrub wowhead, wowdb, the armory, or some similar site to build an item database and store it in an easy-to-access format. I know some work has been done on this, but I couldn't find anything up-to-date and working. Item recommendations and the like cannot happen until we have an associated item database, so please, if you know how to do this and could help me out, that would be great.

Past that: if people would like to look through the code and tell me if things look sensible, that would be great. And anyone interested in helping with other parts of this, please let me know. While I do believe this is the better framework to be working with moving forwards, I also believe that there's a fair amount of work needed before we get everything working, so any help I can get with that would be great.
Attached Files
File Type: zip RogueCalc_0_3.zip (21.2 KB, 8541 views)

Last edited by Aldriana : 12/11/08 at 2:36 PM.

Offline
Reply With Quote
Old 06/09/08, 1:22 AM   #2
• Vulajin
Vula'jin the Void, blessed by the loa
 
Vulajin's Avatar
 
Undead Mage
 
Mal'Ganis
I was looking forward to this, but I didn't expect it to be coming so soon. I will fiddle with it now and edit this post if I can provide any feedback.

I'm curious what kind of model you used to implement this. Is this basically like a Python-ized version of the calculation style used in the Gear Sheet, or did you implement more of a simulation style of calculation? (edit) And on top of that, might there be any expectation of modeling things like Seal Fate using this program? Never know whether expansion talents/changes may make builds other than combat viable or optimal.

Originally Posted by Enervate
Yep, still a fucking idiot.

United States Offline
Reply With Quote
Old 06/09/08, 2:05 AM   #3
• Aldriana
Mike Tyson
 
Night Elf Rogue
 
Doomhammer
So, at the moment, it's mostly a Pythonized version of the Gear Sheet. Now, you can debate how useful that is by itself, but there's a few key things to keep in mind:

1) The Rogue Gear Sheet, in it's final incarnation, is about 3.6 MB. Part of that is just overhead for being an Excel Application, but part of it is that there was a lot of duplication of work - the same formulas had to be entered in in many many different places - even the simplest changes required updating 300 different cells. The structure of a programming language massively reduces the duplication of effort required, which is why the initial draft of this is roughly 100 times smaller than the spreadsheet was.
2) Programming languages allow you to do useful things for code clarity like assigning variable names, making it much much easier to look at a formula and tell what it's doing; hence it's easier to debug and maintain the codebase.

Basically: this isn't doing anything new... yet. It's just doing it in a vastly more intelligent, efficient, and easy-to-modify way. There are issues that we had with the spreadsheet that we can actually solve in this framework.

This additionally means that, down the line, adding things like SF and Mutilate cycles should be somewhat more manageable than it was in the spreadsheet. It's still work, and it's still not atop my list of priorities... but there's a better chance of it happening here than there ever was for the spreadsheet. Particularly if I can get some help with writing such things.

Offline
Reply With Quote
Old 06/09/08, 2:31 AM   #4
Latito
Don Flamenco
 
Latito's Avatar
 
Human Rogue
 
Lightbringer
Check out my Armory for Might of the Scourge. Like Vulajin, I was hoping to eventually look at a programming language based DPS simulator, but had no idea or expectation of it being anywhere near this early. Welcome back to Roguecraft, Aldriana. I hope you enjoyed your break. I'll take some time to look at this tomorrow when I have some more time, get you some solid feedback hopefully.

The World of Warcraft Armory
permanentenchant="2717"

Offline
Reply With Quote
Old 06/09/08, 3:29 AM   #5
TheWicked22
Glass Joe
 
TheWicked22's Avatar
 
Gnome Death Knight
 
<EC>
Executus
Glad to see you've decided to take this on, Aldriana. I'm looking forward to seeing what you have planned. Since I'm limited to dial-up internet until this weekend, I'm not sure of how much help I can be. However, If you or anyone else would like to use my armory for any additional testing, feel free.

The World of Warcraft Armory

Offline
Reply With Quote
Old 06/09/08, 4:17 AM   #6
koaschten
In the rear with the gear!
 
koaschten's Avatar
 
Troll Rogue
 
Khaz'goroth (EU)
Just wanted to hand over a cookie as i started to play around with it and looking at the source, a pity i have no clue of python.

Something for all those trying this under windows, i got errors trying to call the calc when it was not in the same directory as the python executable. e.g. i installed python to d:\python25 and created a subfolder named \RogueCalc where i placed the files from the zip, calling then "python d:\python25\RogueCalc\RogueCalc.py" from d:\python25 would result in this:
D:\Python25>python.exe d:\Python25\RogueCalc\RogueCalc.py
An internal error has occurred, please notify Aldriana.
Traceback (most recent call last):
  File "d:\Python25\RogueCalc\RogueCalc.py", line 1250, in <module>
    talents.set_from_armory(name, realm, region)
  File "d:\Python25\RogueCalc\RogueCalc.py", line 215, in set_from_armory
    talents = getAttribute(doc, ('talentTab', 'talentTree', 'value'))
  File "d:\Python25\RogueCalc\RogueCalc.py", line 272, in getAttribute
    curElement = curElement.getElementsByTagName(item)[0]
IndexError: list index out of range
Moving the files from the subfolder to the pyhton25 root and calling "python RogueCalc.py" from there works just fine.

How to get an Android Authenticator on your PC. (updated feb'11)

Germany Offline
Reply With Quote
Old 06/09/08, 4:26 AM   #7
• Aldriana
Mike Tyson
 
Night Elf Rogue
 
Doomhammer
The usual way of setting things up is to add python to your path (which should happen automatically) so you can just type "python RogueCalc.py" from any directory - that's how I have it set up, anyway. But yeah, if you try to invoke things from outside the RogueCalc directory I can see how it might cause problems.

Offline
Reply With Quote
Old 06/09/08, 4:47 AM   #8
koaschten
In the rear with the gear!
 
koaschten's Avatar
 
Troll Rogue
 
Khaz'goroth (EU)
D:\Python25\RogueCalc>echo %path%
C:\Programme\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
\System32\Wbem;C:\Programme\OpenVPN\bin
Seems my python installer failed then
Well no problem at all to have to put the RogueCalc files into the Python directory, lets see if i can add the path manually, would prefer the cleaner way...

D:\Python25\RogueCalc>set path=%path%;d:\Python25

D:\Python25\RogueCalc>echo %path%
C:\Programme\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
\System32\Wbem;C:\Programme\OpenVPN\bin;d:\Python25
That looks good so far ... but ...
D:\temp\RogueCalc>python RogueCalc.py
An internal error has occurred, please notify Aldriana.
Traceback (most recent call last):
  File "RogueCalc.py", line 1250, in <module>
    talents.set_from_armory(name, realm, region)
  File "RogueCalc.py", line 215, in set_from_armory
    talents = getAttribute(doc, ('talentTab', 'talentTree', 'value'))
  File "RogueCalc.py", line 272, in getAttribute
    curElement = curElement.getElementsByTagName(item)[0]
IndexError: list index out of range
(using the default config file)

How to get an Android Authenticator on your PC. (updated feb'11)

Germany Offline
Reply With Quote
Old 06/09/08, 4:58 AM   #9
• Aldriana
Mike Tyson
 
Night Elf Rogue
 
Doomhammer
Interesting, can't imagine what's causing that... particularly since that error is that it's having trouble fetching the info it needs from the armory, which shouldn't have anything to do with your path setup. It looks like one of the very early things I'll need to fix here is better error handling on armory fetches... plus possibly the way to manually download and store a profile so we're not utterly reliant on armory fetches for gear. Though admittedly those are the sort of features that tend to work better once you have a GUI... I'll have to think about how to set this up a bit.

Offline
Reply With Quote
Old 06/09/08, 5:32 AM   #10
koaschten
In the rear with the gear!
 
koaschten's Avatar
 
Troll Rogue
 
Khaz'goroth (EU)
Well the interesting thing is, Aldriana, that i can instantly switch back into the python install dir and it works with the default settings file. Little confusing, but i can handle having the project files in my python install dir. Dont put too much energy into tracking this.

How to get an Android Authenticator on your PC. (updated feb'11)

Germany Offline
Reply With Quote
Old 06/09/08, 5:58 AM   #11
sp00n
Bald Bull
 
Night Elf Rogue
 
Wrathbringer (EU)
I can run the calc just fine when I enter the full path for my python installation (don't have it added to the path).
E.g. f:\programs\python25\python.exe RogueCalc.py

However the program is having problems with special characters such as umlauts.
region = EU
character = Evil
realm = Festung der Stürme

region = EU
character = Fêanôr
realm = Wrathbringer

Those both are giving me the same error,
An internal error has occurred, please notify Aldriana.
Traceback (most recent call last):
  File "RogueCalc.py", line 1250, in <module>
    talents.set_from_armory(name, realm, region)
  File "RogueCalc.py", line 215, in set_from_armory
    talents = getAttribute(doc, ('talentTab', 'talentTree', 'value'))
  File "RogueCalc.py", line 272, in getAttribute
    curElement = curElement.getElementsByTagName(item)[0]
IndexError: list index out of range

Apostrophes/inverted commas (what's the correct name for it in English? :x) in server names seem to work fine, but maybe you should handle ` and ´ instead of ' seperately, because those two seem to be frequently used instead by some individuals...

Anyway, I almost posted that you have a problem with apostrophes as well, since on my test with an apostrophe it took awfully long to process a request, up to the point where I CRTL-C out of it. Do you have some sort of max execution time or does it run until it has fetched the information from the armory?

Stopped Playing

Offline
Reply With Quote
Old 06/09/08, 6:08 AM   #12
choumarin
Glass Joe
 
Human Rogue
 
Medivh (EU)
Got an error with [Heartrazor's Gift] which get wrongly parsed by the getAP sub :

    def getAP(self):
        spellList = self.doc.getElementsByTagName('spell')
        for entry in spellList:
            desc = entry.getElementsByTagName('desc')[0].firstChild.data
            if desc.startswith('Increases attack power by '):
                return int(desc[26:-1])
        return 0
An internal error has occurred, please notify Aldriana.
Traceback (most recent call last):
  File "D:\tools\Python25\RogueCalc\RogueCalc.py", line 1264, in <module>
    race, stats = parseChar(char)
  File "D:\tools\Python25\RogueCalc\RogueCalc.py", line 1043, in parseChar
    stats.ap += itemStats.getAP()
  File "D:\tools\Python25\RogueCalc\RogueCalc.py", line 137, in getAP
    return int(desc[26:-1])
ValueError: invalid literal for int() with base 10: '270 for 10 sec'
I suggest you check for
          <trigger>1</trigger>
which is "Equiped" trigger instead of
          <trigger>2</trigger>
which is chance on hit.


Great job btw

Edit :

Works with:
    def getAP(self):
        spellList = self.doc.getElementsByTagName('spell')
        for entry in spellList:
            desc = entry.getElementsByTagName('desc')[0].firstChild.data
            if int(entry.getElementsByTagName('trigger')[0].firstChild.data) == 1:
              if desc.startswith('Increases attack power by '):
                  return int(desc[26:-1])
        return 0
However calculations gives me a 3s/2r for my 41/20 Mut spec instead of the 1-3s/5-5r from the spreadsheet. I suppose mut isnt modeled yet.
I'd really like to be able to help on the dev ^^

Last edited by choumarin : 06/09/08 at 8:15 AM.

Offline
Reply With Quote
Old 06/09/08, 6:33 AM   #13
HawkEyeTS
Glass Joe
 
Human Rogue
 
Eredar
For those having trouble with the path issue, I installed the Windows executable version from the site linked to, and while "python RogueCalc.py" did not work in the command prompt, as others are saying, just typing "RogueCalc.py" did execute properly. At least for me, it seems Windows registered it as an executable file type and doesn't need the program name to run it properly.

As for the script, I didn't get any errors running it on my own or two other rogues I knew of on Eredar, but the Armory apparently dropped its cache last night and the rest of the rogues in my guild havn't logged their characters in yet, so I didn't have a large variety of gear to test it on.

Offline
Reply With Quote
Old 06/09/08, 10:06 AM   #14
nilgambor
Banned
 
Undead Rogue
 
Shattrath (EU)
I run the calc from my Python dir but have this error

C:\Documents and Settings\God>C:\Python25\RogueCalc.py
An internal error has occurred, please notify Aldriana.
Traceback (most recent call last):
  File "C:\Python25\RogueCalc.py", line 1236, in <module>
    ENEMY_ARMOR = config.getint("General", "target_armor")
  File "C:\Python25\lib\ConfigParser.py", line 321, in getint
    return self._get(section, int, option)
  File "C:\Python25\lib\ConfigParser.py", line 318, in _get
    return conv(self.get(section, option))
  File "C:\Python25\lib\ConfigParser.py", line 511, in get
    raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'General'

Last edited by nilgambor : 06/09/08 at 10:58 AM.

Offline
Reply With Quote
Old 06/09/08, 11:20 AM   #15
charriu
Piston Honda
 
charriu's Avatar
 
Tauren Druid
 
Gorgonnash (EU)
Nice work!

You should probably mention that the config file has to be safed as utf-8 if the character name contains any kind of funny characters (like Lathár on EU-Die Todeskrallen). Otherwise I get the same exception as sp00n does.

Offline
Reply With Quote
Reply

Go Back   Elitist Jerks » Class Mechanics » Rogues

Thread Tools