Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions docs/ACHIEVEMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Achievements

Badges, XP and levels for real work in CG Artist File Browser. Added in 1.24.0. Built to the Emulsion Labs achievements
standard, so a level, a rank and a tier mean the same effort in every Emulsion Labs tool. Only the theme is this app's own.

Live preview (every version, shaders running): see `docs/achievements-preview.html`, published as the artifact
"CG Artist File Browser Achievements" (link at the end of this file).

## Rules

- Watch only. Achievements never change, wait on, slow or block the app's work. Every hook is wrapped so it cannot throw.
- Quality, not volume. Only files that really loaded and jobs that really finished count. Opening the same file again counts
nothing (the last 1,000 counted files and jobs are remembered as short hashes, never as paths).
- Never take anything away. Failures give funny "Happy accidents" badges (10 XP). Totals, never streaks.
- No login, no server, no network, no new permissions. Saved on this PC only.
- FREE MODE: the app has no paid plan, so there are no paid tags, no "Welcome to Pro" badge and nothing locked behind money.
Emulsion is earned slowly through the Emulsion gate (below).

## Scoring (shared by every Emulsion Labs tool, never tuned per tool)

- XP to the next level: `round(60 + 40 × level^1.25)`.
- Flat XP: +2 per finished job, +1 per small real action (a model, HDR, image or texture opened). At most 40 a day.
- Ladder XP per tier: 25, 50, 100, 250, 500, 1000, 2000. A big job can skip tiers; the XP is the sum of every tier passed.
- Showreel (set) XP per tier: 100, 200, 400, 800, 1500, 3000, 6000.
- Ranks: Bronze 1-4, Silver 5-9, Gold 10-14, Platinum 15-19, Diamond 20-29, Ruby 30-39, Emulsion 40+ (gate open only).
- Titles: Intern (1), Junior Artist (3), Artist (6), Senior Artist (8), Lead (12), Supervisor (16), VFX Legend (20).
- Seven tiers: Bronze, Silver, Gold, Platinum, Diamond, Ruby, Emulsion.

## Catalog (45 badges)

| Category | Badge | Counts | Tiers (Bronze → Emulsion) |
|---|---|---|---|
| Getting started | First Light | Open a folder with files in it | single, 25 XP |
| | Globetrotter | Folders on 3 different drives | single, 50 XP |
| | Deep Diver | A folder 10 levels deep | single, 50 XP |
| | Quick Draw | Quick Look 10 different files | single, 50 XP |
| | Color Coded | A colour label or tag | single, 25 XP |
| | Plugged In | Sign in to a network share | single, 50 XP |
| Reviewing | Model Citizen | Different 3D models opened, no error | 5, 25, 100, 400, 1500, 5000, 15000 |
| | Light Meter | Different HDR / EXR files opened | 5, 25, 100, 400, 1500, 5000, 15000 |
| | Dailies | Videos and sequences played to the end | 1, 10, 50, 200, 800, 3000, 8000 |
| | Lookdev Lead | Different pairs compared | 1, 10, 50, 200, 1000, 4000, 10000 |
| | Format Hopper | 3D models in 4 formats | single, 100 XP |
| | Reading Room | A PDF and a Markdown file | single, 25 XP |
| | Mip Master | A .tx or .tex texture | single, 50 XP |
| Organising | Mover & Shaker | Files copied or moved, finished | 10, 100, 500, 2000, 10000, 50000, 100000 |
| | Tidy Desk | Files and folders renamed | 5, 50, 250, 1000, 5000, 20000, 50000 |
| | Taxonomist | Files given a label or tags | 10, 100, 500, 2000, 10000, 50000, 100000 |
| | Clean Sweep | Files sent to the Recycle Bin or deleted | 10, 100, 500, 2000, 10000, 50000, 100000 |
| | Interior Designer | Custom folder icons set | 1, 5, 20, 50, 150, 400, 1000 |
| Pipeline | Factory Line | Files batch converted | 10, 100, 500, 2000, 10000, 50000, 100000 |
| | Hand Off | Files sent to another app or dragged out | 1, 25, 100, 500, 2000, 10000, 25000 |
| | Twin Finder | Duplicate scans run to the end | 1, 5, 20, 60, 150, 400, 1000 |
| | Conversion Therapy | A batch convert with zero failures | single, 50 XP |
| | Full Set | Open a PBR texture set | single, 50 XP |
| Mastery | Pipeline TD | Finished file changes in total | 100, 1000, 5000, 20000, 100000, 500000, 1000000 |
| | Omnivore | Every kind of viewer (10) | single, 250 XP |
| | Flawless Week | 7 days in a row with work and no failed job | single, 250 XP |
| | Big Batch | 500+ files in one batch, none failed | single, 250 XP |
| | Completionist | Every badge you can see | single, 500 XP |
| Loyalty | Regular | Days of real work | 3, 10, 30, 100, 250, 500, 1000 |
| | Still Here | Months with a day of real work | 2, 4, 6, 12, 24, 36, 48 |
| | Weekly Ritual | Weeks with 3+ days of real work | 1, 4, 12, 26, 52, 104, 156 |
| Happy accidents (10 XP) | It Worked on My Machine, Render Farm Is Down, 404 Share Not Found, Wrong Password Again, That's Not a File That's a Feeling, Pixel Soup, Conflict Resolution, Cancel Culture, Nothing to See Here | harmless failures | single |
| Secrets (shown as "?") | Night Shift, Weekend Warrior, Long Take, One Year In, Professional Clown | | single |

