Vishnu Vennelakanti commited on
Commit
d8e5b40
Β·
unverified Β·
1 Parent(s): 5b5e1fd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +185 -2
README.md CHANGED
@@ -1,2 +1,185 @@
1
- # tabras
2
- tabras is a deck-builder rogue-lite where every single card and art is freshly generated each time.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Tabras
2
+
3
+ An AI-driven roguelite deckbuilder duel. The player and an AI-controlled enemy wizard each draft a 15-card deck from freshly-generated cards, then duel over three rounds. Every drafted card's effect-shape, name, flavor, and art is generated per run β€” no two runs share a deck. After a run, the cards are gone for good.
4
+
5
+ Built for the **Build Small Hackathon** (Gradio + Hugging Face), track: *An Adventure in Thousand Token Wood*. Constraint: every model ≀32B params, local-first, deployed as a Gradio app on a HF Space.
6
+
7
+ ---
8
+
9
+ ## Core invariant (do not violate)
10
+
11
+ **The LLM owns meaning; the engine owns math.**
12
+
13
+ The model chooses *which* effects a card has (from the fixed primitive vocabulary below, via tool call) and writes its name, flavor, and art prompt β€” in service of a coherent fantasy, aware of the deck being built. The **engine** assigns every numeric magnitude against a point budget.
14
+
15
+ The model NEVER sets final power values. This is what makes generated cards balanced-by-construction. Any code path where model output directly determines a damage/block/heal number is a bug. (The one bounded exception: "miracle" cards, where the engine rolls a wide but hard-capped budget multiplier.)
16
+
17
+ ---
18
+
19
+ ## Game rules (locked)
20
+
21
+ - **20 HP** per player.
22
+ - **Energy** ramps each turn (1 β†’ up to 5). Regenerating pool, no lands.
23
+ - **Paired-round turns:** each round both players act; a flip decides order within the round. Knowing/manipulating order is a mechanic (Ice's Initiative).
24
+ - **15-card deck:** 8 standardized backbone cards (same for all schools) + 7 LLM-generated synergy picks (drafted, deck-aware).
25
+ - **Deck-out:** no reshuffle. Drawing from an empty deck deals escalating fatigue damage (1, 2, 3, …) β€” a finishing clock, not a managed resource. Decks are damage-dense; you're expected to win before decking out.
26
+ - **Win:** reduce the opponent to 0 across a three-phase duel.
27
+
28
+ ### Damage anchor
29
+ `1 budget point = 2 damage` for a vanilla attack. All other primitive costs are relative to this.
30
+
31
+ ---
32
+
33
+ ## The 13 primitives (the spine β€” `primitives.py`)
34
+
35
+ The LLM composes cards by selecting from these and writing flavor; the engine assigns N against the card's budget. Costs below are STARTING values β€” linear primitives are set; multipliers are marked TUNE (overcost on first pass, tighten in playtest).
36
+
37
+ ### Damage / win-condition
38
+ 1. **Deal** β€” direct damage. `1 pt = 2 damage`. The anchor.
39
+ 2. **Burn** β€” deferred damage, X/turn for N turns (decaying or flat). Roughly on-rate; in a short game needs a slight premium to justify the delay. *Deferred-timer effect.*
40
+ 3. **Bomb** β€” big delayed burst: deal X in N turns, telegraphed. High-variance. TUNE. *Deferred-timer effect.* (Fire signature pick: 4 energy β†’ 9 damage in 3 turns.)
41
+
42
+ ### Defense / survival (a first-class, flexible axis β€” defense enables real strategic options, not just a tax)
43
+ 4. **Block** β€” temporary shield, this turn only. **Stacks.** `1 pt β‰ˆ 3 block` (defense priced slightly cheaper than damage).
44
+ 5. **Ward** β€” persistent shield. **Stacks. Expensive: `1 pt = 1 block`.** All-or-nothing: a ward can only be removed early by a *single hit meeting its threshold* β€” chip/multi-hit damage bounces off. The breaking hit is **fully absorbed** (a bubble that eats one decisive blow, then vanishes β€” excess does NOT carry to HP). [DEFAULT β€” override if you want break-through.] *Deferred/persistent-timer effect.*
45
+ 6. **Weak** β€” enemy deals Y less damage next turn. Defensive (damage-prevention). Prices like Block (linear). Mirror of Vulnerable.
46
+
47
+ > Heal is intentionally NOT a primitive (cut for pace β€” healing prolongs fights against the short-aggressive goal). Defensive flexibility comes from Block + Ward + Weak instead. Revisit only if playtest shows fights ending too fast.
48
+
49
+ ### Tempo / resource (do NOT price off the damage rate β€” price by what they enable; TUNE-ish)
50
+ 7. **Draw** β€” draw N cards. Price so it costs a tempo turn (backbone: 3 energy β†’ draw 2). Net card advantage but you skip board impact.
51
+ 8. **Energy** β€” gain X energy this turn (enables combo turns). Dangerous primitive; price slightly net-negative immediately so it's only worth it in combo decks. TUNE.
52
+ 9. **Initiative** β€” manipulate round order (opponent goes second next round). Bounded to one round. Prices as tempo, not damage. (Ice signature: 3 energy β†’ deal 2 + opponent second next round.) TUNE.
53
+
54
+ ### Multipliers & combo-glue (the depth β€” ALL TUNE, overcost on first pass; this is where broken combos live)
55
+ 10. **Multi-hit** β€” apply an effect N times. *Multiplies* the cost of what it hits. The single most dangerous primitive (multi-hit Γ— Deal or Γ— Burn). Overcost hard. Note: multi-hit chip CANNOT break a Ward (each hit is below threshold) β€” built-in school counterplay.
56
+ 11. **Vulnerable** β€” enemy takes X more damage for N turns. Offensive *multiplier* β€” combos with Deal/Multi-hit. Prices as a multiplier, not flat. TUNE.
57
+ 12. **Conditional** β€” "if [state], then bonus" (e.g., if enemy below half HP, +damage). Depth via sequencing; prices by how often the condition is live. TUNE.
58
+ 13. **Scaling** β€” effect grows with a counter (cards played this turn, damage taken, turns elapsed). Snowball primitive β€” overcost, runaway games start here. TUNE.
59
+
60
+ ### Vulnerable / Weak pair
61
+ Vulnerable (enemy *takes* X more β€” affects damage you deal) and Weak (enemy *deals* Y less β€” affects damage you take) are mirrored levers. Despite the symmetry they price differently: Vulnerable is a multiplier (TUNE), Weak is flat damage-prevention (linear, like Block).
62
+
63
+ ### Deferred-effect machinery
64
+ Burn, Bomb, and Ward all run on ONE shared deferred/persistent-effect timer system (one mechanism, three flavors β€” a build simplification). [DEFAULT β€” confirm.] These effects only ever DO things on a schedule; they are never targetable entities. If a deferred effect ever needs to be attacked/blocked/killed, that's the board-state trap β€” reject it.
65
+
66
+ ---
67
+
68
+ ## The 8-card standardized backbone (same for every school)
69
+
70
+ | Card | Cost | Effect |
71
+ |------|------|--------|
72
+ | Attack (weak) | 1 | deal 2 |
73
+ | Attack (medium) | 3 | deal 4 |
74
+ | Attack (strong) | 5 | deal 6 |
75
+ | Block (weak) | 2 | block 3 |
76
+ | Block (medium) | 3 | block 4 |
77
+ | Block (strong) | 4 | block 5 |
78
+ | Draw (small) | 2 | draw 1 |
79
+ | Draw (large) | 3 | draw 2 |
80
+
81
+ Identical across all schools. Only art/flavor reskins per run's theme. School identity lives entirely in the **draft pool**, not the backbone.
82
+
83
+ ---
84
+
85
+ ## Schools (v1: three)
86
+
87
+ School biases which primitives your 7 synergy picks draw from (a synergizable archetype), not your backbone. Theme = aesthetics only.
88
+
89
+ Schools map to **player temperaments**, not just primitive bundles β€” the choice signals how you want to play:
90
+
91
+ - **Fire β€” traditional burn (classic aggression).** The straightforward, immediately-legible school: deal damage, stack burns, race them down. Primitives: Deal, Burn, Bomb, Scaling.
92
+ Anchor (decaying burn): `4 energy: 3 now, 2 next turn, 1 turn after`.
93
+ Signature pick (bomb): `4 energy: 9 damage, detonates in 3 turns`.
94
+ - **Ice β€” speed (fast tempo).** For players who race: strike first, amplify, burst. NOT defensive β€” Ice outruns rather than turtles, so it carries no Block. Primitives: Initiative, Vulnerable, Multi-hit, Conditional.
95
+ Anchor: `3 energy: deal 2, opponent goes second next round`.
96
+ - **Earth β€” slow (durable control).** For players who outlast: grind, stack defense, win late. Defense concentrates HERE deliberately β€” this is the school's identity, not a tax. Primitives: Ward, Block, Scaling, Conditional.
97
+ Anchor (refreshing ward): `4 energy: block 3 per turn for the next 2 turns`.
98
+
99
+ Defense is deliberately NOT spread evenly: it concentrates in Earth (the slow school), is absent from Ice (speed doesn't block, it races), and is incidental in Fire (burn just out-damages). This makes the three schools feel different to *play*, not just to read.
100
+
101
+ v1 themes (3): pick from Dark Fantasy / Cyberpunk / Wuxia / etc. β€” aesthetic skin only.
102
+
103
+ ---
104
+
105
+ ## Models (all ≀32B, per-model rule β€” multiple ≀32B models allowed)
106
+
107
+ Three models; two satisfy the Nemotron + MiniCPM sponsor requirement:
108
+
109
+ - **Boss / enemy AI:** Nemotron 3 Nano (4B dense, or 30B-A3B if VRAM allows β€” stronger reasoning, heavier footprint). Picks which pre-costed cards to play, reactively, given board state + visible player deck.
110
+ - **Picker / card author:** MiniCPM-V 4.6 (1.3B). Tool-call generation of synergy picks. Llama.cpp-compatible (badge).
111
+ - **Image:** SDXL-Turbo class, fine-tuned to one card-art style (LoRA β€” Well-Tuned badge).
112
+
113
+ **Real constraint is VRAM on the Space GPU, not the 32B rule.** A 30B-A3B boss needs full weights resident even though MoE keeps active params ~3B. Picker and boss can share one base model in two isolated contexts if VRAM is tight; the boss context must NOT see card-authoring history.
114
+
115
+ ---
116
+
117
+ ## Components
118
+
119
+ ### `primitives.py` β€” THE SPINE, build first
120
+ The 13 primitives above. Each: id, tool-call signature, point cost, templated display string. Nothing else works until this exists.
121
+
122
+ ### `budget.py`
123
+ card cost (energy) β†’ point budget β†’ spends budget assigning N to the LLM's chosen primitives β†’ returns a fully-costed, balanced card. Miracle variant: wide but HARD-CAPPED budget multiplier (the only high-variance path).
124
+
125
+ ### `generator.py`
126
+ LLM tool call: `(school, theme, current_deck) β†’ effect IDs + counts + name + flavor + art_prompt`. **`current_deck` is mandatory** β€” deck-awareness is the load-bearing AI. Passes effects to `budget.py`. Schools bias the primitive subset.
127
+
128
+ ### `game.py`
129
+ Deterministic. Paired-round turn loop, energy ramp, initiative flip, card resolution (incl. the Ward threshold/bubble rule), Block/Ward stacking, fatigue/deck-out, win/loss. Deferred effects fire on schedule, never targetable. **All rules and numbers live here, never in a model.**
130
+
131
+ ### `boss.py`
132
+ Boss drafts its own deck from `generator.py` (synergy-biased) and the boss LLM plays it β€” picks pre-costed cards reactively. Boss cards capped at generation β†’ play is inherently damage-bounded. 3 phases = 3 escalating drafted wizards (rising budget/energy). Phase N+1's deck generates during phase N combat.
133
+
134
+ ### `draft.py`
135
+ 8 backbone + 7 deck-aware synergy picks = 15. Draft UI structure is a thin swappable layer β€” finalize after core playtests.
136
+
137
+ ### `app.py`
138
+ Gradio Space. Cards = styled containers in rows. No engine, no animations. Core state (both HP, enemy intent, energy, card costs/effects) ALWAYS visible β€” never behind hover. Effect text TEMPLATED from the primitive schema (fixed per-primitive format), never free prose β€” parses in ~1s. Custom themed frames (Custom UI badge). Landing/menu loads model-free; generation fires on "Start," not page load (protects compute + cold-start UX).
139
+
140
+ ---
141
+
142
+ ## Generation scheduling (latency)
143
+ - Synergy-pick art generates during the draft; cards choosable on mechanical text while art streams in.
144
+ - Backbone art backfills (mechanics instant).
145
+ - Boss deck + art generate during player activity. Boss art lowest priority (seen when played, not drafted).
146
+ - Lazy-load by need. Text instant, art progressive.
147
+
148
+ ---
149
+
150
+ ## Build order (timeline-driven)
151
+ 1. `primitives.py` (the 13)
152
+ 2. `budget.py`
153
+ 3. `generator.py` + `game.py` β€” **spell-only, text-only, NO ART YET**
154
+ 4. **Playtest for fun on a real human** β€” the one risk no architecture fixes is whether reading fresh cards every game is fun. Answer this before investing downstream.
155
+ 5. `boss.py`
156
+ 6. `draft.py` + backbone wiring + Ward threshold rule
157
+ 7. Art generation (base SDXL first)
158
+ 8. Fine-tune art LoRA + UI polish
159
+
160
+ Art, fine-tuning, polish come LAST. A playable, fun, text-only core is submittable; an unfinished ambitious build is not. Time is the binding constraint, not compute.
161
+
162
+ ---
163
+
164
+ ## Hard rules
165
+ - The model never sets numbers (except the engine-bounded, hard-capped miracle roll).
166
+ - No board-state entities. Burn/Bomb/Ward/summons are deferred *effects*, never targetable units.
167
+ - v1 scope is fixed: spell-only, 3 schools (Fire/Ice/Earth) Γ— 3 themes, one art style. "If time permits" features stay deferred until the core ships and is tuned.
168
+ - The 7 synergy picks must be generated **deck-aware** β€” picks that ignore the current deck reduce the generator to a random table.
169
+
170
+ ---
171
+
172
+ ## Open decisions (resolve before/at the relevant build step)
173
+ - **Multiplier costs (primitives 10–13):** all TUNE β€” set conservative overcosted guesses, tighten in playtest. Multi-hit and Scaling are the highest-risk.
174
+ - **Ward break rule:** full-absorb bubble (default) vs. break-through. Affects `game.py` resolution.
175
+ - **Deferred-timer unification:** Burn/Bomb/Ward on one system (default/recommended).
176
+ - **The 3 specific themes** (concept locked, the three not chosen).
177
+
178
+ ---
179
+
180
+ ## Compute
181
+ - $250 Modal (training/serving GPU) β€” primary budget, mostly art fine-tune + batch art gen.
182
+ - $20 HF (ZeroGPU/Space hosting) + 40 min/day free ZeroGPU. Thin for live three-model serving β€” test in focused sessions, gate generation behind intent, don't leave the Space running.
183
+
184
+ ## Deliverables (due June 15)
185
+ Space under the `build-small-hackathon` org + demo video + social post.