Managing Items Restocking and their Rarities

Started by
5 comments, last by LorenzoGatti 10 years, 5 months ago

Hi,

I've a web-based online game, whereby shops restock items in accordance with an item's rarity. Shops are restocked by the system between rand(5,20) minutes a part, with the next "restock" time being set at the last successful restock.

Item rarities are based on the number system 1-100. The system has "adjusted rarities" that subtracts 15 from the item's raw rarity. For example, if item A has a rarity of 50, it has a 1/(50 - 15) == 1/35 chance of restocking. If item B has a rarity of 90, it has a 1/(90 - 15) == 1/75 chance of restocking.

Naturally, with these kinds of chances only being given a go every 5-20 minutes, the commonest items are ever common and the rarest items are ever rare. Of course, users are always going to be chomping at the bit for the rarest and will always complain, to an extent, that "rare items are too rare." That's the fun of it.

But we've received some other type of feedback where users complain of "having a hard time restocking." This is leading to me to believe that, despite rarities, users are having a hard time obtaining the items that they want. I want users to have a fun time restocking and am trying to tweak how to restock items and handle their rarity. Right now, mathematically speaking, our restocking system is very "straight line."

I'm curious to hear about how others handle virtual economies and how to determine when and how to restock an item, based on some idea of scarcity.

Virtual economics, heh.

Advertisement

The "trouble restocking" that you have mentioned maybe means that players want to buy larger quantities of "non rare" items, but they restock much more slowly than people buy them out. Say 3 people are trying to buy torches (everyone needs 5-6 of them to explore a dungeon). There is currently one left in shop and the last player buys it. 5-20 minutes later, a torch restocks (it has 16 rarity, i.e. a 100% chance to restock), and is immediately bought out again. People waste hours waiting for those stupid torches to restock. Unluckily they can't see in the dark, so they really need them.

The solution would be, obviously, to make restock intervals shorter, and to give less rare items a restore of more than one at a time This could even be encoded for free in the rarity value: clamp the value to 16 for calculating the chance to restock at all, so anything 16 or lower is 100%, and restock 16-rarity items in one transaction. So a torch might have a rarity of 11, restoring 5 at a time.

Also, I think you should rather have "availabilty" (and simply roll d100 against the value) rather than "rarity" which is kind of the opposite. It seems like it doesn't matter what way one looks at it, but I think it does. First, it is somewhat less confusing and somewhat easier, but it also allows for a detail that is not easily possible with rarity.

Some items are unique or semi-unique. You might want to be able to simulate an item that is available but will never restock when you buy it out. There is no way to simulate this with rarity. You can make them very rare, but not non-restocking (not without writing special conditional code). With availability, it's trivial. Bias availability by adding 1 to the every desired base availability of every item, and subtract 1 from every item before rolling your die. Items that have an availability of 1 end up having a 0 when rolling for restocking. So that's not happening.

Why non-restocking items? They might be placed in the shop initially once (at an initially sheer unaffordable price) as a bait to get players working for a goal, for example. A player might sell an unique item to the shop, but it should not be restocked if someone buys it. On the other hand, it would be a very realistic simulation if a shopkeeper was restocking items that a player has sold and other players have bought out... if they are not unique. After all, a shopkeeper is a businessman, he stocks what people buy. The nice thing is, you don't even have to write code for this extra smartness! That's believeable AI for free.

Items sold to the shop by players normally "disappar" after some time, so this auto-restocking is self-limiting once players stop buying restocked stuff.


Item rarities are based on the number system 1-100. The system has "adjusted rarities" that subtracts 15 from the item's raw rarity. For example, if item A has a rarity of 50, it has a 1/(50 - 15) == 1/35 chance of restocking. If item B has a rarity of 90, it has a 1/(90 - 15) == 1/75 chance of restocking.

Hmm, so the lowest rarity item would be 16 (1/1, 100% chance of restocking), and the highest rarity is 100 (1/85, 1.1% chance of restocking).

You're looking at a faked virtual economy, a real one would have players who are able to trade their own items.

Anything lower than a 1/15 chance is going to happen so infrequently, it may never happen. 6% chance of happening in the real world is referred to as "rare" in statistics, it is realistically uncommon so much so that if you took 20 people and there were a 5% chance of one of them being B-, none of them would be.

Maybe this is what's troubling you. Even though you have a range of 1 to 100, anything over 31 rarity will defeat the odds, and possibly never show up.

Edit: Another important thing to consider is the effect of probabilities will appear to inflate in any game. Players aren't told about probabilities or any algorithms because we the developers may need to change them later. Some players are smart enough to notice if you tweak the probabilities, but there's still a lot of room for doubt.

Say you have a player base of 200, one player may encounter a rare drop in the first 5 hours (in your 5-20 minute restock system), he may never see it again and stop playing after 60 hours. The rest of the players never encounter the item until around 250 hours, 4 more players do.

