How hastylmao/hasty-cr works
HastyCR combines a deterministic Clash Royale simulator, an agent trained against it, and a live-game bridge. The main workflow is to run or train a policy in the simulator, evaluate it, then use perception and device controls for live play. Calibration and video analysis form a separate research branch. README statements and indexed references support the connections shown; unsampled training and runtime code limits finer-grained wiring.
Main entry points: match.py Match runner · app.py Studio controls · engine.py Battle tick · pipeline.py Action pipeline
Components 24
Battle simulation
- Arena geometry
sim/arena.py - Card data
sim/gamedata.py - Battle entities
sim/entities.py - Spell mechanics
sim/spells.py - Battle tick
sim/engine.py - Match runner
sim/match.py - Tower mechanics
sim/towers.py - Simulation runner
sim/runner.py
Agent learning
- Rule policy
scripts/brain/policy.py - Policy cloning
sim/clone.py - PPO training
sim/train_ppo.py
Live play
- Studio controls
scripts/studio/app.py - Screen capture
scripts/studio/capture.py - Object detection
scripts/studio/detect.py - Game feed
scripts/studio/feed.py - Live display
scripts/studio/render.py - Action/state models
src/hastycr/models.py - Action pipeline
src/hastycr/pipeline.py
Calibration research
- Calibration core
tools/calibration/core.py - Replay calibration
tools/replay_calibration.py - Video analysis
tools/vod/pipeline.py
Other components
- Engineer
- Live-game operator
- Android emulator
Connections 26
- Engineer → Match runner: runs matches
README.md - Battle tick → Arena geometry: uses geometry
sim/engine.py - Battle tick → Battle entities: updates entities
sim/engine.py - Battle tick → Card data: loads stats
sim/engine.py - Battle tick → Spell mechanics: resolves spells
sim/engine.py - Match runner → Battle tick: runs battle
sim/match.py - Match runner → Arena geometry: uses geometry
sim/match.py - Match runner → Battle entities: uses entities
sim/match.py - Match runner → Card data: loads stats
sim/match.py - Match runner → Spell mechanics: uses spell rules
sim/match.py - Match runner → Tower mechanics: uses tower rules
sim/match.py - Engineer → Policy cloning: starts cloning
README.md - Engineer → PPO training: starts training
README.md - Rule policy → Policy cloning: provides examples
- Live-game operator → Studio controls: operates
README.md - Studio controls → Screen capture: starts capture
scripts/studio/app.py - Studio controls → Object detection: starts detection
scripts/studio/app.py - Studio controls → Game feed: uses feed
scripts/studio/app.py - Studio controls → Live display: configures display
scripts/studio/app.py - Screen capture → Android emulator: captures screen
- Studio controls → Action pipeline: connects live cycle
- Action pipeline → Action/state models: uses state and actions
src/hastycr/pipeline.py - Action pipeline → Android emulator: sends actions
- Engineer → Calibration core: calibrates mechanics
README.md - Replay calibration → Calibration core: provides calibration primitives
tools/replay_calibration.py - Engineer → Video analysis: analyzes recordings