Cardelve: A Card Game Where You Win Before the Battle Starts

Cardelve is a single-player card game I am making in pixel art. Its title screen says “The cards take the field. You win before the battle starts.” That line is the whole design. You build a party of character cards, choose who stands where, invest their skill points and hand out equipment, and then the fight plays itself. This is a first look at how it works as of early October 2026: the run, the cards, the battle simulation, the effect engine I wrote for it, how I think about balance, and what I threw away on the way. The game is unreleased and the build is Korean only, so the screenshots show Korean text. Card illustrations are not in yet; the cards use simple code-drawn icons.

Cardelve pixel-art title screen with five cards in different rarity frames above the logo
The title screen, with one card in each rarity frame fanned out above the logo.

Every decision happens before the fight

Most card games ask you to draw a hand, spend energy and play cards each turn. Cardelve does not. A card is a character, not a spell. Before each fight you put one to five of your cards on the field, set their order, decide which skills they have learned and what they carry. Then you press start and watch. During the battle you can pause, change the speed or read the log, but you cannot act.

I wanted the interesting question to be “why did that work?” rather than “what should I click next?”. So every fight ends on a result screen with damage, healing, protection and control meters for each card, a health graph for both sides, and, after a loss, a short list of likely causes, such as a front-line card falling in the first 45 seconds or healing that covered less than 15% of the damage taken. Losing is not the end of the run. You spend one point of resolve to retry the same encounter after changing anything you like. A run starts with 3 resolve and can hold at most 5. When it runs out, or you give up, the run ends.

One rule keeps this loop clean: injuries do not carry over. Every card starts every fight and every retry at full health, so the only thing a run wears down is resolve.

A run: a bundle, a map, a boss

A run starts with the boss of the first act. Before you see a single card, the game shows you that boss: its name, its formation and its pattern tags, such as front-line pressure or back-row sniping. Then you open the starting bundle: ten candidates, and you keep six. There are no rerolls.

Cardelve card selection: ten pixel-art candidate cards to choose six from
The human starting pack: ten candidates, keep six. Under each card are its special-skill phase and its roles. The bar at the bottom counts the roles you have picked so far.

The ten cards look random, but they are built to rules. The generator first fills minimums by role: at least two cards that can hold the front, two that heal or protect, three that deal direct damage and two that control the pace. Cards that answer the coming boss get a 1.2× weight, and at least one always appears. The basic pack allows at most one rare card and three uncommon ones. If you confirm a party with no front line, no healing or no damage, the game warns you but does not stop you.

After the bundle comes the map. The game has three standard acts of fifteen floors plus a boss, and a short final act with four fixed stops: maintenance, shop, a mid-boss and the final boss. Nodes are fights, elite fights, events, shops, treasure and maintenance stops, and the whole act is visible from the start.

Cardelve branching chapter map with nodes connected by paths
The Act 1 map. The panel on the right shows the act’s boss with its pattern tags, the selected node and the legend.

How a map is generated

I wanted every route to be fair without every route being the same, so the map generator works in three steps. First, one of three templates for the act fixes how many nodes each floor has. The templates have names that say what they are for: balanced, safer economy and pressure. Second, the roads come from a fixed rule. Each node links to the node at the same relative height on the next floor, and every third floor adds a diagonal. Third, node types are placed by search. Every node gets its own random order of types, weighted by the template, so fights come up often and treasure rarely. A depth-first search then tries types in that order, floor by floor.

The search carries, for each node, every possible count of types along the routes that reach it. Before it accepts a type, it checks whether the remaining floors could still bring every one of those routes into range. If not, it backs up. The first complete map that passes is used. If no map passes, generation fails loudly instead of quietly widening the ranges.

Diagram of a generated Cardelve Act 1 map read left to right, with fight, elite, event, shop, maintenance and treasure nodes on fifteen floors and the three steps that build it
A real map from the early-October generator. All 1,384 routes through it have the same mix of fights, elites, shops and rest stops.

