Bannerlord mechanics

Smithing solver

Bannerlord v1.4.8 · checked 2026-11-10 · updated 2026-11-11

Research toward a solver that searches crafting recipes for the best weapon per goal: what was measured, what was rejected, and the candidate design. The findings were measured on game v1.4.6. The solver design targets v1.4.8, whose smithing IL and crafting XML are identical to v1.4.6 (method-by-method comparison: Value and price). Evidence: research/smithing-solver/challenge/round{2,3}/.

The formulas the solver evaluates are in the crafting deep dives: Weapon stats, Value and price and Smithing mechanics. The game rules for part unlocking and orders are in Smithing mechanics.

Evidence labels:

Decisions

Search-space approaches

Approach Result Verdict
Merge physically identical pieces 1.4× fewer recipes Keep
Same-geometry blades, keep the best factor Keeps 132/135, provable Keep, small effect
Closed-form evaluation with a speed table 127.8M recipes in about 2 minutes in numpy Keep. Lowers cost per recipe, not recipe count
Apply numeric limits early speed >= 90 leaves 79.6M of 127.8M Only tight limits prune much
Formula upper bounds per recipe group Never run Unknown
Shipped dominance lists Failed 41/96 Rejected
Dominance on the player's own pool 40–99% fewer recipes, 3/288 losses Candidate
Fixed scale patterns per weapon type Fails with numeric limits Rejected as the main search
17 scale points, then climb the top 5 Mean loss 0.22, max 5 Baseline
Local search Lost up to 15 with numeric limits Instant first answer only
Per-piece effects, rank, exact check About 6,700× fewer evaluations on the largest pool Lead candidate

Fixed patterns vs scale sampling

Winner across a whole pool, 600 cases, all 12 templates. Exhaustive baselines used small pools (320 recipes for 4-slot templates). Loss is in displayed stat points. Test.

Method Mean loss Max loss Pool winner kept Evaluations per recipe
Scale 100 only 4.45 53 71% 1
1 fixed pattern 2.92 49 71% 1
8 fixed patterns 0.41 37 96% about 2,040
17 scale points, then climb the top 5 0.22 5 not measured about 3,950

Dominance

Speed tables

Per-piece effects

Method:

  1. Measure the effect of each (piece, scale) on each stat, on a set of random base weapons.
  2. Predict a recipe as the mean base stat plus one effect per slot.
  3. Rank recipes by predicted score, with numeric limits relaxed by the 95th-percentile prediction error.
  4. Evaluate the top K exactly.

Fit cost = bases × (levels across all slots + 1): 13,920 evaluations for 30 bases on OneHandedSword at scale 100.

Stability of one same-slot swap across weapons, 72 small-pool cases, all 12 templates. Test.

Stat Spread of the % change, p5–p95 Swaps where the better piece flips
Weight 2.6–3.6 points 0%
Length 1.9 points 0%
Speed 1.9–2.0 points 3–4%
Handling 2.0 points 5–7%
Thrust damage 4.0–4.3 points 27–35%
Swing damage 5.4–6.0 points 38–41%

Loss at 10,000 exact checks, 30 bases, additive points, two fit seeds. Single-stat and limit goals lose stat points. Equal-priority goals lose points on a 0–100 score. Limits are percentiles of the pool's stat, for example speed top 5%. Test.

Goal OneHandedSword 160M, scale 100 OneHandedSword 207M, scaled TwoHandedSword 207M, scaled
Max damage 0 / 0 1 / 1 0 / 0
Max speed 0 / 0 0 / 0 0 / 0
Damage = speed 1.3 / 1.1 2.3 / 2.9 1.2 / 1.6
Damage = speed = handling 0 / 0 0 / 0 0 / 0
Damage = lightness 0 / 0 0 / 0 0 / 0
Damage, speed top 25% 1 / 1 no valid result 2 / 2
Damage, speed top 5% 0 / 0 0 / 0 4 / 4
Damage, handling top 5% 1 / 1 0 / 0 0 / 0

Not covered:

Candidate pipeline

Not approved or tested end to end.

  1. Filter to unlocked, non-hidden pieces, or all parts when ticked, marking results that can't be crafted.
  2. Merge identical pieces.
  3. Measure per-piece effects at load, with at least 30 bases.
  4. Walk the best predicted combinations from the top.
  5. Check candidates exactly, adding more until numeric limits are met.
  6. Refine scales on the best candidates within ±10.
  7. Hide repeats of the same pieces and run a final exact check.

Goal ranking

Priority order:

Equal priority:

maximize: (value − min) ÷ (max − min)

minimize: (max − value) ÷ (max − min)

score = sum of weight × scaled value

Methods compared on 160,000 exported one-handed swords, one template, scale 100. Values are damage / speed / handling. The last column recalculates ranges without wooden blades (5% of the data). Test.

Method Damage = speed + handling Without wooden blades
Sum in standard deviations 90/93/93 65/103/104 92/92/92, 65/103/104
Sum, min-max range 92/92/92 65/103/104 95/90/87, 65/103/104
Sum, 5–95% range 89/93/94 67/102/102 92/92/92, 73/98/99
Sum of percentile ranks 80/94/93 72/98/101 80/94/93, 77/96/97
Geometric mean 90/93/94 65/103/104 92/92/92, 89/93/95
Closest to ideal 90/93/94 65/103/104 90/93/94, 89/93/95
Best worst stat 73/98/97 73/98/99 90/93/94, 89/93/95
Worst percentile rank 77/96/97 77/96/97 80/94/93, 78/94/97
damage·(speed/100)^1.5 92/92/91 handling ignored 92/92/91

Order solving

Test: treating orders as per-stat minimums found a valid design in 76% of cases, vs 100% for the sum rule, at higher difficulty and material use. Candidate rule: minimize material cost subject to sum and damage type, showing the success chance.

Invalidated results

Claim Status
Scale-pattern table from the first spike Not reproducible: recipes were drawn from an unordered set
Polearm pattern caused by handle drag Noise
One-handed sword with a limit loses at most 1 No pattern met the limit on some recipes in 3 of 4 reruns
Pruning lost the best weapon, 103 vs 104 Probably wrong: the 103 had no exact check
Fast evaluator results stated as exact Off by up to 2 damage on 15–30% of recipes and 1 speed on 6–16%
Min-max is fragile Applies only when ranges are recalculated per pool

Held up across the scale reruns: all-90 scale was exact for maximum speed and handling, and maximum-damage patterns for swords and maces stayed near 110.

Open questions

Solver design

Pools

Craftable pool = non-hidden ∩ template UsablePieces ∩ usage AvailablePieces, then unlocked pieces, then material ticks (remove pieces needing an unticked material).

Architecture

Part Offline (CI) Shipped Runtime (C#, net472)
Evaluator parity vs ev.c (bit-identical) nothing step tables built at load (s; polearm lazy)
Fight GPU exhaustive truth suite nothing exact B&B (sbb3) over filtered pool
Order truth suite nothing exact top N by P(success)
Native optional smcore.dll (AVX-512/2) optional LoadLibraryW by full path, C# fallback

Results

Order model

Evidence

Open

  1. In-game confirmation: v1.4.8 re-export; order quality rolls and gold.
  2. In-process: module DLL loading, Harmony coexistence, non-AVX2 CPUs.
  3. Order modes at 21 scales and swords at 90/100/110.
  4. Sell market model not validated in game.