Docs/Examples/Gladiator Arena

Gladiator Arena (Always-On Colosseum)

Continuous autonomous bouts with VRF-weighted outcomes and vitality attrition.


Overview

Gladiator Arena is a persistent colosseum loop where bouts resolve autonomously on a fixed schedule. Gladiators take wounds every bout, creating a negative-EV game that nobody self-triggers.

PropertyValue
Base contractAutoLoopVRFCompatible
VRF usageEvery tick (full VRF)
Gas per tick~73k (4 entrants) to ~93k (8 entrants)
Sourceautoloop/src/games/GladiatorArena.sol
Tests44 passing (unit + fuzz)

Why AutoLoop Is Structurally Required

Two independent reasons:

  1. Timing as attack surface: if an entrant could trigger the bout, they could pick the block in which the VRF reveal lands and only submit if their gladiator benefits.
  2. Negative-EV free-rider: every entrant takes 5-20 vitality wounds per bout, only one wins the pot. Rational gladiators reason "let someone else pay gas." Everyone reasons identically, so nobody triggers.

Game Mechanics

  • Gladiators: minted at a fixed fee with initial vitality (e.g., 500). Vitality decreases with each bout via VRF-derived wounds.
  • Bouts: require 2+ entrants. Each entrant pays an entry fee. Winner is selected proportionally to vitality (weighted VRF).
  • Wounds: 5-20 vitality per bout for every entrant, derived from keccak256(randomness, gladiatorId, "wound"). Gladiators hitting minVitality fall.
  • Prize pool: entry fees minus protocol rake. Victor receives via pull-payment.

Revenue Model

  • Gladiator mint fees (100% to protocol)
  • 5% rake on every bout prize pool
  • AutoLoop gas fees on each tick

Deploy

forge create src/games/GladiatorArena.sol:GladiatorArena \
  --constructor-args 10000000000000000 1000000000000000 60 500 500 50 8 \
  --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast

Args: gladiatorMintFee, entryFee, boutInterval, protocolRakeBps, initialVitality, minVitality, maxEntrantsPerBout.

Keeper Trust Model

Participants cannot predict or influence VRF outcomes — the keeper's private key is required to generate a valid proof. The keeper knows its own output before submission but has no stake in who wins (it earns a gas fee regardless of the result).

Multiple independent controllers are registered per contract, each producing a different VRF result for the same seed. If one withholds its submission, another submits with a completely independent outcome. Manipulating the final result requires ALL registered controllers to collude simultaneously.

VRF Key Registration

After deploying, register each controller worker's ECVRF public key:

gladiatorArena.registerControllerKey(controllerAddress, pkX, pkY);

Without registration, VRF proof verification reverts on every tick. Use register-vrf-keys.js in the AutoLoop worker:

NETWORK=sepolia VRF_CONTRACTS=<gladiatorArenaAddress> node scripts/register-vrf-keys.js

Dashboard

Play Gladiator Arena on the AutoLoop Dashboard.