When asked what they think the probability of an item dropping is, everyone who never saw it will say lower than 1%, the player who found it in 5 hours will say 10%. With only 200 players, they will never discover the true probability.

I should mention that the trading of items and currency is allowed in the game and is not restricted to these shops managed by the system. Items restock and then have their market value among users.

Because of the "rarity 16" problem you've described, our lowest rarity item available is rarity 34, which would have a 1 / (34-15) == 5.2% chance of restocking on each restock. Based on the "6% rare rule," even our commonest items would be considered rare.

The "trouble restocking" that you have mentioned maybe means that players want to buy larger quantities of "non rare" items, but they restock much more slowly than people buy them out. Say 3 people are trying to buy torches (everyone needs 5-6 of them to explore a dungeon). There is currently one left in shop and the last player buys it. 5-20 minutes later, a torch restocks (it has 16 rarity, i.e. a 100% chance to restock), and is immediately bought out again. People waste hours waiting for those stupid torches to restock. Unluckily they can't see in the dark, so they really need them.

The solution would be, obviously, to make restock intervals shorter, and to give less rare items a restore of more than one at a time This could even be encoded for free in the rarity value: clamp the value to 16 for calculating the chance to restock at all, so anything 16 or lower is 100%, and restock 16-rarity items in one transaction. So a torch might have a rarity of 11, restoring 5 at a time.

Also, I think you should rather have "availabilty" (and simply roll d100 against the value) rather than "rarity" which is kind of the opposite. It seems like it doesn't matter what way one looks at it, but I think it does. First, it is somewhat less confusing and somewhat easier, but it also allows for a detail that is not easily possible with rarity.

Some items are unique or semi-unique. You might want to be able to simulate an item that is available but will never restock when you buy it out. There is no way to simulate this with rarity. You can make them very rare, but not non-restocking (not without writing special conditional code). With availability, it's trivial. Bias availability by adding 1 to the every desired base availability of every item, and subtract 1 from every item before rolling your die. Items that have an availability of 1 end up having a 0 when rolling for restocking. So that's not happening.

Why non-restocking items? They might be placed in the shop initially once (at an initially sheer unaffordable price) as a bait to get players working for a goal, for example. A player might sell an unique item to the shop, but it should not be restocked if someone buys it. On the other hand, it would be a very realistic simulation if a shopkeeper was restocking items that a player has sold and other players have bought out... if they are not unique. After all, a shopkeeper is a businessman, he stocks what people buy. The nice thing is, you don't even have to write code for this extra smartness! That's believeable AI for free.

Items sold to the shop by players normally "disappar" after some time, so this auto-restocking is self-limiting once players stop buying restocked stuff.

What do you mean when you say, "You might want to be able to simulate an item that is available but will never restock when you buy it out"? Could you explain the difference between availability and rarity a bit more? Would a non-restocking item essentially be an item that's for sale (unlimited stock), without relying on the concept of a "restock"? Thanks much.

The main complaint, as I understand it from the above posts, is that items aren't restocking at all in many instances. When this applies to even the most common of items, I can see why this model would be frustrating to players. It'd be nice to know that items ARE on their way and not just a lottery on IF they are on their way.