A "day of real work" is a day with a finished job or a real file opened. Opening the app and leaving it counts nothing.

Release switch: badges with a `feature` key show "Coming soon" unless the feature is in `SHIPPED` (src/achievements/core.js).

## Certified showreels (sets)

Three sets of four ladder badges. All four at a tier make that set's showreel of that metal (7 per set).

- The Reviewer: Model Citizen, Light Meter, Dailies, Lookdev Lead.
- The Wrangler: Mover & Shaker, Tidy Desk, Taxonomist, Clean Sweep.
- The Pipeline: Factory Line, Hand Off, Twin Finder, Pipeline TD.

## The Emulsion gate (FREE MODE)

Emulsion (tier 7) opens only when ALL of these hold, checked after each real event (never by a timer):

1. Level 30 or higher (about a year of normal use).
2. 180 days of real work, in at least 6 different months.
3. 3 ladder badges at Ruby.
4. Tool factor: 50,000 files organised (copied, moved, renamed, labelled, deleted, converted, handed off) and 1,000 3D models
and HDR / EXR files reviewed (different files, loaded with no error).

When it opens: one moment (the bubble big, what was done to earn it, "Let's go"), then ladders already past their Emulsion
count climb quietly. Rank Emulsion also needs level 40. A showreel turns Emulsion when all four pieces are Emulsion.
The Achievements screen shows each condition honestly with a tick or "have / need".

## Theme: lens iris medals and certified showreels

Picked by the owner on 2026-11-21 (options: lens iris medal, clapperboard plaque, film plate).

- Why: the app is made for CG and VFX artists. What they are proud of comes from the camera and the screening room, so a
medal whose face is a camera iris (six aperture blades round the icon) reads as theirs, and the blades catch the shader
light well. Sets are framed film reels on a wall: "Certified Gold · The Wrangler".
- Tiers 1-4 (Bronze, Silver, Gold, Platinum): struck metal medal, brushed blades with shadows, a hex opening with the icon
frosted inside, the badge, tier and date engraved round the rim on big medals.
- Tiers 5-6 (Diamond, Ruby): the same iris on a dark gunmetal plate, the rim carved from the stone, a real cut stone seen
through the opening (refraction, dispersion, Fresnel, absorption).
- Tier 7 (Emulsion): the live soap bubble with the app's mark (the layers icon) inside. Same shader as every Emulsion Labs tool.
- Full view: the medal as a real slab you can tilt; a click turns it over to its certificate (number `CGB-xxxx`).

Theme contract: `shape: 'iris'` (gem.js shape 3), `metalLabel: 'Certified'`, `back: 'certificate'`, `pocketIcon: true`.

## Files