The guarantee is strong. On the map above, no route can skip every shop, and no route meets two elites in a row. The whole thing runs from the run’s seed, so the same seed always draws the same map.

Classes, races and rarities

Every player card belongs to a character line: one race, one class and one subclass. There are four races (human, elf, dwarf, gnome) and eight classes (fighter, rogue, cleric, wizard, ranger, paladin, warlock, bard), each with three subclasses. That makes 24 subclasses, 96 lines and, with five rarities per line, 480 cards. Eleven more cards with unique classes, such as a puppet mage or a time thief, appear only through events. The codex counts 491.

A class is not a fixed role; I avoided the usual tank, healer and damage split on purpose. Whether a card holds the line, heals or controls depends on its subclass and build, and each subclass has two strengths and one weakness. When the game checks a party, it never asks for a class by name. It counts role tags: front line, recovery, direct damage, control.

Each race adds a small personal trait and a bond. The bond only works when all five cards on the field share the race. With five humans, the first ally to fall to 35% health gets a shield worth 12% of its maximum health. With five dwarves, the first time an ally’s cast is delayed or silenced, the whole party becomes immune to both for three seconds. A mixed party simply goes without.

Each card has exactly seven skills. One is a basic attack. Four belong to phases one to four, one is a phase-five ultimate, and one is a special skill. The special skill’s phase is drawn when you get the card, anywhere from one to four, and shops and maintenance stops can move it for gold. Cards level to 10 and earn one point per level. There are 16 ranks to spend those points on: three each for the four phase skills and the special, one for the ultimate. Ten points cannot fill sixteen ranks, so every card is a set of choices.

Cardelve card codex showing each class in several rarity frames
The codex, sorted by line. Each row is one character line in all five rarity frames: common, uncommon, rare, heroic and legendary.

Rarity shows in the frame and background colour, from brown through silver, blue and purple to gold. Higher rarity means better stats, but slower growth. A common card needs 546 experience to reach level 10, a legendary one 1,798. Legendary cards also carry a unique rule with a cost. The human champion’s legendary, for example, strengthens its counterattack by 35% for two uses the first time enemy damage drops it below 40% health. After that it receives 25% less healing for eight seconds. Two cards of the same class and rarity fuse into one of the next rarity, and spare cards can be turned into experience or sold.

All of this rests on one rule I try to keep: rarity amplifies a composition, it never replaces one. Five legendary cards with no front line and no healing should lose to a well-built party of commons and uncommons in most elite and boss fights.

How an automatic battle resolves

The title line is literal. When you press start, the game’s rules layer simulates the entire fight before anything moves on screen. It steps in fixed ticks of 0.1 seconds until one side is wiped out or 180 seconds pass, recording every event and every card’s health, gauge, shield, cast progress and threat. The battle screen only replays that record. That is why the skip button gives exactly the same result as watching, and why the same party, enemies and seed always produce the same fight.

Cardelve automatic battle with enemy cards above, player cards below, hit numbers and slash effects
The battle screen: enemies above, your formation below, the phase panel and the advantage rail on the right, speed controls up to 4x at the top.

Four mechanics drive a fight.

  • Phases. Time is split into five phases: thirty seconds each for phases one to four, then sixty for phase five. Each phase unlocks one more tier of skills, so an early-skill party tries to win fast and a late-skill party tries to survive until its stronger options open.
  • The action gauge. Each card fills a gauge at about ten points per second, adjusted by its class and effects. Starting gauges are random, between 20 and 60. At 100 the card makes a weighted pick among the skills its phase allows that are off cooldown and have a target. Some skills have a cast time. Taking damage while casting pushes the cast back, and taking damage while charging pushes the gauge back, by 40 gauge points per second of delay. The pushback is capped at 25 points per action, so a card under constant fire still gets to act.
  • Threat is position. Damage, critical hits, healing, shields and taunts all create threat, and threat fades by 1.5% per second. Every tick, each side is re-sorted so that the card with the most threat stands in the first slot: when cards move on screen, you are watching threat change hands. Enemies prefer the front slot, marked or wounded cards and anyone halfway through a cast. Taunts override all of that.
  • Enemy patterns. Monsters and bosses carry modules from a set of forty patterns, such as hunting the lowest-threat card, shuffling threat, sweeping the back row or reviving the fallen. Each is announced before it fires.

