Skip to content
roshanarunkPublic

About

Frame-accurate Street Fighter 6 combo trainer (Python + C++)

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

SF6Assist

A combo timing trainer for Street Fighter 6. Build a combo from a character's real movelist, have each transition checked against SF6's actual cancel rules, then drill the timing against audio cues.

Quick start

npm start

Then open http://localhost:8000/web/.

No dependencies, no build step, no npm install — it runs on bare Node (20+). If port 8000 is busy the server picks the next free one and tells you.

The server serves the repo root, not web/, because the page imports core/ and fetches data/dist/. Opening index.html from disk will not work: ES modules and fetch both fail on file:// origins.

Controls

Keyboard works out of the box:

Keys Input
U I O LP / MP / HP
J K L LK / MK / HK
P / ; PPP / KKK
W A S D directions

For a controller, press any button on it first — browsers hide gamepads from a page until the user presses something, so a pad that is plugged in but untouched is genuinely invisible to the page.

What it does

  • Move browser — all 32 characters, filterable by name, command, or type.
  • Combo builder — click moves to chain them together.
  • Validation — every transition gets a badge:
    • ✓ cancel / chain / link — confirmed legal by the frame data
    • ⚠ unverifiable — the data cannot confirm it either way; explains why
    • ✕ illegal — positively contradicted by the data
  • Cue and grade — plays a cue at each move's due frame and grades your input as PERFECT / EARLY / LATE with the frame delta.
  • Frame meter — one bar per frame beneath the combo, in SF6's training mode style: green startup, red active, blue recovery, and grey gaps between the hits of a multi-hit move. Each move sits at its scheduled frame, so dead time between moves is visible. A white playhead tracks the run.
  • Input history — what was held and for how long, in frames.

An unverifiable badge never blocks you from building or training a combo. The data genuinely cannot express juggle states, counterhit situations, spacing and corner requirements, or Drive Rush cancel legality — so for those it says so rather than guessing. You know more about SF6 than the dataset does.

Accuracy, honestly

Timing is accurate to roughly ±1–2 frames.

The trainer is not phase-locked to SF6's frame clock and cannot be: two unsynchronised 60 Hz samplers disagree by about a frame. In the browser this is compounded by requestAnimationFrame being vsync-coupled at roughly the same rate as the signal being sampled.

This is fine for what the tool is for. A metronome on a consistent internal clock teaches the right delay whether its counter reads 6F or 7F. It is not enough to match SF6's own input display frame-for-frame, and no amount of tuning changes that — which is why there is deliberately no timing-offset setting: the error is phase noise, not constant bias, so a fixed offset cannot remove it.

Input matching checks the button, not the motion. For a 236P special it grades when P is pressed, not when the quarter-circle completes.

Deploying

The site is static files with no server logic, so it deploys to Cloudflare Workers with Static Assets (recommended over Pages for new projects):

npx wrangler login
npm run deploy

npm run preview runs it locally through Workers instead of the Node server. Both commands run npm run build:site first, which assembles dist-site/ (48 files, 4.8 MB) containing only what the browser loads.

Three things worth knowing before changing the deploy setup:

  • Deployment builds a directory; it does not point Wrangler at the repo. An .assetsignore at the repo root could not be shown to work — ignoring * still reported the same file count from wrangler deploy --dry-run, so there was no evidence .git (4 MB of history) was excluded. Copying only the needed files makes exclusion structural: if it is not in dist-site/, it cannot ship. The dry run now reads 54 files instead of an unexplained 528.
  • Source uses relative imports; the build rewrites them to root-absolute. web/ flattens to the site root, so ../../core/ would point above it. The rewrite happens in scripts/build-site.mjs rather than in source, because the test suite imports web/src/trainer.mjs directly and a /core/... specifier resolves to a filesystem root in Node, not the repo.
  • data/dist/framedata.json is deliberately not copied. It is 4.85 MB and the app never fetches it — the roster is hardcoded in main.mjs and each character lazy-loads its own file. Keep it out unless something reads it.

Frame data

Sourced from the community frame data spreadsheet that the FAT app is built from (the published FAT JSON is missing several characters).

npm run build:data     # re-fetch and re-normalize
  • data/fetch_framedata.mjs — downloads the character tabs to data/.cache/
  • data/notation.mjs — parses the sheet's cell notation
  • data/normalize.mjs — emits data/dist/

data/dist/ is committed, so the app works offline and upstream changes show up as reviewable diffs. data/dist/framedata.meta.json carries a parse-failure report; treat a jump in that count after a refresh as a regression signal.

Tests

npm test

64 tests covering the notation parser, cancel/link rules, the cue scheduler, and button matching.

Layout

data/     frame data ingestion (build time)
core/     rules engine — validator + scheduler, pure, no I/O
web/      the trainer UI
scripts/  local dev server

core/ imports nothing from web/, which is what lets the rules be tested without a browser or a controller. Everything is plain .mjs with JSDoc types — no TypeScript toolchain, no bundler.

Legacy

sf6_trainer.py is the original Tkinter/pygame trainer. It still runs (pip install pygame && python sf6_trainer.py) but is frozen — it predates the frame data and its combos are hand-typed frame delays.

sf6_trainer.cpp is an input-history viewer, not a trainer: it has no combo, timing, or verdict logic despite what earlier versions of this README claimed. It is kept for its XInput input model, which a future native capture path would build on.

g++ -o sf6_trainer.exe sf6_trainer.cpp -lxinput -lwinmm -luser32 -lgdi32 -lcomctl32 -std=c++17 -O2 -mwindows

About

Frame-accurate Street Fighter 6 combo trainer (Python + C++)

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages