I currently working on an RPG game and I'm looking for are formula for creating/generating a min-max weapon damage for an item.

Why in Diablo for example, when a weapon is dropped from an enemy, the weapon damage is 24-72 (just as an example)? it seems that each time the item is dropped those values are randomly generated and changed. So the same weapon could drop twice but his min-max weapon damage could be different.

Is there a math formula that calculates those min-max values when the engine creates the item? what's the legality of that formula? like ItemLevel * 2 or something.

I couldn't find on the internet anyone who talks about how those min-max values are generated in video games.

Does anyone have an idea?


1 Answer 1


The short answer is: because the developers made it that way. There's no single rule that all game use to generate randomized ranges. Usually, how the randomness is implemented will depend on why the developers are adding it. And again, that's going to vary depending on the game & situation.

Some of the reasons designers might add randomness because it:

  • is an expected convention of a genre. For example games based on table top RPGs.
  • may reduce guaranteed win scenarios and or create the opportunity for upset victories. For example an overpowered attacker might still get low random numbers allowing an underdog defender to survive.
  • might be introduced to adjust the skill ceiling. The outcome of static (non-random) events puts a greater emphasis on player skill.
  • is considered part of "finding the fun." Some players enjoy pouring over multiple variables of uncertainty to find ideal combinations for their play style.

For additional information on the why of randomness I suggest searching through our questions searching for "random" and either the or tags. I specifically recommend:

For more information about the math behind these calculations, I suggest:

  • \$\begingroup\$ Thank you very much! I'll learning from those links you provided. \$\endgroup\$
    – Eli
    Dec 12, 2023 at 16:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .