Author manufacturer variation as faction products
A design lists role names; a faction product is a manufacturer's branded build of one, carrying its name, its flavor text, and a pseudo-gaussian quality distribution per role whose mean is the technology put in and whose deviation is their quality control. A PerformanceStat may name the role whose quality it reads, unset reading the item own workmanship as before, so old saves behave unchanged. Generation selects products rather than designs, which makes what a faction makes the availability rule. This is Njordr shape at one dimension: role names, per-role derivation and per-product distributions carry over when quality widens into dimensions. No parts exist yet; the product authors the role quality. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
95932da895
commit
8d93b937bc
11 changed files with 275 additions and 95 deletions
|
|
@ -117,6 +117,15 @@ public static class Extensions
|
|||
// public static T RandomElement<T>(this IEnumerable<T> enumerable) => enumerable.ElementAt(Random.NextInt(0, enumerable.Count()));
|
||||
public static float NextPowerDistribution(this ref Random random, float min, float max, float exp, float randexp) =>
|
||||
pow((pow(max, exp + 1) - pow(min, exp + 1)) * pow(random.NextFloat(), randexp) + pow(min, exp + 1), 1 / (exp + 1));
|
||||
// Box-Muller: two uniforms become a normal deviate. Used for part quality, where a manufacturer's mean is
|
||||
// its technology in a role and its deviation is quality control. Callers clamp to their own valid range.
|
||||
public static float NextGaussian(this ref Random random, float mean, float deviation)
|
||||
{
|
||||
var u1 = max(random.NextFloat(), 1e-6f);
|
||||
var u2 = random.NextFloat();
|
||||
return mean + deviation * sqrt(-2 * log(u1)) * cos(2 * PI * u2);
|
||||
}
|
||||
|
||||
public static float NextUnbounded(this ref Random random) => 1 / (1 - random.NextFloat()) - 1;
|
||||
public static float NextUnbounded(this ref Random random, float bias, float power, float ceiling) => 1 / (1 - pow(min(random.NextFloat(), ceiling), 1 - pow(clamp(bias,0,.99f), 1 / power))) - 1;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue