Item Sinks & Base Cost Scaling
This document details the economic design regarding resource inflation, item consumption mechanisms, and the scaling formulas for streamer room costs.
⚖️ Streamer Base Cost Scaling
To ensure fair progression, a streamer’s room construction and upgrade costs must scale with their channel size. However, we must prevent exploits (such as a streamer starting/ending streams to lower viewership averages or hosting short private streams to build cheaply).
graph TD A[Twitch API: GET /streams] -->|Polled Every 10 Mins While Live| B[Store Viewer Count Snapshots] B -->|Weekly Calculation| C[Calculate Rolling 30-Day Avg Viewers] C --> D{Determine Streamer Bracket} D -->|Bracket 1: 0 - 20 Viewers| E[Room Cost Modifier: 1.0x] D -->|Bracket 2: 21 - 100 Viewers| F[Room Cost Modifier: 2.5x] D -->|Bracket 3: 101 - 500 Viewers| G[Room Cost Modifier: 5.0x] D -->|Bracket 4: 501+ Viewers| H[Room Cost Modifier: 10.0x] E & F & G & H --> I[Apply to Room Project Cost]
The 30-Day Historical Average Viewership Bracket
- The Mechanic: Because Twitch’s public Helix API does not expose historical or averaged viewership statistics directly to third-party developers, the Master Server tracks and calculates this internally:
- Whenever a streamer’s Godot overlay client is connected, the Master Server polls the Twitch Helix API
GET /streams?user_id=...endpoint every 10 minutes. - The server only logs a viewer_count snapshot if the stream is actively live on Twitch (i.e.
GET /streamsreturns a valid active stream object). - If the Godot client is running offline (e.g. for testing, configuring layouts, or room upgrades off-stream), those snapshots are discarded to prevent 0-viewer periods from artificially dragging down the average.
- Every week, the Master Server aggregates these live-only snapshots over the last 30 days to calculate a stable rolling average.
- Pruning Historical Data: To prevent database bloat and eliminate “data trash,” the Master Server automatically deletes all snapshot records that are older than 30 days during the weekly recalculation job. Only the active 30-day window is retained.
- Whenever a streamer’s Godot overlay client is connected, the Master Server polls the Twitch Helix API
- The First-Week “Cold Start”: When a streamer first registers, we have no historical data. To prevent large streamers from immediately exploiting low-tier costs during their first week, the server performs a Follower-Based Estimate:
- The server queries
GET /channels/followersfor the streamer’stotalfollower count. - Followers map to starting brackets: followers = Tier 1 (1.0x), followers = Tier 2 (2.5x), followers = Tier 3 (5.0x), followers = Tier 4 (10.0x).
- After 7 days of live session logging (or once 10 hours of active stream time is logged), the server transitions the streamer to their actual calculated 30-day average viewership tier.
- The server queries
- Viewership Brackets: Based on the active tier, streamers are assigned their construction cost modifier (e.g., a Level 2 Blacksmith costs 100 Stone for a Tier 1 streamer, but 500 Stone for a Tier 3 streamer).
- Anti-Exploit Security:
- Once established, the viewership rolling average is highly stable. Starting short streams, ending early, or streaming privately has virtually zero impact on their cost tier.
- To lower their tier, a streamer would have to broadcast to an empty chat for weeks, which completely defeats the purpose of streaming.
🕳️ Core Item & Material Sinks
To prevent resource inflation and keep gathering/crafting satisfying without relying on long, boring time-cooldown gates, we implement several sinks:
graph TD subgraph Sinks for Raw Materials A[Room Maintenance Upkeep] B[Combat Traps & Barricades] end subgraph Sinks for Consumables C[Tavern Feasts: Community Potluck] end subgraph Sinks for Equipment D[Blacksmith Salvaging] E[Brittle Shatter Mechanic] end
1. Room Maintenance Upkeep (Continuous Passive Sink)
Rooms are not “build and forget.” To keep their passive bonuses active, rooms require continuous upkeep.
- Weekly Cost: Every week, active rooms consume a small amount of raw or processed materials (e.g., the Tavern consumes 100 Planks and 50 Wheat; the Guard Tower consumes 20 Iron Ore for ammo).
- Decay: If the community fails to donate enough upkeep materials to the Bank/Treasury before the weekly deadline, the room’s passive bonuses decay or disable until repaired.
2. Tavern Feasts (Consumable Potluck Sink)
Instead of viewers only eating bread or fish individually, they can pool their food into a community event.
- The Feast Event: Viewers donate large quantities of food and drinks (e.g., 500 Bread, 200 Fish, 100 Beer) to the Tavern.
- The Reward: Once the goal is reached, a grand visual feast table is rendered on the streamer’s overlay. All resting characters gain a massive XP/Stat buff (e.g. +50% XP gain) for the next 2 hours. This acts as a massive sink for farmable consumables.
3. Active Combat Traps (Real-Time Sink)
During waves, viewers can spend raw resources (Wood, Stone, Iron) in real-time via the extension/standalone client to build temporary combat elements:
- Spike Traps (Wood/Iron): Damages and slows ground monsters.
- Barricades (Stone/Wood): Intercepts and blocks enemy pathfinding.
- Explosive Barrels (Flour/Mana): Deals massive area-of-effect damage when shot.
- Sink Effect: These traps are consumed or destroyed by the end of the wave, encouraging players to constantly dump raw materials during fights.
4. Blacksmith Salvaging (Equipment Sink)
When players craft surplus equipment while hunting for high-tier rolls (Rare/Epic/Legendary), their bags fill with junk.
- Recycling: Players can take any piece of gear to the Forge and salvage it.
- Yield: Salvaging deletes the item and returns a small percentage of its base refined materials (e.g., salvaging an Iron Sword returns 30% of the Iron Bars used), draining the net amount of metal in the economy.