Featured Blog

Preferential Treatment Stabilizes Random In-Game Shops

In games with random shop inventories, letting players preorder in-game items with specific parameters helps keep players excited when getting items. It makes sense lore-wise that big spenders like PCs would want specific spiffy gear to do their job.


Divinity: Original Sin is a PC and Mac RPG from Larian Studios in the vein of Ultima VII; that is, a game focused on the interactivity in its somewhat open world. In this article, I explore the randomized shop inventory system and how to improve it to reduce frustration while keeping the current spirit of the game.

How Things Work Now


I have probably spent hours looking at shop stock screens.
Image from Prima Games.

-Shop inventories contain random stock within the theme of the vendor. Some vendors sell fire and earth spells. Some vendors sell water and air spells. Some vendors sell ranger skillbooks and ranged weapons. Generalist vendors sell a bit of everything.

-Skillbooks, though the very basis of a character's abilities, are not guaranteed to be sold from the appropriate vendors, even if the character is of a level to use this skill!

-Vendors tend to have a small amount of other stock too, such as special arrows from a ranger vendor, staves from a spell vendor, and daggers from a rogue skill vendor.

-A vendor's stock is randomized the first time any character talks to him, or if that character has gained a level since talking to that person. (Vendor stock can reset after a certain amount of elapsed time, but this may require hours of waiting in real time.) Thus, saving before talking to this person, checking his stock, then reloading on an unfavorable result is recommended.

-Sold items come in one of five rarities common (white - no stat bonuses), magic (blue - 1 stat bonus), rare (green - 2 stat bonuses), legendary (orange - 4 stat bonuses with the possibility to grant the item wearer a new skill while the item is equipped), and unique (gold - specific items with specific properties). Only certain vendors can sell legendary and unique items, and the game does not make it clear who can and cannot sell them. I only learned about this via this Legendary Items Farm wiki article.

-All worn gear sold scales to the party's level at the time of purchase, with rare exceptions. Thus, a level 2 character talking to a vendor will display level 2 stock and a level 9 character will display level 9 stock. Skill books are generally available from relevant vendors starting 3 levels before any character can use that skill. Skill books for lower-level skills tend to phase out as levels increase.

-Any item a character sells or gives to any NPC via the barter screen will remain in that person's inventory indefinitely, unless purchased or stolen by a player character. Those pillows and seashells you sold to that wizard at level 2 will stay there the rest of his life.

-Vendor restocking will remove all previous randomly-stocked items that vendor sold.

-Vendors are one obvious way to get gear. Looting the environment gets you what is there, and crafting lets you make items to get some of the stat boosts you want (like +1 Intelligence at low levels of +2 Intelligence at high levels). Crafting, however, only allows making items with one stat boost (with minor exceptions), while store-bought items can have 2 to 4.

-Until the party is in double digit levels, the stat boosts on all items found, bought, or crafted is only +1. It's possible to have +1 to a variety of stats, such as +1 Intelligence, +1 Speed, +1 Constitution, and +1 Leadership.

-Items can generate contradictory stat bonuses. A dagger can give +1 to the Bow skill. A bow can give +1 to the Crossbow skill. Characters have only two hands, and item effects are only active when such an item is equipped.

Goals and Effects of the Current System

-Loot will always be random to give people reason to return to vendors level after level, and to encourage players to visit every vendor after every restock.

-Random shop stock is meant to simulate restricted trade due to small supplies.

-Loot will always be level appropriate.

-In terms of damage (on weapons), blocking (on shields), and defense (on armor and shields), a higher level item will always have better base stats than a lower-level one. Stat bonuses (like +1 Intelligence, +Block Chance, or +1 Lockpicking) justify keeping such an item into later levels.

-Getting new items is meant to be exciting. Visiting vendors and opening containers is meant to provide a surge of excitement and a thrill of hope.

-With the ability to reload before every potential restock, and with vendor stock being so random, the game just slows for me while I check each vendor for the right gear. I like that I can keep reloading to get different items, but the wild variation in item quality makes things take much longer than they should.

-The long drought between +1s and +2s on items makes the midgame (starting around level 7) sag. I was no longer excited when I found new items, and even new legendary items disappointed me. I simply maxed out my stat bonuses from things I already found, bought, or crafted. (Reading Internet crafting guides was a factor. Then again, I played with the Source Difficulty Mod on hard.)

-Since vendors are not guaranteed to sell a skillbook I need when I need it, especially if I am expanding a party member's skillset mid- or late-game, the game's emphasis on player choice is diminished. This system feels like a cruel "gotchya."

-On the game's highest difficulty (at least with the Source Difficulty Mod active), players simply need the best gear from in and around the game's starting town of Cyseal. Checking each vendor and chest to get the right items took me about 10 hours of real time, but what a difference it made!  The game went from impossible to manageable and even fun with this tremendous influx of the right items.

My Solution


