Docs/Recipes/Tycoon economy
Recipe: Tycoon economy
Passive income with upgradeable rate. A timer ticks every second, awarding coins per player. Upgrades buy more income per tick.
Last updated 2026-06-06
Ingredients
- Variable
coins— int, player, persist on, default 0. - Variable
income_rate— int, player, persist on, default 1. - Config
upgrade_cost— int, default 50. - UEFN devices: 1 HUD Message device, 1 Button Device per upgrade station.
Build it
Two variables, one config
coinsandincome_rateare both per-player, persistent — the tycoon survives reconnect. Configupgrade_coststays designer-tunable.Tick income every second
WHEN Repeat Every 1.0s → DO Increment Variable coins by income_rate, Show Variable HUD coins. TheRepeat Everyevent fires on a loop; the increment reads the current rate per tick.Upgrade button — can afford
WHEN On Button Pressed IF Compare variable coins ≥ upgrade_cost → DO Decrement Variable coins by upgrade_cost, Increment Variable income_rate by 1, Show HUD "Income up!".Upgrade button — can't afford
WHEN On Button Pressed IF Compare variable coins < upgrade_cost → DO Show HUD "Need more coins".
💡 Tip
coins top-right. Show income_rate as a smaller label below — players need to see what their upgrades bought.Generated Verse
OnBegin<override>()<suspends>:void=
loop:
Sleep(1.0)
for (Player : GetPlayspace().GetPlayers()):
if (Agent := player[Player]):
SetCoins(Agent, GetCoins[Agent] + GetIncomeRate[Agent])
HUDMessage.Show(Agent, FormatCoins(GetCoins[Agent]))
Variations
Prestige
Add a prestige_level variable. A “Prestige” button resets coins + income_rate to defaults but increments prestige — and prestige multiplies all future income. Classic tycoon loop.
Tiered generators
Multiple buttons for different rates: Solar (+1), Wind (+5), Nuclear (+25), each with own cost. Independent variables (has_solar etc.) gate purchase.
Offline catch-up
Track last_seen_time on disconnect; on rejoin, award (now - last_seen) * income_rate coins capped to N hours.
Gotchas
⚠️ Watch out
⚠️ Watch out
coins persists but not income_rate, returning players lose their upgrades — and rage-quit.See also