RUGENDOCS
Hosting rugen-server

Packages & legal

How the server stores the character packages players bring, how long it keeps them, and what you are responsible for as an operator.

When two players bring different characters, the server passes each fighter’s files to the other player (see Bring your own character). Those files are stored on the server as packages.

What a package is

The fighter’s content file, as players have it: a .rgc (a stage: .rgs) with sprites pixel-exact and sounds as Opus (see Content files), named by its fingerprint: packages/<fingerprint>.rgc in the data volume. rugen 0.5 players still upload the older RGPK packages (packages/<fingerprint>.rgpk, a different fingerprint for the same character); the server keeps serving those to 0.5 clients only (see Mixed versions).

  • Uploads are resumable, in 2 MB chunks, and only happen when the server does not already hold that fingerprint.
  • The server opens every upload in place (0.5 packages: unpacks them into scratch space) and recomputes the fingerprint and fairness profile. A mismatch fails the match and flags the account.
  • Uploads are only accepted for a fighter the account declared in a live matchup, capped per package (RUGEN_PKG_MAX) and per hour per account (RUGEN_PKG_RATE_ACCOUNT) and per IP (RUGEN_PKG_RATE_IP).
  • Uploads need the player’s consent: the game asks once per server (see Your fighters online) and then sends consent=1 with every chunk. A player who answered NOT NOW uploads nothing: their picks say so (uploads: false), the matchup lists those fingerprints as offline, and the match starts without them on the server once both players report every file locally.

Older games

rugen 0.6.0 to 0.6.3 predate the consent dialog and never send the flag: the server keeps accepting their uploads as before, so they keep working. A game that announces 0.6.4 or later (its User-Agent) must send consent=1; anything else is refused with online consent required. The other changes are additive JSON fields older games ignore: pkg_days in /health, offline in the matchup view, uploads on a pick and reason on leaving a matchup. GET /pkg/{fp}/url (the bucket download) is new and only rugen 0.6.4+ calls it.

Temporary caches

Packages are temporary caches, not a library:

  • Every package is deleted RUGEN_PKG_DAYS (default 3) days after its upload, however often it is used and even when a replay refers to it. This is what players agree to: /health sends the number (pkg_days) and the game’s consent dialog shows it.
  • Before that, a package expires RUGEN_PKG_TTL after its last use (default: the same 3 days; never longer than RUGEN_PKG_DAYS).
  • Above RUGEN_PKG_MAX_TOTAL (default 5 GB) the least recently used go first; packages of stored replays go last (RUGEN_PKG_REPLAY_TTL, default 720 hours, still capped by RUGEN_PKG_DAYS).
  • With RUGEN_BACKUP_INCLUDE=packages, a deleted package also leaves the backup bucket at the next backup.
  • The server never lists or publishes them; nothing outside a live match can download one (a bucket URL handed to a player expires after 15 minutes).

Serving packages from Cloudflare R2

Fighters are 5 to 70 MB each, and every download normally goes through your server. Set RUGEN_PKG_S3 and players download them straight from an S3-compatible bucket instead (Cloudflare R2 has no egress fees):

RUGEN_PKG_S3=s3://ACCESS_KEY:SECRET_KEY@<account>.r2.cloudflarestorage.com/rugen
RUGEN_PKG_S3_MAX_GB=8   # free-tier guard, default 8

It takes the same one-line URL as RUGEN_BACKUP_S3, and may point at the same bucket.

  • Every verified package is also copied, once, to <prefix>/chars/<sha256>.rgc (stages .rgs). The chars/ prefix is reserved for this; backups never touch it.
  • A rugen 0.6.4+ game asks the server where to download from and gets a presigned URL valid 15 minutes. It checks the file’s size and sha256, then installs it like any download (the fingerprint is recomputed).
  • Fallbacks: rugen 0.6.0 to 0.6.3 never ask and keep downloading from the server; so does any game when a package is not copied yet, the bucket answers an error or the check fails.
  • Expiry: objects are deleted with their packages, and anything older than RUGEN_PKG_DAYS goes at the next sweep (every 10 minutes). Add a lifecycle rule as a safety net: in the R2 dashboard, bucket settings, Object lifecycle rules, prefix chars/, delete objects 3 days after upload (match RUGEN_PKG_DAYS).
  • Free-tier guard: above RUGEN_PKG_S3_MAX_GB stored under chars/, new packages are not copied (the server serves them itself) until expiries make room. R2’s free tier is 10 GB.
  • /health and /admin/stats show packages_r2: configured, objects, bytes, max_bytes, full, pending, last_error, never the endpoint, bucket or keys.
  • Give the R2 API token Object Read & Write on that bucket only.

Something wrong on this page? Edit it on GitHub.

SEARCH !!

    ↑↓ to move, Enter to open