Guide

Game shop and vendor systems explained

Harbor Outpost's playtest economy inflated within a weekend. Players mined iron, crafted daggers at the beach forge, and sold every blade back to the same general merchant at 80% of list price — net gain with no travel risk. Gold in circulation doubled; tier-two gear felt meaningless because everyone could afford it on day two. The fix was not nerfing ore drops. It was a vendor layer with asymmetric buy/sell spreads, daily purchase caps on finished weapons, and a rotating black-market buyer who paid premiums for surplus but only accepted five stacks per server day. Shops became sinks, not ATMs.

A shop or vendor is any NPC or UI surface that exchanges items for currency (or barter goods) under authored rules. Vendors sit between gathering and crafting on the supply side and player power on the demand side. This guide covers catalog schemas, buy and sell pricing, stock refresh and scarcity, currency sinks, reputation and discount hooks, UI patterns, multiplayer authority, the Harbor Outpost trading post refactor, a technique decision table vs barter and player markets, pitfalls, and a production checklist.

Vendor anatomy: catalog, currency and transaction FSM

Every vendor instance shares the same core data model, even when presentation differs (dialogue tree, grid UI, or world interactable):

Component Purpose Design notes
Buy catalog Items the player can purchase Static list, level-gated rows, or procedural rotation
Sell list Item categories the vendor accepts Often broader than buy catalog; may exclude quest items
Price table Base value per item or category Usually derived from a global item value registry
Spread multipliers Buy price vs sell price Typical sell-back is 25–50% of buy; spreads fight arbitrage loops
Stock counters Per-item or per-category limits Finite stock creates urgency; infinite stock needs sinks elsewhere
Refresh schedule When stock and prices reset Server midnight, playtime hours, or story chapter triggers

The transaction finite-state machine is simple but must be atomic on the server: validate item and currency, deduct cost, grant item to inventory, log for analytics, broadcast UI refresh. Roll back entirely on any failure — partial grants duplicate currency or items under packet loss.

Pricing: base value, spreads and dynamic modifiers

Start from a single item value column in your content database (often tied to crafting ingredient cost plus a rarity multiplier). Vendor prices are functions of that base, not one-off magic numbers per merchant.

Common formula for sell price (vendor to player):

P_buy = base_value × vendor_markup × (1 − reputation_discount) × scarcity_multiplier

Sell-back price (player to vendor):

P_sell = base_value × sell_ratio × condition_factor

If P_sell × crafting_efficiency > gathering_cost for any loop, players will farm the loop until inflation breaks progression. Harbor Outpost set sell_ratio = 0.35 on weapons and 0.55 on raw ore so crafting stayed attractive but finished goods were not cash printers.

Dynamic pricing adjusts multipliers from world state: surplus herb stacks lower buy prices at the apothecary; siege week raises ammo costs. Keep changes visible in UI (“High demand +20%”) so players understand shifts. Hidden dynamic pricing feels like arbitrary nerfs.

Link high-value purchases to economy sinks: repair fees, fast-travel tolls, and property taxes recycle gold that vendors inject.

Stock rotation, scarcity and progression gating

Infinite stock on every row turns vendors into catalog browsers with no pacing. Useful scarcity patterns:

  • Finite daily stock — three healing kits per server day; encourages planning or visiting multiple settlements.
  • Tier unlocks — armorer sells iron gear after chapter two; gates power without hard level walls.
  • Rotating specials — one discounted row per real day; drives return visits in live-service titles.
  • Player-flooded categories — vendor stops buying more bread when the town storage is full; signals oversupply.

Scarcity must match your content cadence. A 40-hour RPG can use chapter-gated catalogs; a survival sandbox needs frequent refresh or player-to-player trade outlets so late joiners are not locked out of basics.

UI patterns: grid shop, dialogue merchant and quick-sell

Presentation shapes how exploitable the economy feels:

  • Grid shop — sortable columns, cart preview, compare stats. Best for looters and RPGs with large catalogs.
  • Dialogue merchant — bark lines and branching “What do you have?” trees. Slower but immersive for narrative games.
  • Quick-sell from inventory — shift-click junk to sell; requires clear sell-ratio display and undo buffer for mis-clicks.
  • Buyback tab — last N sold items repurchasable at sell price; reduces frustration without opening arbitrage if buyback expires on shop close.

