Optimisation of Dofus Equipment Sets
This post goes into detail on how to use an optimisation tool located at set.kuiper.dev along with an explanation of how it optimises. This tool was made with my brother, you can see more by Gwilym at gwilym.dev.
- Information for Dofus Players
- Pinning and Banning
- Information for those interested in how it works
- Simulated Annealing
- Our changes
- Further Work
Information for Dofus Players
Opening up set.kuiper.dev on preferably a desktop browser, you will see the following on the left
This makes up the bulk of the information that you need to input to generate a set, the weights for each individual stat, along with your level and whether or not you are planning to use exos for MP, AP, and range.
If you click optimise from here, it will attempt to generate a set for someone level 149 that tries to maximise the amount of AP. This is a rather trivial task, and most of the items chosen will do nothing to give AP due to AP maxing out quite easily. If I click optimise, it generates a set that gives 12 AP every time.
This is not that interesting, we want to generate a set that prioritises stats to reflect how we prioritise stats.
To do this we need to understand what the weights mean. Weights are what tells the optimiser how much a stat should be prioritised over another. If the weight for stat A was 1 and the weight for stat B was 100, then the optimiser will consider having 1 of stat B and 100 of stat A to be equivalently “good”.
This might seem a little confusing, but I find a good starting point to be setting AP and MP to 100, range to 50, and your main elemental stat to 1. You can add more stats to the weight list by pressing the “+ Add weight” button. Then tweak the numbers of other stats to obtain a good final set. Press optimise as much as you like! It’s a very interactive process. If you want to remove a stat from the weightings just set the weight to 0, as this is equivalent to it not being present.
Pinning and Banning
If you don’t want a specific item, press the bin icon on the item, then optimise. This will disallow the optimiser from picking this specific item.
If you have a specific item in mind for a slot, press the search icon on the slot in question and type in the name of the item in the search box found on the left side. Clicking on it the item in the list will then pin it to that slot. You can also pin items using the pin icon. Pinning an item will force the optimiser to use this item in this slot.
Pinning and banning can lead to the optimiser finding no possible set. This is more prevalent for low levels.
Information for those interested in how it works
This optimises using Simulated Annealing, which is chosen due to it being easily applicable to discrete problems with fairly large numbers of dimensions. The server and optimiser are written in Rust, the source code of both can be found at github.com/corwinkuiper/dofus_set.
An explanation of simulated annealing can be found on Wikipedia, which is where I learnt how to implement it.
The brief explanation of simulated annealing is that starting at some state A, a random neighbour B to this state is chosen. The energy of state B is then determined. If energy B is better than energy A then set A = B. Otherwise based on the current temperature of the system, randomly decide based on how much worse energy B is to energy A whether or not to set A = B. Repeat until you decide to stop.
This as given is relatively simple, the hard part comes from the parts that I didn’t explain. What is a neighbour? What is the energy? What is the temperature?
The neighbour to a state is where you change some variable. In our case, I change one item in one slot.
Energy is the property of the system that is optimised. In our case, this is every stat multiplied by its weighting and added together. Do note that minimisation and maximisation are equivalent, with maximisation being sticking a negative symbol in front of the energy function and sticking it in to a minimiser.
Temperature decreases as a function of time. The idea here is that at the start, the system is free to choose worse states. Over time the system is constrained in its switching and at the end it can only switch to better states. The reason to allow switching to worse states is so that we don’t fall into a local minimum.
The acceptance probability is written as
where is the energy of state A, is the energy of state B, and is the temperature of the system. The temperature usually starts at some initial temperature and decreases exponentially as
Our system makes some differences to simulated annealing. This is due to problems encountered with using items that have restrictions on the stats required to use them. To remedy this, invalid sets may be chosen with the level of invalidness depending on the temperature. Usually the choice of neighbour shouldn’t depend on the temperature.
Currently the system does not try to find how to distribute characteristics points. This is due to difficulties in the optimiser choosing non-zero numbers for characteristic points that don’t help the energy function.