112 lines
6.7 KiB
Markdown
112 lines
6.7 KiB
Markdown
# Milestone 6: crafting and item quality
|
||
|
||
Implemented for manual testing. Open **Inventory and crafting → Crafting
|
||
workbench** in the game. In **Control → Game content**, use Recipes, Crafting
|
||
professions, Crafting materials, Crafting tuning, and Equipment.
|
||
|
||
## Player behavior
|
||
|
||
- Choose a profession and offer exact ingredient quantities. Ingredient order
|
||
does not matter. Unknown combinations fail and consume part of the offer.
|
||
- Matching a recipe records it on this character even when the craft fails.
|
||
Recipes with unmet stat/title requirements report the requirement without
|
||
spending materials or recording the recipe. Difficulty level is a probability
|
||
penalty, never an entry gate.
|
||
- Successful crafts spend all offered ingredients and create the authored outputs.
|
||
Only success grants profession and character XP. Hub crafting uses resources,
|
||
produces items, and records discoveries with every XP track unchanged.
|
||
- Higher profession levels reduce failure and resource loss, and favor higher
|
||
random stat rolls. Equipment keeps its fixed modifiers plus the configured
|
||
number of distinct weighted pool entries. Rolls are made once on the server.
|
||
- Crafted equipment and stacks retain maker character ID, maker name, world of
|
||
creation, profession/level, timestamp, and recipe ID/revision. Inventory shows
|
||
maker/world labels; equipment shows its actual rolled modifiers.
|
||
- Mixed stacks consume unmarked units first, then crafted batches in acquisition
|
||
order. Dropping part of a batch preserves provenance under a new batch ID.
|
||
Death, looting, restart, and world travel preserve the remaining provenance.
|
||
- Profession XP and discovered recipes belong to the character. Replacement
|
||
starts them fresh. Previous generic crafting XP remains as historical progress;
|
||
it is not copied into nine new professions.
|
||
|
||
## Administration
|
||
|
||
Recipe forms select a profession, difficulty, XP reward, inputs/outputs, and
|
||
optional stat/title requirements. Permanent definition IDs and recipe revisions
|
||
are assigned by the server. Edit a recipe to publish its next revision using the
|
||
same identity; concurrent stale edits are rejected. Old discoveries retain their
|
||
recorded version until the character experiments with the new recipe. Refresh
|
||
known recipes in the workbench to identify revised discoveries.
|
||
|
||
Crafting professions use the same reusable XP-curve definition as gathering.
|
||
Materials are stackable recipe inputs/outputs, and can be granted/removed using
|
||
player controls or selected in loot tables. Equipment creation includes a
|
||
weighted stat pool, flat/percentage ranges, and roll count. Published equipment
|
||
definitions and existing owned rolls remain immutable.
|
||
|
||
Recipes stay out of public configuration and the browser bundle. The authenticated
|
||
crafting endpoint returns only that character's discoveries. Admin catalog access
|
||
still requires the existing admin role.
|
||
|
||
## Provisional tuning and limits
|
||
|
||
Defaults live in `server/content/balance.yaml`; Control can publish tuning changes:
|
||
|
||
- Equal-level failure: 25%. Above-level failure decays exponentially to 1%; below
|
||
level failure rises exponentially toward 99.9%. Under-level attempts are allowed.
|
||
- Failure loses 80% of each ingredient at level 1, decreasing exponentially to
|
||
10%. Quantities round up, with at least one unit lost per offered ingredient.
|
||
- Quality bias grows by 0.03 per profession level beyond 1, capped at 8.
|
||
- Each profession starts at level 1: 100 XP for level 2, +50 XP per next level,
|
||
maximum level 1000. Starter successes award 20 profession XP.
|
||
- One-second attempt cooldown; 1–16 ingredient types, 1–1000 units each; at most
|
||
eight output types and 100 output units. Each character can hold 2048 crafted
|
||
stack batches. Equipment supports up to eight rolls from 32 possible pool entries.
|
||
|
||
Crafting currently works anywhere an alive, online, unsheltered character may act,
|
||
with daily time remaining. Stations, craft channels, equipment as ingredients,
|
||
food/trap activation, rune application, and structure placement are future work.
|
||
Cook, trap master, rune master, builder, and the other professions can produce
|
||
components now; components do not gain action effects from their names.
|
||
|
||
## Durability
|
||
|
||
`craft_receipts` stores an account-scoped attempt ID, exact request, and saved
|
||
result. Consumption, discovery, rolls, XP, provenance, and receipt commit in the
|
||
same lease/revision-fenced world transaction before publication. Reusing an ID
|
||
with different inputs is rejected; repeating the same request returns its result
|
||
without another roll or spend, including after restart or travel. The browser
|
||
retains an uncertain attempt in session storage and offers a retry.
|
||
|
||
Legacy saved catalogs/worlds receive the initial crafting definitions once.
|
||
Existing owned items are unchanged. Deployment requires the normal database
|
||
migration and a coordinated server/client build. Old clients using recipe-name
|
||
craft intents receive a message to use the workbench.
|
||
|
||
## Manual checklist
|
||
|
||
1. Grant wood, ore, and herbs through Control. In Weapon Smithing, offer wood ×3
|
||
and ore ×2. Confirm valid feedback/discovery on either outcome. On success,
|
||
inspect the spear's random bonus, maker, and world. Try wood ×1 for invalid
|
||
feedback and resource loss without discovery/XP.
|
||
2. Try Alchemist with herbs ×2. Confirm successful bandages carry maker/world
|
||
labels; use, drop, and loot them, including a stack mixed with granted bandages.
|
||
3. Create a material and recipe in Control, preview and publish. Confirm a player
|
||
sees it only after discovering it. Edit it and verify revision increases without
|
||
a duplicate recipe; refresh the player's known recipes and rediscover it.
|
||
4. Create equipment with a stat pool and recipe. Compare actual rolled modifiers
|
||
between crafts. Raise recipe difficulty to exercise under-level failures, then
|
||
use low XP thresholds on a test profession to compare higher-level outcomes.
|
||
5. Bring ingredients to a hub. Craft successfully and fail a valid recipe;
|
||
confirm spending/discovery while character and profession XP stay unchanged.
|
||
6. Reload/travel after crafting, inspect provenance, and check known recipes and
|
||
profession XP. If a request is interrupted, retry the pending attempt and
|
||
confirm inventory does not duplicate. Replacement must reset discoveries/XP.
|
||
7. Check the workbench and recipe forms on mobile, keyboard focus, and Esc closing
|
||
the focused menu. Report layout or interaction issues before the next milestone.
|
||
|
||
Focused Go coverage exercises recipe validation/revisions, failed and successful
|
||
crafts, quality distributions, hub XP, death/loot/consumption/replacement, restart,
|
||
travel, replay, stale-lease rollback, daily-time rejection, and HTTP auth/secrecy.
|
||
PostgreSQL variants require `TEST_DATABASE_URL`. Browser automation stays deferred
|
||
in [PLAYWRIGHT-TODO.md](../planning/PLAYWRIGHT-TODO.md).
|