A card that dies becomes an X and moves to the back, where it still takes up a place. Both sides are limited to five cards, summons and revived cards included. If the clock reaches 180 seconds, the fight counts as a loss.

Timeline chart of one automatic boss fight showing each card's actions by phase, the wizard's action gauge, which card holds the front slot, and both sides' health
One real fight from the early-October build. The fighter holds the front for the first 31 seconds. Then the paladin casts a shield, the threat from that protection moves it to the front, and it stays there for most of the fight. Each card acts about every ten seconds.

The margins are thin. With the same five cards at level 3 instead of 5, the fight runs out the clock: at 180 seconds the boss still has 3% of its health, the party 86%, and it counts as a loss. Results like that are what the next balance work has to look at.

Pixel effects as data

The effect engine came out of one day. On September 25 the first web version drew attack lines with three.js, as soft additive glows that looked wrong next to pixel art. By the afternoon I had replaced them with a hand-written pixel canvas, and by the evening with something more general: a small effect engine, pixfx, and a studio to edit its effects.

Every effect is a node graph saved as a JSON file. Nodes draw shapes, paths, particles and lit tiles; filters add outlines, cel shading, dissolves and noise; others delay, repeat, blend or pull in another graph as a part. Values can be keyframes or short whitelisted expressions. Rendering is stateless: a frame depends only on the graph, its parameters, the time and a seed. That one property makes the rest easy. The studio can scrub to any frame and export sprite sheets, and tests render every game graph at every frame and fail if one throws or comes out empty.

The game calls an effect by name and passes only positions and game data, such as a skill’s element or how hard a hit was; sizes and colours live in the graph. The overlay draws at 640×360, half the stage, and the browser doubles it. Effects run at 24 frames per second and the overlay redraws only when an effect reaches a new frame. Glow never enters the pixels: a blurred half-resolution copy is laid on top.

Pixel-art hit effects for eight elements in colour and in greyscale, plus one fire hit shown frame by frame
Rendered by the engine itself for this note. Each element needs its own silhouette, and the grey row checks that.

I wrote the art direction down as rules, and some of the rules are enforced by tests:

  • Colour ramps have five steps and shift hue instead of mixing in white or black. Highlights lean warm and yellow, shadows lean cool and violet, and even the darkest step is never pure black.
  • Transparency has only three levels: on, a 2×2 checker, and off. Nothing fades out gradually. It dissolves in chunks, shrinks or breaks apart.
  • No one-pixel lines except the white flash at impact. Slashes and bolts are tapered strokes three to nine pixels wide, and they retract tail first.
  • A hit goes white flash for two frames, colour burst, rings and debris, then remains. The main body is over within 450 ms. Debris falls, bounces and lies on the ground before it disappears.
  • Every element must still be readable in greyscale. Fire is a billowing cloud, cold an angular crystal, holy a vertical pillar and cross, shadow a dark core with violet spikes.

By early October there were 103 graphs, and a test checks that every class, damage element and status has its own. The October 2 change added branching bolts and a noise texture that shifts shades within a ramp. The same engine runs the bundle opening, where light shows as bricks one or two ramp steps brighter rather than glow drawn on top, and heroic or legendary reveals slow the effect clock.

Sound came the same week: 127 short effects generated with ElevenLabs, tracked in a ledger of every sound the game needs and where it plays. A script compares the ledger with the code and flags game actions with no sound. I also made music and ambience, then took it all out again that week; for now the game uses effects only.

Balancing: what the numbers are for

Most of my balance rules describe relationships, not values. Every balance check includes three parties: a good composition at low and mid rarity, the same composition at high rarity, and a broken composition at high rarity. The expected order is good-and-high, then good-and-low, then broken-and-high. If the broken legendary party is more stable than the good common one, balance has failed, however good the averages look.

