The Velan Codex

Spellcasting

Cast Scoring Pipeline (Draft)

Each cast gets one weighted quality score built from separate parts; each spell can weight the parts differently. Fourier descriptors were considered but set aside, since they smooth out corners and ignore orientation and timing.

  1. Capture: record each thumb's path as points with timestamps.
  2. Shape: resample each stroke to a fixed number of points (e.g. 64), normalize size and position, and compare point by point to the template ($1 / Protractor-style recognizer).
  3. Pace: compare each stroke's speed profile to the template's using dynamic time warping, which forgives an overall faster draw but catches rushing one part.
  4. Sharp angles: detect corners where direction changes suddenly; score their count, position and sharpness separately so rounded corners lose points.
  5. Thumb sync: for mirrored spells, flip the left stroke and compare it directly to the right; score start time, end time and pace alignment between thumbs. Non-mirrored spells skip the flip but keep timing sync.
  6. Breath: the cast must finish within the player's breath window.
  7. Combine: weighted score decides fizzle vs. cast and the cast's quality.
  8. Validation: server-side checks that input looks human (natural jitter and timing variation).

Weights in the game

The default weights every spell uses unless it overrides them, read from Assets/Scripts/Scoring:

shape35%
size10%
pace15%
corners20%
sync20%

Coil overrides them

shape40%
size10%
pace20%
corners10%
sync20%

Mend overrides them

shape40%
size10%
pace20%
corners10%
sync20%
Fizzle line
45% overall
Shape minimum
30% on each thumb
Sync tolerance
80 ms
Power range
0.6x to 1.5x

From Mobile RPG Codex › Spellcasting › Cast Scoring Pipeline (Draft)