Documentation
¶
Overview ¶
refmap converts rectangles a human dragged on a live frame into the reference coordinates the bot's asset files are written in.
The wall-flow assets are consumed through game.Calibration's HUD law (HudRect): a stored value is an 860x732 reference coordinate that the bot re-maps onto whatever device it is running on. The picking tools capture PHYSICAL pixels, so something has to invert the law — and inverting it is not a division. tools/select_wall_upgrade_buttons.py used to write its drags straight into assets/wall_upgrade_buttons.json, which the loader then read as reference values and re-mapped: the recorded boxes moved on every run, and the live 1280x720 session proved it (the boxes landed on builder-menu rows, and the gate in internal/bot/wall_upgrade.go now refuses to tap when they do).
Usage, for every rect a picking session captured (one per line, physical pixels; the key may be omitted for a single-rect schema):
refmap -w 1280 -h 720 -k 1.325 -schema buttons <<'EOF' gold 591 503 692 601 elixir 717 503 816 601 EOF
Output is the asset file's exact contents, so a picker writes stdout to disk unchanged. Diagnostics — how far the recorded box sits from the drag, and whether the drag fell in a band seam the reference frame cannot express — go to stderr, because a JSON asset must not carry a comment.
-schema wall accepts a whole session at once and, with -write, saves each key to the asset file that consumes it — stdout printing would have to interleave several JSON documents, so a multi-file set demands -write.
Run with -describe to list the schemas.