The other rules are guardrails:

  • No class should appear in more than 60% of winning formations, and no subclass in more than 45%.
  • Each subclass’s win rate in standard encounters stays within four points of the average.
  • A legendary card adds 17 to 22% more effective contribution than the heroic card of the same line, and its unique rule may not auto-win any type of encounter.
  • A normal fight tests one weakness of a party. An elite tests two at once. A boss shows its tags at the start of the act, then pressures something different in each phase.

Every encounter also has a target win rate and duration, for diagnosis only. The game never reads them to adjust difficulty during play; a fight that is too hard gets fixed in the data, not softened at runtime.

Some of these numbers have a history. Before the web version, a C# simulator ran 1,312 full expeditions and 16,416 sample fights against the same tables. Nine of eleven balance gates landed in range. The two failures were the useful part. Two legendary rules pointed at skill slots 8 and 12, left over from an older design, but player cards only have slots 1 to 7, so those rules could never fire, whatever their numbers. I fixed what the rules point at instead of raising a global multiplier until the report showed eleven out of eleven. For me, that is the real value of a balance simulator: it finds rules that cannot happen.

None of those older numbers count for the web game, which has its own engine and needs its own measurements.

What I tried and dropped

The longest detour was the engine. Cardelve began in May as a C# combat simulator in a console, with balance loops and design documents. A Unity project followed: first a screen that replayed simulated fights, then a playable slice. In late July I started over in Phaser, and in one week that attempt produced 119 commits and a complete four-act run. About half of those commit messages are about hardening, sealing or proving contracts, and very few are about how a fight looked. In August the work went back to Unity. On September 25 a web version in TypeScript replaced all of it, and one commit deleted 1,705 files of Unity, Phaser and C#.

Bar chart of weekly commits from May to October coloured by runtime: C# console, Unity, Phaser, Unity again and the web version
Commits per week from May to early October, coloured by runtime. What survived every switch was text: the design documents and the content tables.

What carried over each time was the writing. The rules live in design documents and the content lives in tables; a conversion script turns them into the JSON the game reads, checking references and counts. The data folder created in the first week of May is still the one the web build reads. If I started again, I would do this on purpose: keep the rules and content in a form no engine owns.

The second detour was a translation error. The original design had 16 rank slots spread across seven skills. Somewhere that became “16 skills per card”, and for a while the documents and data really described sixteen skills. Shrinking back left more damage: special skills had turned into race effects, and a special skill’s phase no longer changed anything in battle. The July fix restored seven skills and sixteen ranks. The sixteen-skill documents sit in an archive as spare ideas.

The stack

  • Rules and saves: plain TypeScript with no DOM access, covered by Node’s built-in test runner. Runs and the account are saved to the browser’s local storage with a version number, and the game keeps working if storage is blocked.
  • Screens: DOM and CSS on a fixed 1280×720 stage that scales to the window, built with Vite.
  • Effects: the pixfx engine on a 2D canvas, plus a development-only studio page for editing graphs.
  • Randomness: one seeded generator with named sub-streams, so the map, the rewards and each fight can be reproduced on their own.
  • Type: the Galmuri pixel fonts by Minseo Lee, under the SIL Open Font License.

Where it is now

A full run can be played from the first bundle to the final boss, with code-drawn card art, real effects and sound. What’s next is the art that makes it look like a game, a balance pass on the web engine, and real playtesting. An English version comes after that.

Update, November 2026. Since this note the web engine got its own balance pass, and three AI agents (Claude, Codex and Gemini) played full runs in a browser on October 21 (see the October progress note) and again on November 1. In the second round all three found normal and elite fights risk-free and counted more than 500 clicks per run. They also noticed what the map figure above already shows: 12 of its 13 floors with more than one node offer a single type. With ranges as tight as one elite per route, the search’s easiest answer is a whole floor of elites. Since November 3, acts are ten floors plus a boss, every middle floor must offer two node types, skill points are assigned automatically (still editable), and rewards share one screen with the fight result.