I have decided to completely dump the bounded number system that I have been using for LMD and use flat numbers that are constrained to fall between 0 and 1, using a Blend operator to shift them up or down. A positive shift will use a Blend starting at the current value and blending up towards 1.0 with the weighting set by the alteration. A negative shift will use a Blend starting at the current value and blending towards 0.0 with the weighting set by the alteration. This is a simpler system; it does not offer the broad possibilities of the traditional Blend, but it’s very easy to understand and use. It could just as easily be thought of as a bounded addition operator. It takes just two inputs: the original value and the increment value. Here’s the source code in JavaScript:
function blend(start, delta) {
var x = 0;
if (delta > 0)
x = start + (1.0-start)*delta;
else
x = start * (1.0 + delta);
return x;
}
A typical application of this operator is to increment or decrement a value without it exceeding 1.0 or falling below -1.0. For example:
affection = blend(affection, changeInAffection);