Optimizing in role-playing games

106 Views Asked by At

I know the answer to this must be out there somewhere, because people play a lot of games (online or otherwise) that do this sort of thing, but I don't know what words to search for. (The existence of unrelated but similarly-named concepts like "game theory" and "web optimization" hasn't helped.)

In a lot of role-playing-type games, your character can wear or use one item in each of several categories -- say a hat, shirt, pants, and shoes. The items affect certain attributes or abilities of your character -- say strength, speed, and agility. The effects are expressed in integers, and they're all added up to determine the character's current abilities. For example, if the hat and shoes I'm wearing are +3 agility, and my shirt and pants are +0 agility, then I'll be 6 units more agile than the base level.

Given a closetful of specific items, how do I choose an outfit that maximizes all of my character's abilities?

1

There are 1 best solutions below

0
On

In the RPG area you don't have that many choices, so you can just check them all. If you have three options for each of six slots, there are $3^6=729$ combinations. Many of those will be obviously inferior.

More of a problem is that you have multiple stats that you want to improve and the items give you a mix. Is +3 strength +3 agility better than +2 intelligence +4 constitution? In math we would expect you to develop a utility function to be maximized. It would take in all the stat increases, resistances, and other properties and return a score for how desirable the combination is. You could then just run through all the possibilities and take the highest score. The smarts are in that function. If you just want the greatest plus to strength, it is easy. Take the item for each slot that gives the most. But maybe +3 strength +3 agility is better than +5 strength. You could put a strength times agility term in the function to reflect this.

At this level of combinatorics I find people's judgement to be better than writing a program. The functions people write are too simple, while if they look at the combinations they will say the one the function recommends is stupid because it forgets something.