I suggest a timer-based system rather than an odds-based system for restocking items. But shops need to put in orders for which items they want restocked instead of auto-stocking. (There's a micro-transaction system begging to be exploited right there.) Putting in an order for common beans costs so much and takes so much time for a set amount of inventory. Larger orders of inventory may cost less per unit, but take more time to arrive. Perhaps an equation that takes into account the number of an item available in the world... (Say... time increment * current population of item) With 100 items in play and an increment of 1 minute, the next item of that description can be delivered in 101 minutes... 1.66 hours (estimate)! Rare items can be ordered and paid for up front (expensive!), but the delivery timer is hidden (and with a time increment in hours, maybe). You just know that you will get that item... eventually. In the mean time, the money for that investment isn't available for immediate use. Some shop keepers will go for it. Others may not try for a rare item at all... Cancelling an order gets some money back, but not all of it.

And make the items consumable and/or spoil-able to keep the item population down...

Just throwing some thoughts out there.

Writer, Game Maker, Day-Dreamer... Check out all the wonderful things I've thought up at Meatsack's Workshop!

Check out the Current Ranking of Super Gunball DEMO on IndieDB!


What do you mean when you say, "You might want to be able to simulate an item that is available but will never restock when you buy it out"? Could you explain the difference between availability and rarity a bit more? Would a non-restocking item essentially be an item that's for sale (unlimited stock), without relying on the concept of a "restock"
The difference between availability and rarity is simply the higher availability, the more likely it is to restock at one occasion. The advantage is that conceptually, you have a bigger value for "more", so the designer does not need to invert logic in his head (with rarity, I need to use a bigger number when I want less!). Also, the roll is simpler, something like if((rand() % 100) < avail). Plus, you can have items that don't restock without writing extra code. You can of course always implement items that do not restock at all, but with availability it is possible without writing extra code. Simply set availability to zero (or to 1, if you want to have the self-restocking feature of sold items).

It does the same thing, but it is easier and more flexible. With rarity, you have the 1/likelihood thing, so in order to have a "never happens" condition, the value would need to be infinite.

Items that never restock may not be something you want now, but it might be something you want in the future maybe. Or it might be a fun addition. Same for auto-restocking items that players sold. You do not have to implement this, but if you want, then it is very easy with availability. Personally I would deem this very cool, because it would allow the shop to adapt to what players buy and sell without you having to reprogram anything.

You might want to look into a system that is only mildly random. I'm going to quote a fellow from another forum:

Players like to get rare items, but they also hate "never" getting a rare item. And guess what, if you design your drop system based off a simple random number generator, that could actually happen. Just as an example, if you design something to have a 1 in 100,000 chance of dropping and implement it by saying if (random(0,99999) == 77777) then drop(coolItem), statistically there is a 36.8% chance that after 100,000 drops it won't have ever dropped.

Furthermore, there is a 0.0045% chance that it still won't have dropped after 1 million drops. That means that if you have 25,000 people playing your game and each of them have grabbed loot a million times, it is very likely that one of them is going to have zero of what they should have actually gotten ten of, seeing as 1 million is 100,000 x 10 and you wanted it to drop once every 100,000 loots. But nope, instead of ten they got zero.

And a few more will have only gotten one.

And even more will have only gotten two, etc.

And of course a portion will have gotten much more than ten. Won't they be happy! Well, not really. They're not actually going to be able to perceive just how lucky they've gotten. It's a lot easier to notice that you aren't getting things than it is to notice that you are getting even twice as many things as you should be.

Maybe for some reason you sell a million copies. Let's not think about what your million selling game is doing, statistically, to one very unlucky customer.

So let's not do it that way. How about a way that has a guaranteed amount of fairness but still feels random? How about an extremely rare (1 in 100 million) worst case scenario where two players each get two ultimate loots after 200,000 loots, just one gets his at Loot #99,999 and Loot #100,000 and the other gets his at Loot #0 and Loot #199,999? All it will cost you is some increased memory overhead.

And how about we tweak the system a little more to avoid those worst case scenarios? Or think about what all this is actually doing and give the player some more opportunities to make some interesting decisions?

That link above leads to a series of posts on the subject if you're interested, it's a good read. That said, You might not be interested in implementing things that way, as maybe you want it like it is, unbalanced, so that players are forced to trade?

EDIT: There is a similar and shorter article here: http://www.gamedev.net/page/resources/_/creative/game-design/not-so-random-randomness-in-game-design-and-programming-r3423

You could improve this system by making it simpler - complex isn't always better. Do you really need 100 degrees of rarity? (well, 85 degrees given the formula you're using..also, you should never give an item 15 rarity or you'll divide by zero) Most games break rarity down into a few categories (e.g. Common, Uncommon, Rare, Unique). I'm also not sure what you intend to accomplish by subtracting 15 from the number; They're parallel linear functions.

It looks like another problem you're running into is that you can run out of stock on common items. There are some items that should never be out of stock. In Magic: The Gathering, rare cards aren't necessarily better cards - they're cards that are useful in very specific situations. In other words, rare cards are rarely useful. On the other hand, common cards are useful in almost any deck. Booster packs always contain lands - everyone needs lands. Rare cards like Pox are only useful in decks built around specific strategies.

This system also doesn't scale very well. With a large player-base, stores will be bought out pretty quickly after each re-stock, leaving many players with nothing to purchase for long periods of time. There are alternative ways to handle this. Here is one:

  • Common items are always available from the store.
  • Uncommon items are sometimes available from the store, and are sometimes acquired through quests.
  • Rare items are never available from the store, and are sometimes acquired through quests.

Hope this feedback helps. laugh.png

Edit: Also, the formula you're using for probability really bothers me. If you want to do a percent chance for an event, you'd do y = x/100. What you're doing is y = 1/x.

With your formula, a raw rarity of 50 means a 2.8% chance of re-stocking. That's very rare!

i don't realy understand where the rarity comes from, see, if it was just predetermined like in a CCG then it would add a fun/rarity factor to the game,

but when you're selling less of a thing when there is less available ... this is actually the opposite of what a normal shop would do,

a normal shop would go through extra trouble to get these rare items since they could get extra money for them.

But if you just do it like this:
items are always available, but the more are bought the more expensive it is,
then the shop actually has a use;
namely players can get the item they need, they ll have to pay more for it so it's not a no-brainer to always use, especially for rare items,

but the shop improves the game experience.

This topic is closed to new replies.

Advertisement