Item customization through prioritized preordering.
Image from

-After talking with a vendor the first time, the player has the ability to at least partially customize what the next random stock will be; hence, preferential item treatment. What are his 3 top priorities for item categories (daggers, swords, shields, staves, helms, bracers, scrolls, potions, etc.), and stat bonuses/effects (+Intelligence, +Leadership, +Block Chance, Invisibility?? In roleplaying terms, the vendor puts in a request to his supplier for such items and gets them with the next set of stock. At least in Divinity: Original Sin, your party is a duo of Source Hunters, effectively a magical SWAT Team. You're on a mission to take on the nastiest and most powerful foes around. The least your allies in town should do is heed your request for better gear for sale!

-Using this preferential preorder may have special prerequisites, such as a gold fee. It may require a certain reputation with this vendor or completion of a certain quest. In mechanical terms, this is balanced due to needing to wait for the next stock for the item to appear, and the player may receive a comparable or better item in the meantime. (Preorder items stay in the vendor's inventory, just like items sold to them currently do.)

-This preferential preorder may be augmented during play for a variety of reasons. This may mean getting more item priorities (staves, potions, etc.), more item types to choose when prioritizing, the prioritization of item rarities, faster restock times, and so on.

-For items that come in multiple rarities, vendors have a certain number of items they sell of each rarity. If a vendor can sell legendary items, he will have at least 1 to sell at each restock. For example, instead of getting 10 new items at each restock of any possible rarity, he will instead have 5 common item slots, 2 magic item slots, 2 rare slots, and 1 legendary slot. This can change due to level, reputation with this vendor, quest completion, and so on. (I would also apply this change to chests, containers, and drops from bosses so there is less incentive to save scum. Drops from normal creatures should remain as-is.)

-For items that come in only one rarity, such as scrolls, potions, skillbooks, food, and crafting ingredients, these are generated as a separate category than above. Thus, if a vendor specializes in ranger skillbooks (1 rarity), ranger armor (3 rarities), special arrows (1 rarity), and arrow crafting materials (2 rarities), he will have a certain number of each item category available per restock. Each category will have a certain number of item slots per rarity.

-A balancing factor preventing players from purchasing an overabundance of high-end items (like legendary items) is the gold cost. These things are expensive!

-Remove contradictory item bonuses. A bonus to the Shield Specialization skill won't appear on a 2-handed weapon, but can appear on a shield, 1-handed weapon or another piece of gear (bracers, for example).

-At each dedicated skillbook vendor, there are always <maximum party size> number of each skillbook available per restock, arranged by type (earth magic, rogue skills, etc.) then in ascending alphabetical order. Skillbooks are still level-limited as they are now. Thus, a level 12 character will only find skill books requiring level 13 and below. General vendors operate as they do now, offering a random number of a random variety of level-appropriate skillbooks.

Goals and Effects of My Suggestions

-Frustration and save scumming are reduced. Fun and engagement are increased. From the proper vendors, skillbooks are always available, items of the appropriate rarities are always available, and people can focus more on the fighting, story, crafting, and interesting bits and less on the undesired bits.

-All games will go faster and more smoothly due to needing fewer reloads to achieve the desired effect.

-Character and party power are more consistent between playthroughs. While Party A may get more items that fit with their party goals in a certain number of reloads than Party B (like more +Intelligence and +Speed gear in a mage-heavy party), both parties will get access to the same number of high-end items, such as rares and legendaries and uniques. This interparty item equilibrium will drastically level the playing field between playthroughs.

-The game may become slightly easier due to the more consistent item availability.

-Due to preordering being most useful to a party that is already mostly equipped, preordering will likely ease or remove the mid-game item slump caused by a lack of interesting new gear to obtain. Getting gear is meant to be exciting, after all!

-If players can preorder items immediately before leveling, quickly gain a level, then get what they ordered, they have effectively removed any time penalty for preordering.  If this is problematic, add a delay before the new item appears or/and charge a rush delivery fee.  If this is not problematic (as I believe), let it happen.  Preordering is meant to reduce frustration over random shop inventories!

-Thematically, the notion of expanding preorder options is wroughting order from chaos.

Latest Jobs

IO Interactive

Hybrid (Malmö, Sweden)
Gameplay Director (Project Fantasy)

Arizona State University

Los Angeles, CA, USA
Assistant Professor of XR Technologies

IO Interactive

Hybrid (Copenhagen, Denmark)
Animation Tech Programmer

Purdue University

West Lafayette, IN, USA
Assistant Professor in Game Design and Development
More Jobs   


Explore the
Advertise with
Follow us

Game Developer Job Board

Game Developer


Explore the

Game Developer Job Board

Browse open positions across the game industry or recruit new talent for your studio

Advertise with

Game Developer

Engage game professionals and drive sales using an array of Game Developer media solutions to meet your objectives.

Learn More
Follow us


Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more