✨ ARCANUM RUNE DIFFICULTY: Adept Structural

The Flyweight of Swarm Familiars

Sharing state among a massive swarm of familiars to minimize mana cost.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Flyweight
ARCANUM SCHOOL: Conjuration // Swarms
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
module Flyweight

type familiar_type = { species: string; base_mana: nat }

let bee_type = { species = "Arcane Bee"; base_mana = 1 }

type familiar_instance = {
  shared: familiar_type;
  x: int;
  y: int;
}

let spawn_bee (x y: int) : familiar_instance =
  { shared = bee_type; x = x; y = y }

Using shared records for intrinsic state allows the summoning of massive swarms of familiars without exhausting the caster’s mana.

Runic Tags: #flyweight #optimization #swarms