Gear Optimization for the Hunter Class in World of Warcraft Michael Barbour, Joshua Lawson, Michael Lee Abstract World of Warcraft (WoW) is by far the most popular Massively Multiplayer Online Role Playing Game (MMORPG). Over five million people around the world are currently subscribed to the video game WoW, with previous amounts reaching over eleven million [1]. The subscription fee for WoW is $14.99 a month recurring. Based upon the continued cost and finite time given to play, our team looks at the problem of gear optimization to further the player along within the game in the quickest possible way. The algorithms we used were a brute force algorithm, a backtracking algorithm, and a greedy algorithm. legs. The best gear is found in areas of the game called “dungeons” which are group based challenges that require the “killing” of bosses which in turn drop gear for the players. What makes a piece of gear good? What makes it optimal? Why choose one piece of gear over another? To start, each piece of gear can raise certain statistics (stats) on a character such as Agility or Mastery which in turn alters the damage per second (DPS) of that character. Icy Veins [2], a website devoted to games like WoW, describes each of the stats for a Hunter as: 1. Introduction WoW is a game filled with magical creatures, vast exotic landscapes, and a multitude of challenging quests to conquer singlehandedly or with a group of likeminded adventurers. The whole basis of progression within WoW revolves around combat and becoming a stronger “fighter.” There are many customizable pieces of equipment and eleven classes that allow a player to make a character that feels unique while still being balanced, however, deciding what equipment is the best can be a harrowing experience. We as a team focused on one class, the Hunter class who uses long range weaponry and animal pets to defeat their enemies, who has a vast array of available weapons and gear to use. Each piece of gear also pertains to an individual slot for the character helm, ring, chest, or Agility: Your primary statistic. You should look for it in all of your upgrades. It provides you with Attack Power, which determines the damage your abilities do. Haste: Increases your attack speed and Focus regeneration. Mastery: Increases the damage done by your pets. Critical Strike: Increases your chance to critically hit with all spells and abilities. Versatility: Increases all your damage and healing done, and decreases all damage taken. Multistrike: Causes your abilities to have a chance to hit/heal a second and a third time, each time dealing 30% of the initial damage/heal. These stats have varying effects which also give them a certain priority order. This order explains which stats should be the primary focus. Icy Veins also describes this on their page as: The stat priority for a Beast Mastery Hunter is: 1. 2. 3. 4. 5. 6. 7. Agility; Weapon DPS; Mastery; Haste; Multistrike; Versatility; Critical Strike. Using these stats we can determine which pieces of gear become more beneficial than others. Another website that was trying to solve the same problem called Ask Mr. Robot also had an equation that we took into account that ranked the stats based on maximizing DPS [3]. To correctly test these choices we used the program SimulationCraft (SimC) [4]. SimC allowed for us to put specific gear sets into the system to test the DPS based up organized combat rotations. An organized combat rotation takes human interaction out of the equation and gives an optimal DPS reading as if all of the combat skills are used with perfect timing. 2. Problem Statement The idea became how to correctly choose gear for your video game character based upon stats and gear slot that would maximize DPS. To allow for data collection under time constraints we chose to use the seven gear slots that had items with the largest stats associated. Helm Chest Shoulder Gloves Legs Boots Weapon We then selected six pieces of gear for each slot, except the weapon where we only selected five, based within a specific level range. This allowed for a specific pool to choose from and for us to gauge the DPS change. Our problem then became a modified 0/1 Knapsack problem [5]. We had the item slots, which become our bag, the DPS change per piece of gear became our value, and the probability that a piece of gear would be dropped over a one hundred period became the weight. The 0/1 aspect was dictated by the fact that only one item per gear slot could be used. No more than one helm, one weapon etc. could be taken. 3. Formal Statement Our goal is to maximize damage per second (represented by the variable vi) subject to the probability of acquiring a specific item over a one hundred day time period (represented by wi.). Maximize: Subject to: wi W iT And: * T = all possible gear subsets 𝑇⊆{1,….,𝑛} * Xi = Each item {1,….,} * Vi = Value of Xi * Wi (Weight or limiting factor) of Xi 4.00% 3.50% 3.00% 2.50% 2.00% 1.50% 1.00% 0.50% 0.00% Any Probability Above 80% Above 85% 0 1600 3200 4800 6400 8000 9600 11200 12800 14400 16000 17600 19200 20800 22400 24000 25600 27200 28800 30400 32000 33600 35200 36800 38400 Percent of Total Sets Brute Force Distribution Damage Value (increments of 400) Figure 3.1 Distribution of gear subsets based on probability. 4. Algorithms Tackling this problem came down to three different approaches we chose to use based upon the fundamental knapsack concept. We implemented a Brute Force Enumeration algorithm, an Adaptive Backtracking algorithm, and a Greedy algorithm. A. Brute Force Enumeration The Brute Force algorithm solves the knapsack problem by trying every possible subset of items and calculating the drop chance of that set. If the weight (drop chance) stays within the bounds, and the subset provides more value (DPS) then the piece is kept and the next set is tried. The result is an algorithm with exponential complexity O(an) and over two hundred thousand different subsets. The algorithm accomplishes this by calling a set generator that generates an array of 7 integers, each one ranging from 0 to 6 except for the first integer which only ranges from 0 to 5. Each of these sets are then put into the damage calculator which finds both the drop chance and the probability for that set in constant time O(1). The values are then compared to the best of all previous sets and saves the value as the new best if it stays within the bounds and provides a higher value. The biggest benefit of running a brute force algorithm is that it will find the definitive best solution. The biggest drawback is the run time can be prohibitive as the program scales very poorly. Figure 3.1 above demonstrates the distribution of potential gear sets. The x axis of that graph is comprised of grading for each damage value incremented in steps of 400. The y axis displays the percent of the total number of sets that fit within that damage range. Each of the three different colors represent the gear set with a different weight constraint. The yellow corresponds with all possible sets and is the unbounded solution containing 233,280 different subsets, the orange corresponds with a greater than 80% drop chance and contains 106,497 different subsets, and the red with an 85% drop chance and contains 23888 different subsets. The multimodal distribution is associated with the jump in value by taking a piece of gear to fill an otherwise unoccupied slot. Leaving a slot empty means that either an additional piece cannot be taken and still stay within the weight constraints, or that the gear improvement provided by another piece with a higher weight outweighs the improvement of taking another piece altogether. The optimal gear set while the constraint remains unbounded fills every gear slot as having gear strongly increases damage output, the 80% bound fills all slots except for the foot piece, and the 85% bound fills all gear slots except for the foot and hand pieces. B. Backtracking Backtracking algorithms use constraints to find optimal solutions by trying one possible “answer” and then backtracking if that solution fails to meet the optimal solution. Using this, we have made an adaptive backtracking algorithm that splits the problem into a collection of smaller problems. Each gear slot functions as a specific branch of a tree. The algorithm will select a subset of gear that includes one piece for each slot and actively backtracks from the piece of gear with the lowest weight to find the optimal set. It does this search only within the specific gear slot. Doing this cuts down runtime so the algorithm will not have to continuously go back to that gear slot to see if there is a more optimal choice. The constraints given for the backtracking algorithm were set to match the given constraints for the total Knapsack problem. The algorithm first uses the total value as a basis to find the gear set that is supposedly optimal, then the algorithm will find the set with the highest drop probability starting from the previously found gear set. Since all of the algorithms use the same equations to define values, the backtracking algorithm will find the set with the highest value that is within the constraint limit for weight. To find the gear set with the highest drop percentage the backtracking algorithm will go back to the first gear slot that is not optimal and change the piece of gear, then it will move to the next until there are no more it needs to change for that cycle. If that cycle fails, then the algorithm will go through the gear slot that was the last to be changed and change the piece until the drop percentage requirement was met or until it has exhausted all usable pieces of gear. We did constraint limits of 0%, 75%, 80%, 85%, and 100%. If the latter occurs then the algorithm will “backtrack” to the piece next on this list that has the lowest weight and perform the same action, while leaving the previous gear piece on the next possible gear piece for that slot. When a proper gear piece is found in that slot, the piece with the highest value to weight ratio, the algorithm locks that piece in place so that it cannot be changed again. The implementation of this algorithm changes the runtime of what would be considered ideal for backtracking as the approach could be considered naive. Depending on how the data set is supplied, this algorithm has the ability to perform similar to an exhaustive search algorithm. We determined that the worst case runtime of this algorithm would be O(an) where a is the number of slots in the gear set, and n is the number of items available in that specific slot. C. Greedy Lastly, the Greedy algorithm we designed took a straightforward approach to solving our problem by simply choosing the items that had the highest value or highest weight. This naïve way of tackling the problem showed that the ease of use and simplicity were quite a hindrance once the constraints were included within the algorithm. The algorithm starts by taking the data set, all of the gear options, and creating a nested array with one item being a row and the four columns reading as; the name of the item, the slot in which the item fits, the items weight, and the items value. The simple sort then initiated will put the items in descending order based upon weight, value, or ratio. The algorithm then iterates through the newly formed array and “grabs” items in order of occurrence. These items are then placed into a new array which will eventually make up the chosen gear set. On each “grab” the algorithm checks to see whether an item of the same type already exists within the array. If there is not, the item is added to the list, and if there is the item is skipped over and the algorithm “grabs” the next item. Once the constraint limit is hit the algorithm will stop and no longer continue looking for any items. What we discovered was that once the constraint went above the optimal gear set there wasn’t even remotely close to an optimal solution. This is a drawback of trying to solve a 0/1 knapsack problem with a greedy algorithm. Without constraints the optimal answer is found in a straightforward fashion but that is the only time it happens. The complexity can be determined as O(n log n) + O(nm). The O(n log n) from the initial sort and then O(nm) where n is the number of pieces in the solution and m is the total number of items. 5. Conclusion The optimal set without considering drop chance consists of Black Iron Sniper Rifle, Lavalink Stompers, Morningscale Gauntlet, Rockhide Casque, Morningscale Leggings, Lavalink Spaulders, and Streamslither Chestguard. The optimal set considering an 80% lower bound consists of the Black Iron Sniper Rifle, Morningscale Gauntlet, Rockhide Casque, Morningscale Leggings, Lavalink Spaulders, and Streamslither Chestguard. The optimal set using an 85% lower bound consists of the Black Iron Sniper Rifle, Rockhide Casque, Morningscale Leggings, Lavalink Spaulders, and Streamslither Chestguard. The only difference between each of these gear sets is the subtraction of one piece, the boots at an 80% drop chance and the boots and gloves at an 85% drop chance. From this it is possible to see many failings of the experiment itself. Due to how similar the weights are and how different the value of each piece is, it works optimally to simply drop a piece entirely than to give up on one of the more valuable pieces. The solution to optimizing hunter damage relies on depth, focusing on one particular piece (specifically more valuable pieces), rather than breadth, getting a piece for every slot. None of these algorithms preform perfectly but none are without value. While the brute force enumeration succeeds in checking each piece, it runs into issues when it comes to larger data sets. The backtracking approaches can also end up being incredibly complex and performs poorly when used on larger data sets or without given a clear exit condition. The greedy algorithm fails to find the best results for bounded problems but has a quick run time, working very well to find a decent optimal solution. 6. Future Work To expand upon our problem as it is right now there could possibly be ways to rework the greedy algorithm by infusing it with the backtracking algorithm. Allowing the greedy algorithm to roughly estimate the depth of a specific path, and backtracking to find another path once it fails. Or potentially changing the greedy algorithm so that it could accept a seemingly suboptimal option randomly in order to potentially approach an unforeseen maximum. To go beyond what has been laid out here would be to add in all of the other classes in WoW and all of the items available within the game. This would add a tremendous amount of data but allow us to give specific gear sets for each level in the game for all players. Besides WoW, there are a multitude of video games that run according to the same general idea and would allow for us to transfer the algorithms just by changing the initial data set and value calculation. Given enough time our algorithms could be changed to apply to all knapsack problems. Anything that would deal with this specific type of problem could then become grounds for research and testing. Freight shipping, manufacturing storage, and transportation services. 7. References 1. Ahuja, Amrita Osako, Mary. Nov. 3, 2015. Activision Blizzard Third Quarter Financial Results 2015. http://investor.activision.com/results.cfm (Nov 3, 2015) 2. Vlad. Aug. 14, 2015. Beast Mastery Hunter DPS Stat Priority (WoD 6.2.2). http://www.icy-veins.com/wow/beastmastery-hunter-pve-dps-stat-priority (October 14, 2015) 3. Coley, Peter. Nov. 16, 2015. Ask Mr. Robot Gear Optimizer. http://www.askmrrobot.com/wow/player (October 11, 2015) 4. Camille, Serge. Dec. 1, 2015. SimulationCraft. http://simulationcraft.org/ (October 20, 2015) 5. Tian, Y. , Lv, J. and Zheng, L. (2013) An Algorithm of 0-1 Knapsack Problem Based on Economic Model. Journal of Applied Mathematics and Physics, 1, 31-35. doi: 10.4236/jamp.2013.14006.