- `src/achievements/core.js`: pure logic (catalog, curve, apply, merge, normalize, gate). No UI. Tests: `npm run test:achievements`.
- `src/achievements/observer.js`: watches the bridge calls and job events, saves; the viewers call `opened` / `watched`.
- `src/achievements/level.js` + `pill.css`: the small level pill in the side rail (loads with the app).
- `src/achievements/ui.js` + `achievements.css`: screen, pop-ups, level-up, full view, settings (loads a moment after start).
- `src/achievements/bubble.js`, `gem.js`: the live shaders (one shared WebGL context each, 60 fps, still frame with reduced motion,
CSS / SVG fallback only where there is no WebGL).
- `src/components/AchievementsScreen.jsx`: React host for the screen and the Settings section.
- `src-tauri/src/achievements.rs`: `load_achievements` / `save_achievements`, two copies (local and roaming app data), merged on load.

## Storage

One small JSON object under 4 KB, key `cgabAchV1`:
`{ v, u (badge → first earned), k (badge → tier), kd (badge → day of each tier), ps (set → tier), lx, c (counters), f, d (today's flat XP), days, first, fm, dr, g (day the gate opened) }`.

- Saved to `achievements.json` in `%LOCALAPPDATA%` and `%APPDATA%` (roaming) app data, mirrored in the webview's storage.
All copies merge on load by union / max (badges keep the earliest date, tiers and counters the highest), so nothing is lost.
- Kept in this browser only: the pop-up queue `cgabAchNewV1`, the recently counted hashes `cgabAchSeenV1`, settings `cgabAchCfgV1`.

## Preview artifact

CG Artist File Browser Achievements: https://claude.ai/artifact/3vC7a42btzsMjEwxKgt9gy

Source: `docs/achievements-preview.html`, built by `node docs/build-achievements-preview.mjs` from
`docs/achievements-preview.template.html` and `docs/achievements-preview.entry.js`. Republish to the same URL; each change adds a
version to the Versions bar.
2 changes: 1 addition & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ git remote set-url origin https://github.com/rajhansgithub/CG_Artist_File_Browse

All agents (**Antigravity**, **Claude Code**) and human contributors must strictly adhere to **Semantic Versioning (`MAJOR.MINOR.PATCH`)** when determining the next release version.

**Current release version:** `1.23.0`
**Current release version:** `1.24.0`

`npm run version:check` (also run in CI) fails unless `package.json`, `src-tauri/tauri.conf.json`, `src-tauri/Cargo.toml` and the line above all carry the same plain `MAJOR.MINOR.PATCH` version.

Expand Down
104 changes: 104 additions & 0 deletions docs/achievements-preview.entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/**
* Source of the live preview page (docs/achievements-preview.html, the "CG Artist File Browser Achievements" artifact).
* It runs the app's real achievements code (core, observer, ui, shaders) on sample states, outside the app.
* Rebuild the page: node docs/build-achievements-preview.mjs
*/
import * as Core from '../src/achievements/core.js';
import * as Obs from '../src/achievements/observer.js';
import { renderScreen, mountSettings, startMoments, openView } from '../src/achievements/ui.js';
import '../src/achievements/pill.css';

