makepad/libs/game/assets/examples/probe.rs
Admin 5f83480ae3 Arcade assets: full Kenney 3D catalogue (4442 models) + ranking fixes
52 packs, 4442 GLB models, 136 MB on disk — fetched sequentially with resume
(a hash-valid pack is skipped, so an interrupted run costs nothing) via
kenney.nl's content-hashed URLs with per-zip sha256. MIRROR.toml records
every pack's canonical URL, sha256, size and file count, so a mirror is
reproducible; --mirror=/ARCADE_ASSET_MIRROR redirects the base URL and fetch()
verifies the digest identically whatever host served the bytes — a mirror we
control is never trusted more than upstream. --packs= keeps a fresh clone from
being forced to pull everything.

Aliases restructured to survive the scale: per-pack theme rows (55) so every
model in a pack inherits its setting, filename-token parsing with variant-
marker stripping as the workhorse, and ~240 hand-curated query-time synonyms —
the layer whose curation compounds across the whole catalogue. 82-query suite
reports misses instead of being tuned green; the list is down to 2, both
defensible (a floor IS somewhere to stand; a bell IS a metal clang).

Three ranking bugs root-caused, not patched:
- No stemming, so "smashing" never reached the alias "smash" and "glass
  smashing" returned glass PIPES. Added a conservative stemmer probed at
  synonym strength (only ever adds matches), which refuses to mangle
  glass/grass/class and routes "trees" to "tree", not "tre"
- An overreaching alias: `spaceship` sat on four spaceEngine SOUND families.
  An engine hum is not a spaceship. Removed; "spaceship engine" still resolves
- Kind confusion on ties: spacecraft models tied with spaceTrash sounds and
  lost the alphabetical tie-break. Added kind-aware tie-breaking driven by
  query intent — deliberately a TIE-BREAK, not a score bonus, so it cannot
  drag a weak model above a strong sound (laser gun / explosion / coins scores
  verified unchanged)

Repo-policy violation fixed: all three asset .gitignore files were deny-lists
covering only .glb/.png/.jpg, leaving 302 .gltf files from 3d-road-tiles fully
committable. Converted to allow-lists — 4,744 asset files are now unstageable
by accident.

Scale at 4,999 entries: build 120 ms, search ~0.2 ms, 2.1 MB heap, and the
prompt summary still 479 chars — flat as the catalogue grows, which is what
keeps it affordable in every AI turn.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-03 09:17:03 +02:00

38 lines
1.1 KiB
Rust

//! Ad-hoc query probe: prints the top hits and their kind for a set of
//! queries, so a ranking change can be judged against the queries it might
//! regress rather than only the ones it fixes.
use makepad_game_assets::AssetIndex;
fn main() {
let idx = AssetIndex::build(std::path::Path::new("apps/arcade/resources"));
let queries: Vec<String> = std::env::args().skip(1).collect();
let queries: Vec<&str> = if queries.is_empty() {
vec![
"spaceship",
"glass smashing",
"metal clang",
"laser gun",
"explosion",
"footsteps on wood",
"coins",
"somewhere for my guy to stand",
"spaceship engine",
"a boat",
"police car",
]
} else {
queries.iter().map(|s| s.as_str()).collect()
};
for q in queries {
println!("\"{q}\"");
for h in idx.find(q).iter().take(4) {
println!(
" {:6} {:5} {}",
h.score,
format!("{:?}", h.entry.kind),
h.entry.id
);
}
}
}