Skip to content
RÆGROK

Engineering an Automated OBS Studio + Streamer.bot Subathon Setup

The full RÆGNATHON architecture: a Streamer.bot-driven subathon timer, event-to-seconds math, OBS scene automation, crash recovery, and a live leaderboard sync. All of it runs locally for $0.

BY RAEGROKPUBLISHED UPDATED
  • #Streamer.bot
  • #OBS Studio
  • #Subathon
  • #Automation
  • #C#

Placeholder values are marked EDIT:. Swap in your own rates, scene names, and variable names before going live.

What does the subathon architecture look like?

RÆGNATHON runs on three layers, and each one has a single job:

Layer Owns Never does
Streamer.bot Timer state, event → seconds math, goals, chat commands Rendering
OBS Studio Scenes, the timer text source, alerts Any math
Cloudflare (optional) Public leaderboard at /leaderboard Anything on the critical path

The timer only ever lives in Streamer.bot. OBS displays whatever Streamer.bot tells it, so an OBS crash costs you zero seconds.

How do you build a crash-proof subathon timer?

Persist one global variable, subathonEndUtc, as an ISO timestamp. Everything else derives from it.

// Action: "Subathon · Add Time"  (args: seconds)
public class CPHInline
{
    public bool Execute()
    {
        int add = Convert.ToInt32(args["seconds"]);
        var end = DateTime.Parse(CPH.GetGlobalVar<string>("subathonEndUtc", true) ?? DateTime.UtcNow.ToString("o")).ToUniversalTime();
        if (end < DateTime.UtcNow) end = DateTime.UtcNow;

        var cap = DateTime.Parse(CPH.GetGlobalVar<string>("subathonCapUtc", true)).ToUniversalTime(); // EDIT: hard stop
        var next = end.AddSeconds(add);
        if (next > cap) next = cap;

        CPH.SetGlobalVar("subathonEndUtc", next.ToString("o"), true);
        return true;
    }
}

A Timed Action runs every second, computes end − now, and pushes a formatted HH:MM:SS to OBS:

var remaining = end - DateTime.UtcNow;
if (remaining < TimeSpan.Zero) remaining = TimeSpan.Zero;
CPH.ObsSetGdiText("RÆGNATHON", "Timer Text", $"{(int)remaining.TotalHours:00}:{remaining.Minutes:00}:{remaining.Seconds:00}");

How should events convert into seconds?

Route every trigger (Sub, Resub, Gift Sub, Cheer, Tip) into the same Add Time action and set the seconds argument per trigger. With one entry point, you can tune or pause the whole economy in one place.

Event Seconds (EDIT:)
Tier 1 sub / resub 60
Tier 2 120
Tier 3 300
100 bits 12
$1 tip 12

Gift bombs fire one Gift Sub event per recipient. Check isAnonymous and the fromSubBomb arg so you don’t count a bomb twice.

How do OBS scenes stay in sync automatically?

  • Put the timer, the goal bar, and the “next goal” text in a nested scene called RÆGNATHON HUD. Every gameplay scene includes it, so there’s only one source of truth.
  • Streamer.bot’s OBS → Set Source Visibility shows the HUD when subathonActive = true and hides it otherwise.
  • Goals are a sorted list in a global variable. After every Add Time, a sub-action checks total subs against the next goal and fires a chat message and an OBS media source.

How do you sync the HÆRTH leaderboard to the website?

The public leaderboard at /leaderboard is fed by a single C# action. It reads each viewer’s persisted points, sorts them, and POSTs the top 100 to /api/leaderboard with a Bearer secret. Trigger it every 10 minutes and once on Stream Offline. The full code is in the download below and in STREAMERBOT_SETUP.md.

What breaks first during a 72-hour stream?

  1. Memory creep in browser sources. Refresh alert and overlay browser sources every 6 hours with a Streamer.bot OBS Raw call.
  2. Disk space. Recordings at CQ 20 AV1 come to about 4–6 GB/hour. Use Source Record with splitting or a dedicated drive.
  3. You. Schedule a sleep scene with a visible timer and let chat watch the clock. The time keeps counting either way.

Free download · 1 click

Leaderboard Sync Action (C#)

leaderboard-sync-action.cs.txt

↓ Download

Questions

Why store an end timestamp instead of counting down seconds?

A countdown only lives in memory, so a crash or restart wipes it. A persisted UTC end timestamp gives remaining time as end minus now on every tick, and it survives Streamer.bot restarts, PC reboots, and OBS crashes.

Does this need any paid plugins or services?

No. It uses OBS Studio, Streamer.bot, and a single text source. The optional public leaderboard runs on Cloudflare Pages Functions and KV inside the free tier.

How much time should a sub add during a subathon?

Start with Tier 1 = 60 s, Tier 2 = 120 s, Tier 3 = 300 s, 100 bits = 12 s, and $1 tipped = 12 s. Then cap the total with a hard maximum end time so the event stays sustainable.