Checkpoint stats equipment and control catalog implementation

This commit is contained in:
dingo
2026-09-08 05:37:47 -04:00
parent 030253ceff
commit 2df1f6ab38
25 changed files with 1033 additions and 284 deletions
+26 -12
View File
@@ -56,7 +56,8 @@ from network interest. The server retains mutation deltas across chunk eviction.
The finite circular world, 48-unit spawn separation, 100-character capacity,
combat numbers, terrain details, mob scaling, and respawn periods are provisional
defaults. They are not newly confirmed design decisions. Balance is validated and
persisted with the world; editing YAML affects newly created world IDs only.
persisted with the world. YAML initializes new worlds; Control publishes a shared,
versioned title/equipment/stat catalog that world owners apply and checkpoint.
## Durability and ownership
@@ -92,12 +93,13 @@ checkpoints, versioned migrations, and crash/latency fault injection.
## Progression and permanent titles
The Go simulation awards character XP for successful gathering, crafting, mob
kills, and the boss killing blow. Each crossed level threshold banks stat points;
there is no allocation intent until the stat design is defined. Levels, XP,
points, and the character's original level curve survive restart and survivor
passage. Replacement characters start at level 1. Existing snapshots receive
level 1 and the initial progression defaults once, without retroactive XP or
points, while preserving deaths and daily usage.
kills, and the boss killing blow. Each crossed level threshold banks 10 stat points,
adds 5 stamina, and banks a choice of 5 maximum health or mana. Seven primary
attributes accept allocation intents; all derived values are calculated in Go.
Levels, choices, allocations, XP, and the character's level curve survive restart
and survivor passage. Replacement characters start at level 1. Legacy characters
receive the extra points and pending vital choices for already-earned levels once,
while retaining deaths, XP, and daily usage.
Title requirements are evaluated in Go and produce ordered award candidates.
The shared database resolves first-world and first-ever claims in the same
@@ -110,11 +112,23 @@ This account inheritance is the initial interpretation of player-bound titles.
Awarded names, descriptions, effects, and provenance are copied at grant time;
later content changes do not remove or alter an earned title.
All earned title effects are active and additive, once per title ID. The initial
effect hooks are damage and movement speed; both accept positive and negative
values, with effective damage/speed floored at zero. They cannot alter death,
the daily play budget, or passage eligibility. The broader stat and effect
catalog remains open. See [progression configuration](PROGRESSION.md).
All earned title effects are active once per title ID. Flat bonuses are summed,
then combined percentage bonuses apply. Modified primaries feed the derived-stat
formulas. Existing damage/movement effects remain compatible. None can alter death,
the daily play budget, or passage eligibility. See [progression configuration](PROGRESSION.md).
Control publications serialize on a singleton catalog row, check the editor's
expected version, and record an immutable audit entry in the same transaction.
Title/item IDs are append-only; stat formulas can be updated. Owners poll under
the simulation lock and checkpoint updates before snapshots. New title requirements
are evaluated on the next gameplay event. Published content cannot rewrite earned
title awards or acquired equipment snapshots.
Equipment instances retain identity across equip, drop, corpse loot, and passage.
All equipment effects are excluded when checking prerequisites, preventing items
from enabling themselves or each other. Invalidated equipment returns to the bag.
Legacy knife/spear stacks migrate once, including corpses; duplicate instance IDs
within a world fail restoration. Materials and consumables remain quantity stacks.
## Security scope
+108 -72
View File
@@ -1,92 +1,128 @@
# Levels and permanent titles
# Levels, stats, titles, and equipment
Levels belong to a character. Titles belong to an account in this first pass,
so a new life inherits titles while starting at level 1 with no XP or stat
points. A dead character remains dead and keeps its historical progression.
Survivor passage preserves levels, XP, points, titles, and the daily time budget.
Levels belong to a character. Titles retain the existing account-bound interpretation
of player ownership: replacement lives inherit titles, while starting at level 1.
Dead characters retain historical stats and stay permanently dead. Survivor passage
preserves XP, allocations, pending rewards, titles, equipment, and the daily budget.
## Provisional level tuning
## Level rewards
Edit `server/content/balance.yaml`. New characters start at level 1. Reaching
level 2 takes 100 XP; each following threshold costs 50 XP more. Every level
awards 5 banked stat points. The current safety cap is level 1000. All of these
values are configuration, not a settled stat or balance design.
Each level-up grants **10 allocatable stat points**, **5 maximum stamina**, and a
choice of **5 maximum health or 5 maximum mana**. Choices and points may be saved.
Increasing a maximum does not heal/refill the pool. The server accepts one primary
point per `allocate-stat` intent and one pending reward per `choose-vital` intent.
Overspending, derived-stat allocation, and actions after death/daily cap are rejected.
Successful gathering gives 10 XP, crafting 20 XP, a sentinel kill 50 XP, and
the boss killing blow 500 XP. Nonlethal hits, failed actions, duplicate requests,
and actions after death give no XP. XP beyond a threshold carries into the next
level, including multiple level-ups from one reward. XP stops at the cap.
Initial tuning: level 1 start, 100 XP to level 2, thresholds increasing by 50 XP,
level 1000 cap. Gathering awards 10 XP, crafting 20, sentinel kills 50, boss killing
blow 500, modified by XP gain. Failed actions/nonlethal hits grant no XP. Threshold
overflow carries forward, including multiple level-ups. Activity tuning lives in
`server/content/balance.yaml` and a character's saved reward/XP curve follows it.
There is no stat allocation or client XP-grant API. Points remain banked until
the full stat system is designed. Character level curves and point grants are
stored with the character, so moving into differently tuned worlds cannot reset
or reprice earned progress. Activity XP rewards use the destination world's tuning.
Legacy five-point characters receive five extra points and one pending vital choice
per earned level once. Migration preserves XP, deaths, and daily usage and is idempotent.
## Title definitions
## Stats
The YAML `titles` list is the initial authoring interface. Each entry needs a
stable `id`, `name`, `description`, `scope`, one or more `requirements`, and
`effects`. Requirements are ANDed and use positive integer `atLeast` thresholds.
| Requirement metric | Meaning |
| Allocatable primary | Derived stats |
| --- | --- |
| `level` | Current character level |
| `kills` | Lifetime sentinel kills for this character |
| `worldKills` | Sentinel kills since arriving in this world; resets on passage |
| `bossKills` | Boss killing blows for this character |
| `worldsSurvived` | Worlds survived when their boss dies, including offline survivors |
| `gathering`, `crafting`, `combat` | Existing character skill XP counters |
| `deaths` | 1 when this character dies, otherwise 0 |
| Constitution | Health points, endurance, resistance, health recovery |
| Intelligence | Magic damage, knowledge, spell points, mana points |
| Dexterity | Movement speed, ranged damage, critical chance, endurance, dodge chance, stamina recovery |
| Strength | Close-combat weapon damage, heavy-weapon damage, carrying capacity, endurance, defence |
| Wisdom | Knowledge, resistance, skill points, XP gain, mana recovery |
| Charisma | Buff effectiveness |
| Luck | Critical chance, drop rate, gathering rate, dodge chance |
Control character details and the player panel show **base / flat / percent / final**.
Primary base = configured base + allocated points. Derived base adds the contributions
of **final primary values** and level pool rewards. Each stat then uses:
`final = max(0, (base + sum(flat)) * max(0, 1 + sum(percent)/100))`
Health capacity has a floor of 50 for daily-limit safety. Critical/dodge chances cap
at 100%. Recovery rates are points per online simulation second. XP, drop, gathering,
and buff-effectiveness rates start at 100 (100%). Critical/dodge values are percentage
points. Critical damage uses `criticalMultiplier` in balance YAML.
Coefficients are provisional and editable through Control -> Content -> Stat formulas.
Constitution initially adds 5 health, 1 endurance, 0.5 resistance, and 0.02 health
recovery per point. Formula changes clamp current pools when maxima fall, without
healing or rewriting a dead life's stat record.
Current gameplay consumes health, movement, melee damage, defence, dodge, critical
chance, recovery, XP gain, drop rate, and gathering rate. Other listed stats are
calculated, inspectable, and available in requirements/effects. Dedicated spell,
ranged/heavy attack, skill-spending, timed-buff, stamina-cost, and encumbrance mechanics
await their later scope. Carry weight/capacity is advisory; stack units have weight 1.
## Control authoring
Administrators publish titles, equipment, and stat formulas in **Control -> Content**.
Publications require a reason and the current catalog version. Stale edits conflict;
identical request retries are idempotent. An immutable database audit records actor,
operation, target, reason, and version. World owners apply updates during their normal
control poll (about one second) and before joining, checkpointing before snapshots.
World records expose the applied version. Offline owners apply updates when resumed.
YAML seeds the catalog once. Later YAML edits do not overwrite published content.
Title/item definitions are append-only: use a new ID for a variation. Acquired items
and earned titles retain their original definition snapshots. Stat formulas are editable.
## Permanent titles
Requirements are ANDed positive integer thresholds. Metrics: level, kills, worldKills,
bossKills, worldsSurvived, gathering/crafting/combat skill XP, deaths, and any primary
or derived stat. worldKills resets on passage; deaths is 1 at death. Stat requirements
compare the final server-calculated value.
| Scope | Award policy |
| --- | --- |
| `personal` | Any qualifying account can earn the title once |
| `world` | First qualifying account to commit the title claim in a world |
| `global` | First qualifying account to commit the title claim across the shared database |
| Personal | Every qualifying account earns the title once |
| World | First qualifying account to commit a claim in that world |
| Global | First qualifying account to commit across the shared database |
“First ever” is determined by the first committed eligible transaction, starting
when the title is introduced. It cannot reconstruct an achievement predating
the title system. All production worlds must share the PostgreSQL database.
Within a world, candidates follow simulation event order. Simultaneous survivor
milestones break ties by character ID. An account already owning a title does
not earn it again or stack its effects by visiting another world.
First claims start when the title is introduced; earlier achievements cannot be
reconstructed. Requirements evaluate on gameplay events, not editor publication.
Candidates follow event order; simultaneous milestones use stable character-ID order.
The world snapshot and title ledger commit atomically before effects become visible.
The shipped starter examples are Wayfarer (level 2, +1 damage), First Hunter of
the World (first sentinel kill in a world, +2 damage), and The First Hunter
(first sentinel kill globally, +3 damage and -0.5 movement speed).
Every owned title is active once per ID forever. Flat and percentage modifiers may
be positive or negative and target any stat. Legacy damage/moveSpeed effects remain
compatible. Titles cannot be removed, traded, revoked, or lost if requirements cease
to hold. Content edits do not alter earned awards.
Effects are additive `damage` and `moveSpeed` values using existing game units.
Negative values are supported. Every owned title is active; effective damage
and movement speed cannot go below zero. There is no equip, remove, trade, or
revoke action. Future stat/effect hooks can extend this catalog without deciding
the final player stat list now.
## Inventory and equipment
```yaml
- id: burdened_survivor
name: Burdened Survivor
description: Survive a world after defeating at least ten sentinels.
scope: personal
requirements:
- { metric: worldsSurvived, atLeast: 1 }
- { metric: kills, atLeast: 10 }
effects: { damage: 4, moveSpeed: -1 }
```
The 21 slots are helmet, mask, chest, shoulders, pants, boots, gloves, earrings,
necklace, ring1 through ring8, weapon, offhand, cape, and bag. Ring definitions use
category `ring`; players choose one of eight slots. Offhand definitions can represent
a shield or offhand weapon.
Worlds persist their balance and title catalogs. YAML edits apply to new world
IDs; they do not hot-edit existing worlds or already-earned titles. Existing
worlds without progression are upgraded once with the starter defaults on
restore, with no retroactive XP or automatic historical first claims. New
definitions can match existing counters on the next qualifying gameplay event.
Treat published title IDs as permanent identities. Use a new ID for a distinct
award rather than repurposing an existing one.
Definitions specify weight, level and optional stat/title requirements, plus signed
flat/percentage modifiers. Requirements exclude **all equipment effects**, preventing
self-enabling gear or mutually enabling pairs. Ineligible gear automatically returns
to the bag. Occupied slots must first be explicitly unequipped.
Equipment instances have unique IDs and snapshot their definitions. Equipping only
changes a slot assignment. Bags hold unequipped gear and resource/tool/consumable
stacks. Starting knives and crafted spears are gear; spear damage requires equipping.
Dropping moves one stack unit or one instance to a ground pile. Loot transfers whole
piles atomically. Death moves equipped/bag gear and stacks to the corpse. Passage
preserves IDs; duplicate item IDs within a world fail restoration. Legacy knife/spear
stacks migrate once, including corpses.
Control can set an equipment definition's per-sentinel-kill drop chance (0-100%). The
player's drop-rate multiplier applies, capped at a guaranteed drop. Zero disables
sentinel drops for that definition. Starting and crafted gear retains those existing
acquisition paths. There is no arbitrary browser inventory grant.
## Verification and limits
Game tests cover successful-action XP, multi-level grants, caps, migration,
signed effects, death, daily limits, and survivor progress. Store tests cover
durable title claims, first-award races, retries/rollback, inheritance, and stale
source worlds. PostgreSQL integration tests require `TEST_DATABASE_URL`.
Tests cover formulas, allocation, choices, migration, requirements, death/drop/loot,
passage, title claims, catalog publication/replay/conflicts, and checkpoint failures.
PostgreSQL integration tests require `TEST_DATABASE_URL`; SQLite tests run by default.
Browser tests cover player panels and Control authoring.
The tested world capacity is unchanged. This remains the existing checkpoint
persistence model: unacknowledged actions can be lost on a crash, and storage
failures freeze the owner before it can publish speculative progression.
Tested capacity is unchanged. Existing checkpoint limits still apply: unacknowledged
actions may be lost on a crash; storage failure freezes further world snapshots.