score
The driver progression scoring core as pure functions (no entities, no UI). `Score.new(style)` makes a state; `Score.step(state, sample, dt)` takes one driving sample (`kmh`, `speed`, `slip`, `airborne`, `impactCount`, `impactSpeed`, `damage`) and returns the events earned that f…
driveProgress.score
The driver progression scoring core as pure functions (no entities, no UI). Score.new(style) makes
a state; Score.step(state, sample, dt) takes one driving sample (kmh, speed, slip,
airborne, impactCount, impactSpeed, damage) and returns the events earned that frame —
speed milestones, drift chains (slides chained into a multiplying combo, dropped by a hard crash in
some styles), air time on landing, crashes, distance, challenge completions and level-ups — each
with its XP and toast text in the style's wording. Also levelInfo, xpForLevel, addChallenge,
removeChallenge, challenges, complete, bonus, live, setStyle (keeps XP), reset, log.
Called by the DriverProgress and ProgressGallery components, and usable for a HUD or server of your own.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2strict
round1(x: number) → string
| arg | type | description |
|---|---|---|
| x | number |
new(styleId: string?) → any
A fresh progression state for a style.
| arg | type | description |
|---|---|---|
| styleId | string? |
xpForLevel(st: any, level: number) → number
Total XP at which `level` starts under the state's style.
| arg | type | description |
|---|---|---|
| st | any | |
| level | number |
levelInfo(st: any) → any
{ level, xp, into (XP into this level), need (XP this level takes), frac (0..1), rank, style } for a state.
| arg | type | description |
|---|---|---|
| st | any |
push(st: any, out: { Event }, ev: any) → void
| arg | type | description |
|---|---|---|
| st | any | |
| out | { Event } | |
| ev | any |
gain(st: any, out: { Event }, xp: number) → void
Add XP and emit a level event for every level crossed.
| arg | type | description |
|---|---|---|
| st | any | |
| out | { Event } | |
| xp | number |
award(st: any, out: { Event }, ev: any) → void
| arg | type | description |
|---|---|---|
| st | any | |
| out | { Event } | |
| ev | any |
addChallenge(st: any, def: any) → any
Add (or replace) a challenge: { id, text, kind = speed|drift|air|crash|distance|level|combo|custom, target, xp }. `custom` challenges only complete through Score.complete. Returns the challenge record.
| arg | type | description |
|---|---|---|
| st | any | |
| def | any |
removeChallenge(st: any, id: string) → boolean
Remove a challenge. Returns whether it existed.
| arg | type | description |
|---|---|---|
| st | any | |
| id | string |
challenges(st: any) → void
Challenges in the order added, as copies: { id, text, kind, target, xp, done, progress (0..1) }.
| arg | type | description |
|---|---|---|
| st | any |
finish(st: any, out: { Event }, c: any) → void
| arg | type | description |
|---|---|---|
| st | any | |
| out | { Event } | |
| c | any |
complete(st: any, id: string) → void
Complete a challenge now (any kind). Returns the events it caused (the challenge and any level-ups).
| arg | type | description |
|---|---|---|
| st | any | |
| id | string |
checkChallenges(st: any, out: { Event }, now: any) → void
live = { speed = kmh, drift = s, air = s, crash = kmh, combo = links } measured this step
| arg | type | description |
|---|---|---|
| st | any | |
| out | { Event } | |
| now | any |
bankChain(st: any, out: { Event }, ev: any) → void
| arg | type | description |
|---|---|---|
| st | any | |
| out | { Event } | |
| ev | any |
step(st: any, s: any, dt: number) → void
Advance one frame. Returns the events earned this frame (possibly none).
| arg | type | description |
|---|---|---|
| st | any | |
| s | any | |
| dt | number |
live(st: any) → any
What is happening right now: { drift (s in the running chain), combo (links), air (s), damage, distance (m) }.
| arg | type | description |
|---|---|---|
| st | any |
bonus(st: any, xp: number, why: string?) → void
Add XP by hand (a bonus of your own game). Returns the events (a `bonus` award and any level-ups).
| arg | type | description |
|---|---|---|
| st | any | |
| xp | number | |
| why | string? |
setStyle(st: any, styleId: string) → void
Switch style, keeping the XP earned: the level is recomputed under the new curve. A running chain is dropped.
| arg | type | description |
|---|---|---|
| st | any | |
| styleId | string |
reset(st: any) → void
Back to zero XP, level 1, no bests; challenges stay but are no longer done.
| arg | type | description |
|---|---|---|
| st | any |
log(st: any) → void
Recent events, newest last (at most 40).
| arg | type | description |
|---|---|---|
| st | any |
Event = {Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.