Everchanging Grimoire
# Everchanging Grimoire
A 2D top-down roguelite dungeon crawler built in Unity for **Melbourne Hackiethon 2026** (theme: *Integrate an LLM into a Game*).
The dungeon is a sentient, hungry book called the Grimoire. You are a Seeker — drawn by the promise of power, now trapped inside its pages. After every floor, the **Gemini API** reads how you played and generates the next floor's theme, enemies, and a new spell designed to counter your playstyle. The game runs indefinitely with escalating difficulty. There are no boss stages — just continuous escalation.
---
## How the LLM Works
The game uses **Gemini's function calling** (structured tool use) to enforce strict JSON schema responses.
**After each floor, the game sends Gemini:**
- Stage number, combat style, dominant element, damage sources
- HP remaining/lost, time spent clearing the floor
- Full details of every equipped spell (name, tags, damage, speed, cooldown, element)
- The previous floor's manifest (for narrative continuity)
**Gemini returns a Floor Manifest containing:**
- Floor name and tileset
- Enemy spawns (archetype IDs + modifier flags like `armored`, `berserk`, `elemental_immune`)
- A new spell with composed behavior tags
- A narrative `stage_message` from the Chronicle (the Grimoire's voice)
- Player HP scaling
Stage 1 is always a fixed handcrafted floor so the first Gemini call has real session data to react to.
**Spell icons** are generated via Nano Banana (Gemini image generation) from each spell's name, tags, and element.
---
## Spell System
Spells are pure data — no runtime code generation. The engine has handlers for ~60 behavior tags across movement types, trajectory modifiers, on-impact effects, status effects, and corruption tags. The LLM creates novel spells by composing new *combinations* of tags, producing emergent behaviors.
- **3 active spell slots** — quickswap with 1, 2, 3
- **Cursed spells** — powerful stats with a built-in downside (e.g. `SELF_DAMAGE`, `ENEMY_HOMING`)
- **Spell merging** — every 5 floors, fuse 2-3 spells into one that fires all components simultaneously
---
## Enemy System
Enemies are a fixed library of archetypes with coded behavior (melee charger, ranged sentinel, tank brute, fast skitter, exploder, shield bearer, healer drone, mimic shade, and more). The LLM decides *which* enemies appear, *how many*, and *what modifiers* to apply based on how you've been playing.
---
## Map System
Floors are assembled from handcrafted **20x20 chamber prefabs** in a **4x2 grid** (80x40 total). Each of the 10 tilesets (acid, bubblegum, dungeon, flames, forest, frozen, honey, ocean, rocky, techy) has 8 unique chambers. Gemini picks the tileset; chambers are randomized from that set.

Leave a comment
Log in with itch.io to leave a comment.