good chemistry is complicated,and a little bit messy -LW PerlMonks

### Comment on

 Need Help??

sorry - but I think you're going about this all wrong!

Having played lots of games like this, I think it's dumb to generate random treasure in a way they will frequently give high-level players garbage items, and yet might give a low level player a game-breaking, super-powerful item.

I suggest the following: generate a table of all known weapons, and assign each a cost. For example, let's say a +1 sword costs 100gp, a +2 sword costs 400gp, a +3 sword costs 900gp, etc. Adding an energy-type bonus (flaming, frost, acid, etc.) counts the same as an extra plus, i.e., a "+2 flaming sword" costs the same as a "+3 sword".

Once all weapons and their costs are tabulated, bin them accordingly (the set of all 100gp weapons, the set of all 200gp weapons, etc.). Each area of the game should have a standard difficulty level used to determine appropriate treasure (level 1 of the dungeon has 100gp treasures, level 2 has 400gp, level 3 900gp, etc.). Then for a given treasure, randomly select an item from the appropriate bin. (the same metric would be used to determine which monsters to use in order to provide a good challenge)

An easy modification would be to generate a random number between 1 and 100, and do something like this:

1-5 use treasure for level-2
6-20 use treasure for level-1
21-80 use treasure appropriate for this level
81-95 use treasure for level+1
96-100 use treasure for level+2

So, on average, you get a level appropriate treasure, but you have a 15% chance of getting something better (and and equal change of getting something not quite so good).

In reply to Re: Algorithm Help by scorpio17
in thread Algorithm Help by dreadpiratepeter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• Please read these before you post! —
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?
• See Writeup Formatting Tips and other pages linked from there for more info.
• Log In?
 Username: Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2018-01-22 03:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
How did you see in the new year?

Results (231 votes). Check out past polls.

Notices?