Show buy price, sell price, and net stack value before confirmation. Players should never discover a 12-gold spread after selling 40 ore stacks. Highlight quest and unique items as non-sellable before the sell action, not after.

Multiplayer authority and duplication safety

In shared worlds, vendor state is server-owned: stock counters, daily purchase limits, and rotating specials must not live on the client. Two players buying the last legendary schematic should produce one winner and one sold-out message, not two copies.

Serialize transactions per player to prevent race double-spend: debit currency, then grant item inside one database transaction or inventory lock. For instanced vendors (personal housing shop), scope stock to player ID so friends cannot drain each other's garden seeds.

Log every purchase and sale with item ID, quantity, price, vendor ID, and timestamp. Economy exploits are easier to replay and refund from ledgers than from crash dumps.

Harbor Outpost refactor: from gold printer to trading post

The Harbor Outpost trading post rollout had four pillars:

  1. Global item registry — one base_value per item; all vendors reference it. Crafting costs sum ingredients plus 15% labor premium.
  2. Asymmetric spreads — weapons sell-back at 35%, mats at 55%, consumables at 45%. Closed the craft-sell loop that doubled gold.
  3. Rotating surplus buyer — NPC appears at the dock every six hours, pays +25% on two random categories, cap five stacks per player. Sinks excess without permanent high sell ratios.
  4. Reputation discounts — +5% buy discount per faction tier, capped at 15%. Rewards engagement without free gear.

Playtest two inflation metrics weekly: median gold held per hour played and percentage of players who can afford the next tier weapon within one session of its unlock. Adjust spreads before drop rates.

Technique decision table

Approach Economy control Player friction Best when Avoid when
Fixed NPC vendor High (author sets every price) Low Single-player RPG, curated progression Player-driven barter is core fantasy
Dynamic spread vendor Medium (self-balancing surpluses) Medium Survival sandboxes, crafting-heavy loops Players need predictable plan-ahead costs
Player auction house Low (market sets price) High UI complexity MMOs, rare cosmetic trading Small co-op player counts, RMT risk
Pure barter (no currency) High but opaque High Narrative scarcity, post-apocalyptic tone Large catalogs, compare-at-a-glance shopping
Auto-sell loot vacuum Low (floods currency) Very low Action titles, horde modes Economy pacing and crafting relevance matter

Pitfalls

  • Craft-sell arbitrage — if crafting cost < sell price, players mint gold. Audit every recipe against sell ratios.
  • One global merchant — buying and selling everything at one NPC removes geographic pacing and travel meaning.
  • Sell quest items — missing no_sell flags soft-lock progression when players offload keys.
  • Hidden fees — tax on top of displayed price erodes trust; show final total on the confirm button.
  • Client-side prices — tampered clients buy for zero; validate cost server-side every time.
  • Infinite buyback on consumables — players buy potions, use one, sell the rest at profit if ratios are wrong.

Production checklist

  • Define base_value for every tradable item in a central registry.
  • Set sell_ratio and vendor_markup per category, not per row.
  • Simulate top three crafting loops for net gold per hour at current spreads.
  • Mark quest, unique, and equipped items as non-sellable in data, not only UI.
  • Implement atomic server transactions: debit, grant, log in one step.
  • Scope stock counters (global, per-player, or instanced) and document refresh rules.
  • Display buy, sell, and stack totals before confirm; support buyback where appropriate.
  • Wire reputation or faction discounts with a hard cap.
  • Pair vendor gold injection with at least one active sink (repairs, fees, upgrades).
  • Export purchase/sale ledger for economy dashboards each build.

Key takeaways

  • Vendors are economy valves, not loot converters — buy/sell spreads must prevent craft-sell arbitrage.
  • A central item value registry keeps pricing consistent across merchants and patches.
  • Stock rotation and purchase caps create pacing without nerding gathering.
  • Server-authoritative transactions and ledgers are mandatory in multiplayer.
  • Harbor Outpost fixed inflation with asymmetric spreads and a rotating surplus buyer, not ore nerfs.

Related reading