Assembly is an AssemblyDistribution: Faction key 19, optional per product, stated-quality mint

Replaces h1's AssemblyMean/AssemblyDeviation floats with one Faction.Assembly (key 19, null = not authored) and adds FactionProductData.Assembly (key 6, null = its maker's). CreateLot(product) draws from product.Assembly, else the maker's, else AssemblyDistribution defaults; CreateLot(product, quality) mints the lot and every fill at a stated quality and draws nothing. assembly-from-maker now seeds part mean + .1 and writes only a null Assembly.

The shipped-catalog test is red until the catalog commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-17 19:03:12 +02:00
commit 30597b0e45
8 changed files with 160 additions and 78 deletions

View file

@ -64,14 +64,12 @@ public class Faction
[Inspectable, JsonProperty("doctrine"), Key(17)]
public FactionDoctrine Doctrine;
// The maker's final-assembly technology (mean) and quality control (deviation): the distribution every lot of
// theirs draws its own quality from, and the hard ceiling on every one of its roles (quality-lean-assembly-hard-ceiling).
// Key 18 is reserved for Livery and 16 for Relations.
[Inspectable, JsonProperty("assemblyMean"), Key(19)]
public float AssemblyMean = .5f;
[Inspectable, JsonProperty("assemblyDeviation"), Key(20)]
public float AssemblyDeviation = .15f;
// The maker's final assembly: the distribution every lot of theirs draws its own quality from, and the hard ceiling on each
// of its roles (quality-lean-assembly-hard-ceiling). Null is not authored: a lot of theirs assembles at AssemblyDistribution's
// defaults. assembly-from-maker derives it once at the part mean plus a tolerance margin (quality-min-tolerance-binned-assembly);
// tune it in Studio after that. Key 16 is reserved for Relations and 18 for Livery.
[Inspectable, JsonProperty("assembly"), Key(19)]
public AssemblyDistribution Assembly;
}
[CultDocument("aetheria.namefile", "1"), Inspectable, MessagePackObject]

View file

@ -28,6 +28,11 @@ public class FactionProductData
[Inspectable, JsonProperty("roles"), Key(5)]
public List<ProductRole> Roles = new List<ProductRole>();
// This line's own final test (maker-design-tiers-allowed): a binned or premium line is a better assembly as well as better
// parts. Null assembles as its maker does.
[Inspectable, JsonProperty("assembly"), Key(6)]
public AssemblyDistribution Assembly;
}
// How good this product's part is in one of its design's roles: a pseudo-gaussian distribution whose mean is
@ -46,3 +51,15 @@ public class ProductRole
[Inspectable, JsonProperty("standardDeviation"), Key(2)]
public float StandardDeviation = .15f;
}
// How well a maker puts the thing together: the technology and quality control of final assembly. A lot's own quality is drawn
// from it, and it is the ceiling on every role the lot fills. Defaults are a middling maker.
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class AssemblyDistribution
{
[Inspectable, JsonProperty("mean"), Key(0)]
public float Mean = .5f;
[Inspectable, JsonProperty("standardDeviation"), Key(1)]
public float StandardDeviation = .15f;
}

View file

@ -118,19 +118,24 @@ public class ItemManager
}
// Builds one of a manufacturer's branded products (quality-is-assembly-over-supply-chain): the unit's own quality is its
// final assembly, drawn from the maker's assembly distribution, and each of the design's roles is filled with a part whose
// quality is drawn from the product's distribution for it. A maker the catalog cannot resolve assembles at a new Faction's
// defaults.
public int CreateLot(FactionProductData product)
// final assembly, drawn from the product's assembly distribution, else its maker's, else AssemblyDistribution's defaults,
// and each of the design's roles is filled with a part whose quality is drawn from the product's distribution for it.
public int CreateLot(FactionProductData product) => Mint(product, null);
// The same lot at a stated quality: the assembly and every role fill are that quality and nothing is drawn, so a staged
// fit does not ride the item stream (ScenarioStage.Fit).
public int CreateLot(FactionProductData product, float quality) => Mint(product, clamp(quality, .01f, 1));
private int Mint(FactionProductData product, float? stated)
{
var design = ItemData.Get(product.Design);
var maker = ItemData.Get(product.Manufacturer) ?? new Faction();
var assembly = product.Assembly ?? ItemData.Get(product.Manufacturer)?.Assembly ?? new AssemblyDistribution();
var lot = new Lot
{
Design = ItemData.RefOf<ItemData>(design),
Origin = new Attributed { Faction = product.Manufacturer },
Product = ItemData.RefOf(product),
Quality = clamp(Random.NextGaussian(maker.AssemblyMean, maker.AssemblyDeviation), .01f, 1),
Quality = stated ?? clamp(Random.NextGaussian(assembly.Mean, assembly.StandardDeviation), .01f, 1),
Roles = new List<RoleFill>()
};
if (design.Roles != null)
@ -140,7 +145,7 @@ public class ItemManager
lot.Roles.Add(new RoleFill
{
Role = role.Name,
Quality = clamp(Random.NextGaussian(build.Mean, build.StandardDeviation), .01f, 1)
Quality = stated ?? clamp(Random.NextGaussian(build.Mean, build.StandardDeviation), .01f, 1)
});
}