Simulating a Dynamic Economy in Unreal Engine 5 (Blueprints Only)

In this series of posts I’d like to share practical insights on how to set up an economic simulation in Unreal Engine 5.3 using Blueprints only. It’s part of my work on Cargo, a survival-trading game set in the Arctic, inspired by 19th-century polar expeditions.

In this post, I will share a practical approach to make prices in the game change dynamically.

In most games, NPCs will sell or buy items for the same price all the time. In my game, I want the prices to react to supply and demand during gameplay, so I needed to come up with a price function.

Project context

Cargo is a single-player trading and survival game where isolated settlements in the Arctic depend on merchants for goods they cannot produce themselves. Each settlement produces a small number of resources but must import everything else.

Design goal

  • If a player buys large quantities of a good, the price of that good should rise.

  • If he floods a settlement with goods, prices should fall.

  • Some goods react more extreme to scarcity than others.

  • Severe shortages create steep price spikes, and so the player must think strategically what and when to buy or sell something.

Calculations

For each good at a settlement, I calculate:

Demand (Dt) = (Ideal Storage − Current Storage) + Consumption

Supply (St) = Storage + Vendor Inventory

Each good also has a Base Price (BP) that I set up in an Excel Sheet and import into the project via DataTable.

The resulting price function is:

Pt = BP * (1 + k * log(1 + Dt / (St + 0.01)))

  • k controls price sensitivity
  • 0.01 prevents division by zero
  • log ensures non-linear behavior: Small early price changes when shortages are mild, steep price spikes under extreme scarcity. In player terms, selling the first few units barely matters but selling the last few units changes a lot.

Implementation in Blueprints

In Unreal Engine 5, this logic lives entirely in Blueprints:

  • A BP “Economist” checks how many items of a good are in BP Storage and in the vendors inventories (= output of function “Get Supply”)

  • Demand is calculated via a function (“Get Demand”)

  • BasePrices are imported via a DataTable

  • “k” is part of a struct variable on a good

  • a function on BP Economist calculates the price of any good at any moment (see graph below)

I am calling the function when:

  • the player opens the vendor UI
  • after the player buys or sells something

How you could use it in your game

To give you a practical example: Let’s take a good like “iron” , with a base price of 5, a demand of 40, and a supply of 20, the resulting price would be ca. 6.65, a noticeable increase to 5, because the settlement has a higher demand then supply (but it’s not an extreme spike). But if the supply drops to 5, the price would increase to 8.30, which reflects scarcity pretty well.

If you’re working on a trading or simulation game and have tackled dynamic pricing in UE, I’d love to hear how you approached it.