Docs/Examples/Sorcerer Duel

Sorcerer Duel (Arcane Circle Duels)

Continuous autonomous duels with VRF-weighted outcomes and mana attrition.


Overview

Sorcerer Duel is a persistent arcane-circle loop where duels resolve autonomously on a fixed schedule. Sorcerers lose mana every duel, creating a negative-EV game that nobody self-triggers.

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

Why AutoLoop Is Structurally Required

Two independent reasons:

  1. Timing as attack surface: if a duelist could trigger the duel, they could pick the block in which the VRF reveal lands and only submit if their sorcerer benefits.
  2. Negative-EV free-rider: every duelist loses 5-20 mana per duel, only one wins the pot. Rational sorcerers reason "let someone else pay gas." Everyone reasons identically, so nobody triggers.

Game Mechanics

  • Sorcerers: summoned at a fixed fee with initial mana (e.g., 500). Mana decreases with each duel via VRF-derived drain.
  • Duels: require 2+ duelists. Each duelist pays an entry fee. Winner is selected proportionally to mana (weighted VRF).
  • Mana drain: 5-20 mana per duel for every duelist, derived from keccak256(randomness, sorcererId, "drain"). Sorcerers hitting minMana are banished.
  • Prize pool: entry fees minus protocol rake. Winner receives via pull-payment.

Revenue Model

  • Sorcerer summon fees (100% to protocol)
  • 5% rake on every duel prize pool
  • AutoLoop gas fees on each tick

Deploy

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

Args: summonFee, entryFee, duelInterval, protocolRakeBps, initialMana, minMana, maxDuelists.

Dashboard

Play Sorcerer Duel on the AutoLoop Dashboard.