But that's boring.
And still prone to exploiting, since if items are also generated then on other factors (say level) aside from the code you can simply wait 1 level for "bad" chests to try again.
Only if some factor is taken into account that doesn't stay constant after the game is started. It wouldn't be all that hard to generate a random seed on creation of a new game and then keep that seed around.
One could then just use the seed to specify what item and what stats the item gets and then scale it to the player's level. Of course one could then cheat the system by not opening a chest with a good item until much later in the game.
Of course, if you take item level out of the equation (so every factor is constant after the game's creation) then there's no point in reloading for loot. This would mean that items would be scaled to the level of the area they're found in. There are a few ways to go about this.
---
The most efficient (getting technical here, feel free to skip), I think, would be a generator ( http://en.wikipedia.org/wiki/Generator_%28computer_programming%29 ) that dispenses items based on some formula. Each time an item "drops" (or a chest is opened) the game would pick the next item from the generator, this would always be the same item for the same "position" in the generator. As an example of how this *could* work in a very simplistic way:
You save
1. You kill a mob which drops item X
2. You open a chest, which contains item Y
3. You kill a mob which drops item Z
You reload
1. You open a different chest, you get item X
2. You open another chest, you get item Y
3. You kill a mob which drops item Z
The above example is of course when using a straight up generator for all loot, pretty sure there are ways to make it slightly less predictable without making it totally random.
Now if you'd consider the level in the generator then the result would be similar, except that you'd get an entirely different set of items per level but they'll always be the same items for that level during that play-through.
Of course, mob drops are random, so if you:
save game
1. kill a mob, get item X for lvl1
2. ding lvl2
3. open a chest and get item A for lvl2
reload
1. kill a mob, which drops nothing
2. ding lvl2
3. kill a mob and get item A for lvl2
So you would not get item X in case two (which sort of makes sense I guess)
When you create a new game the random seed gets reset so you'll get entirely different items but they'll remain constant throughout the play-through.
---
Anyway, long post, hope it was interesting and made sense
