Skip to content

five-on-it / apps/api/src/respect

apps/api/src/respect ​

An account's standing kept and applied (GAME_DESIGN §14, TECHNICAL_SPECS §9.6): the Respect service pays each settled run's seats their Respect, moves their conduct and rates their hidden skill (standing.ts' rules, skill.ts' Glicko-2), keeps the endorsements and the players' ratings of missions, and answers what the routes (respect-routes.ts), the lobbies (the gates, the tiers on the members, the teams balanced by skill) and Quick play (the gates, the conduct pool, the skill nearest) ask of it.

When a run ends (RunContext.onEnded, once per settled run) the service pays it, before its lobby shows the results: nothing for a playtest, an abandoned or a lost run, or one where a debug command was honoured (its result's debug: no endorsement or rating either); else each account's seat (never a guest's) a ledger line keyed by the run and the account, so a run pays an account once whatever happens after: its Respect step by step, its conduct and why, its skill after a versus run (the seats that were there alone); and the run counted in its mission version's tally (by the result's missionHash) when a qualifying player played it and its creator did not (standing.ts' qualifyingPlayer). Each account's award is one transaction of the store's (Store.withStanding), and the run is marked paid once every seat was: a payment that failed is paid again by the sweep (Respect.payMissed), each line once by its key. Its writes go one at a time (an endorsement waits for the run it is about to be paid, and is refused until it was), in the API's one process: the lobbies live in its memory anyway.

What the lobbies read is answered at once from what the service keeps in memory of the accounts it was asked to look at (warm, before a lobby is opened or joined, a run started or Quick play placed): their Respect, conduct and skill (at most 10,000 accounts, the least lately used let go; an account with no standing is kept as nothing, a new one's answered for it), and whether a creator's mission's version qualified (kept 30 s), its version told by the hash of the mission as its creator wrote it (the game's source, as the game server hashes it: missionVersionHash). Every change goes through the service, so what it keeps stays the store's.

FOI_RESPECT (RespectMode): on (the default) shows and gates; shadow computes and stores everything but shows nothing (the routes answer 404, the lobbies show no tiers, nobody is gated, nobody pooled, the teams made as without it); off computes nothing either.

Classes ​

Interfaces ​

Variables ​

Functions ​