Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Algorithm Help

by scorpio17 (Abbot)
on Jan 19, 2010 at 15:00 UTC ( #818202=note: print w/replies, xml ) Need Help??

in reply to Algorithm 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).

Replies are listed 'Best First'.
Re^2: Algorithm Help
by jethro (Monsignor) on Jan 19, 2010 at 19:06 UTC
    You may have misread something. What you call gp he calls weight. Same thing though basically.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://818202]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2018-03-22 19:57 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (284 votes). Check out past polls.