const DAY = 86400000;
const today = Math.floor(Date.now() / DAY);
/** A sample: ladders at given tiers, some single badges, sets, counters. Dates spread back from today. */
const sample = ({ tiers, singles, sets, lx, gate, counters }) => {
const s = Core.empty();
for (const [id, t] of Object.entries(tiers)) {
const d = Core.BY_ID.get(id);
s.k[id] = t;
s.u[id] = (today - 30 * t - 20) * DAY;
s.kd[id] = Array.from({ length: t }, (_, i) => today - 30 * (t - i) - 20 + i * 9);
s.c[d.ladder.c] = d.ladder.at[t - 1] + Math.round(d.ladder.at[t - 1] * 0.3);
}
for (const id of singles) s.u[id] = (today - 12) * DAY;
s.ps = sets || {};
s.lx = lx || 0;
s.first = today - 400;
Object.assign(s.c, counters || {});
if (gate) s.g = today - 3;
return s;
};
const SAMPLES = {
week: {
label: 'First week',
make: () => sample({ tiers: { model_citizen: 2, light_meter: 1, dailies: 1, mover_and_shaker: 1, regular: 1 }, singles: ['first_light', 'quick_draw', 'reading_room', 'pixel_soup'], lx: 0, counters: { adays: 5, amon: 1, changes: 140 } })
},
year: {
label: 'A year in · Diamond rank',
make: () => sample({
tiers: { model_citizen: 6, light_meter: 5, dailies: 3, lookdev_lead: 4, mover_and_shaker: 4, tidy_desk: 3, taxonomist: 2, clean_sweep: 1, factory_line: 4, hand_off: 4, twin_finder: 4, pipeline_td: 4, regular: 3, still_here: 2 },
singles: ['first_light', 'globetrotter', 'deep_diver', 'quick_draw', 'color_coded', 'format_hopper', 'reading_room', 'mip_master', 'full_set', 'works_on_my_machine', 'pixel_soup', 'night_shift', 'conversion_therapy'],
sets: { reviewer: 1, wrangler: 1, pipeline: 4 }, lx: 9000, counters: { adays: 142, amon: 5, changes: 8000 }
})
},
gate: {
label: 'Emulsion gate open',
make: () => sample({
tiers: { model_citizen: 7, light_meter: 6, dailies: 5, lookdev_lead: 4, mover_and_shaker: 7, tidy_desk: 6, taxonomist: 6, clean_sweep: 5, factory_line: 4, hand_off: 6, twin_finder: 4, pipeline_td: 5, regular: 6, still_here: 5, weekly_ritual: 5, interior_designer: 3 },
singles: ['first_light', 'globetrotter', 'deep_diver', 'quick_draw', 'color_coded', 'plugged_in', 'format_hopper', 'reading_room', 'mip_master', 'full_set', 'omnivore', 'works_on_my_machine', 'pixel_soup', 'night_shift', 'conversion_therapy', 'weekend_warrior'],
sets: { reviewer: 4, wrangler: 5, pipeline: 4 }, lx: 60000, gate: true, counters: { adays: 300, amon: 10, changes: 60000, models: 15500, hdrs: 5100 }
})
}
};

const $ = (id) => document.getElementById(id);
const NEW_KEY = 'cgabAchNewV1';
const push = (items) => {
try {
const q = JSON.parse(localStorage.getItem(NEW_KEY) || '[]');
localStorage.setItem(NEW_KEY, JSON.stringify(q.concat(items)));
return true;
} catch {
return false;
}
};

function setSample(key) {
Obs.showSample(SAMPLES[key].make());
document.querySelectorAll('[data-sample]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.sample === key)));
}

function boot() {
// follow the viewer's theme; the toggle overrides it
const root = document.documentElement;
if (!root.dataset.theme) root.dataset.theme = matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
const syncTheme = () => document.querySelectorAll('[data-theme-pick]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.themePick === root.dataset.theme)));
document.querySelectorAll('[data-theme-pick]').forEach((b) => b.addEventListener('click', () => { root.dataset.theme = b.dataset.themePick; syncTheme(); }));
syncTheme();

document.querySelectorAll('[data-sample]').forEach((b) => b.addEventListener('click', () => setSample(b.dataset.sample)));
setSample('year');
renderScreen($('ach-live'));
mountSettings($('ach-settings'));
startMoments();

const note = $('ach-moment-note');
const moment = (items) => {
if (!push(items)) note.textContent = 'This browser blocks page storage, so the pop-up cannot be queued here.';
else note.textContent = 'Queued. It shows in about a second, once nothing else is open.';
};
const now = () => Date.now();
$('m-badge').addEventListener('click', () => moment([{ k: 'u', id: 'tidy_desk', tier: 3, from: 2, at: now() }, { k: 'l', from: 11, to: 12, at: now() }]));
$('m-ruby').addEventListener('click', () => moment([{ k: 'u', id: 'model_citizen', tier: 6, from: 5, at: now() }, { k: 'u', id: 'quick_draw', tier: 0, from: 0, at: now() }]));
$('m-set').addEventListener('click', () => moment([{ k: 'p', set: 'pipeline', from: 3, to: 4, at: now() }]));
$('m-gate').addEventListener('click', () => { setSample('gate'); moment([{ k: 'g', at: now() }]); });
$('m-level').addEventListener('click', () => moment([{ k: 'l', from: 20, to: 21, at: now() }]));
$('m-view').addEventListener('click', () => {
const st = Obs.getState();
const id = st.u.model_citizen ? 'model_citizen' : Object.keys(st.u)[0];
if (id) openView(id);
});
}

if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot);
else boot();
Loading
Loading