VerseBuilderDocs

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

  1. Two variables, one config

    coins and income_rate are both per-player, persistent — the tycoon survives reconnect. Config upgrade_cost stays designer-tunable.
  2. Tick income every second

    WHEN Repeat Every 1.0s → DO Increment Variable coins by income_rate, Show Variable HUD coins. The Repeat Every event fires on a loop; the increment reads the current rate per tick.
  3. 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!".
  4. Upgrade button — can't afford

    WHEN On Button Pressed IF Compare variable coins < upgrade_cost → DO Show HUD "Need more coins".

💡 Tip

Anchor the HUD widget showing 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

Timer must use Repeat Every, not OnBegin + Sleep. The atom emits the right looping subscription; rolling your own with Sleep can desync per-player.

⚠️ Watch out

Persist both variables. If only coins persists but not income_rate, returning players lose their upgrades — and rage-quit.

See also