Genetic algorithm is a well-known optimization solution for an unknown, complex case that cannot be solved using conventional methods.
In Role-Playing Games (RPG), usually the main features are character’s stats and equip items. Character has stats, namely strength, defense, speed, agility, life. Also, equip items that can boost character’s stats. These items retrieved randomly when an enemy dead.
A problem arise when the player have so many items that we cannot choose the best. Latest items doesn’t always mean best, because usually in RPGs, items don’t always boost all stats equally, but often it reduces certain stat while increasing the other.
Based on this, a function is built in this research, to auto equip all items, based on the standard deviation of character’s stats after equipping. The genetic algorithm will evaluate the best combination of gloves, armors and shoes. This algorithm involves the process of evaluating initial population (items combination), selection, crossover, mutation, elitism, creating new population. The algorithm stops when the best fitness is getting stable in successive 3 generations.
After the auto equip process, the character is getting significantly stronger compared to using default equip items, measured by the remaining life after fighting with several enemies.