PROJECT CASE STUDY
Arcaea Viewer
Vertical slice Rust–WASM biến dữ liệu chart AFF hợp lệ thành timing context, scene trung gian và SVG preview xác định được, qua đó chứng minh parser, correctness boundary và build pipeline đa ngôn ngữ.
A Rust-to-WASM vertical slice that turns legal AFF chart fixtures into timing context, an intermediate scene, and deterministic SVG previews, demonstrating parsing, correctness boundaries, and a cross-language build pipeline.
- Trạng tháiStatus
- Research-grade prototypeResearch-grade prototype
- Lĩnh vựcDomain
- Rust · WebAssembly · Deterministic systemsRust · WebAssembly · Deterministic systems
- Cập nhậtUpdated
- 2026-07-16
01 / PROBLEM
Vấn đềProblem
Logic chart, timing và rendering dễ bị phân tán giữa frontend và backend, làm tăng nguy cơ sai khác hành vi và khó kiểm thử một cách tái lập.
Chart, timing, and rendering logic can become duplicated across frontend and backend layers, increasing behavioral drift and making reproducible validation harder.
02
Bối cảnhContext
Đây là prototype nghiên cứu và proof of integration, không phải viewer hoàn chỉnh hay bản sao chính thức của game. Core tests chỉ dùng fixture tự viết và không yêu cầu asset có bản quyền.
This is a research prototype and proof of integration, not a finished viewer or an official game replica. Core tests use hand-written fixtures and require no copyrighted game assets.
03
Ràng buộcConstraints
- Parser chỉ hỗ trợ subset AFF được tài liệu hóa; unsupported input phải trả diagnostics có cấu trúc.The parser supports only a documented AFF subset; unsupported input must return structured diagnostics.
- Domain, timing và renderer logic phải nằm trong Rust thay vì được viết lại trong TypeScript.Domain, timing, and renderer logic must remain in Rust rather than being reimplemented in TypeScript.
- Browser boundary dùng contract JSON có version để giảm coupling và làm lỗi tích hợp dễ quan sát.The browser boundary uses a versioned JSON contract to reduce coupling and make integration failures observable.
04
Vai trò của tôiMy role
Thiết kế workspace Rust, domain model, parser subset, timing map, renderer scene, WASM DTO boundary và browser vertical slice.
Designed the Rust workspace, domain model, AFF-subset parser, timing map, renderer scene, WASM DTO boundary, and browser vertical slice.
05
Kiến trúcArchitecture
- crates/core định nghĩa chart domain types độc lập với browser.crates/core defines browser-independent chart domain types.
- crates/parser tạo chart hoặc structured diagnostics từ AFF fixture.crates/parser produces a chart or structured diagnostics from AFF fixtures.
- crates/timing xây timing context và playback snapshot; crates/renderer tạo scene IR và deterministic SVG.crates/timing builds timing context and playback snapshots; crates/renderer creates a scene IR and deterministic SVG.
- crates/wasm xuất versioned JSON envelope cho apps/web gọi từ React/Vite.crates/wasm exposes a versioned JSON envelope consumed by the React/Vite app in apps/web.
06
Quyết định kỹ thuậtTechnical decisions
- Không viết lại parser/timing/renderer trong TypeScript để giữ một nguồn sự thật cho correctness.Do not duplicate parser, timing, or renderer logic in TypeScript, preserving one correctness source of truth.
- Dùng SVG debug preview xác định được trước khi tối ưu visual fidelity hoặc animation.Use a deterministic SVG debug preview before optimizing visual fidelity or animation.
- Dùng legal fixtures tự viết để tách nghiên cứu kỹ thuật khỏi dữ liệu game có bản quyền.Use hand-written legal fixtures to separate engineering research from copyrighted game data.
07
Kiểm thử và validationTesting and validation
- cargo test --workspace kiểm tra các Rust crates.cargo test --workspace validates the Rust crates.
- pnpm check chạy format, clippy, Rust tests, WASM build, frontend type check, unit tests và production build.pnpm check runs formatting, clippy, Rust tests, the WASM build, frontend type checks, unit tests, and the production build.
- CI thực thi Rust fmt/clippy/tests, WASM package build, frontend tests và production build trên clean runner.CI executes Rust fmt/clippy/tests, the WASM package build, frontend tests, and a production build on a clean runner.
08
ObservabilityObservability
- Browser hiển thị structured diagnostics và primitive counts để kiểm tra kết quả parser/renderer thay vì chỉ trả màn hình trống.The browser exposes structured diagnostics and primitive counts so parser and renderer results are inspectable instead of failing as a blank screen.
09
Bảo mậtSecurity considerations
- Core fixtures không chứa chart hoặc asset được trích xuất từ game; browser prototype không có account, backend hoặc dữ liệu người dùng.Core fixtures contain no extracted game charts or assets; the browser prototype has no account system, backend, or user data.
10
Failure modesFailure modes
- AFF ngoài subset, malformed input, WASM contract mismatch hoặc frontend build không tương thích.Unsupported AFF syntax, malformed input, WASM contract mismatch, or incompatible frontend builds.
- SVG hiện là debug renderer và không đại diện cho official scroll physics.The current SVG is a debug renderer and does not represent official scroll physics.
11
Kết quả hiện cóCurrent results
- Vertical slice hiện có thể load fixture hợp lệ, parse bằng WASM, trả diagnostics, chọn playback time, dựng Rust scene và render SVG cùng các primitive counts.The vertical slice can load a legal fixture, parse through WASM, return diagnostics, select playback time, build a Rust scene, and render SVG with primitive counts.
- Chưa công bố benchmark performance, replay, audio sync, analytics UI hay offline cache.No performance benchmark, replay, audio sync, analytics UI, or offline cache is published.
12
Bài họcWhat I learned
- Contract có version và deterministic fixtures giúp tách lỗi parser, timing, rendering và browser integration rõ hơn.Versioned contracts and deterministic fixtures make parser, timing, rendering, and browser-integration failures easier to isolate.
13
Bước tiếp theoWhat I would improve next
- Cải thiện ergonomics cho fixture selection, malformed examples và render controls trước khi mở rộng analytics hoặc replay.Improve fixture selection, malformed examples, and render controls before expanding into analytics or replay.
EVIDENCE
Bằng chứng và liên kếtEvidence and links
Chỉ liên kết artifact đang tồn tại; planned work luôn được ghi rõ.
Only existing artifacts are linked; planned work remains explicit.