EvolvingNatFloat

From Vintage Story Wiki

This page was last verified for Vintage Story version 1.19.3.


EvolvingNatFloat

A number generator whose return value changes over time according to a transform and factor.
Each sequential value is retrieved according to the first value and the sequence number.

To use EvolvingNatFloat, add the using statement for Vintagestory.API.MathTools.
Important note: The value of sequence should always satisfy sequence >= 0

Example in code

using Vintagestory.API.MathTools;

public class EvolvingNatFloatMod : ModSystem
    {

        public override void StartServerSide(ICoreServerAPI api)
        {
            float factor = 1;

            EvolvingNatFloat evolve;
            evolve = new EvolvingNatFloat(
                EnumTransformFunction.CLAMPEDPOSITIVESINUS,
                factor

            );

            float firstValue = 5;
            for (float sequence = firstValue; sequence < 100; sequence++)
            {
                // Retrieve each sequential value
                float y = evolve.nextFloat(firstValue, sequence);
            }
        }
    }

Transform variants

Overview
Name Explanation
clampedpositivesinus Clamped positive sine wave function.
cosinus Cosine wave function.
identical Identical to first value.
inverselinear Linear change in the direction of the first value.
linearnullify Linear change towards zero, then clamp at zero.
linearreduce Linear change in the opposite direction of the first value.
quadratic Quadratic function.
root Root function.
sinus Sine wave function.
smoothstep Smooth step function.

Visual representation

For every representation except smoothstep, the factor = 1
For every representation except smoothstep, linearnullify, the initalValue = 1

Txtpositiveclampedsinus.png Txtcosinus.png Txtidentical.png Txtinverselinear.png

Txtlinear.png Txtlinearincrease.png TxtlinearnullifyFirstValMinusFive.png Txtlinearreduce.png

Txtquadratic.png Txtroot.png Txtsinus.png Txtsmoothstep.png


Code Modding
Basics Code Mods Preparing For Code Mods Creating A Code Mod
Tutorials
Advanced Server-Client Considerations Setting up your Development Environment Advanced Blocks Advanced Items Block and Item Interactions Block Behavior Block Entity Particle Effects World Access Inventory Handling Commands GUIs Network API Monkey patching (Harmony)
Data Management VCDBS format Savegame Moddata ModConfig File Chunk Moddata Serialization Formats TreeAttribute
Worldgen WorldGen API NatFloat EvolvingNatFloat
Rendering Shaders and Renderers
Icon Sign.png

Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.

Modding
Modding Introduction Getting Started Theme Pack
Content Modding Content Mods Developing a Content Mod Basic Tutorials Intermediate Tutorials Advanced Tutorials Content Mod Concepts
Code Modding Code Mods Setting up your Development Environment
Property Overview ItemEntityEntity BehaviorsBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity BehaviorsCollectible BehaviorsWorld properties
Workflows & Infrastructure Modding Efficiency TipsMod-engine compatibilityMod ExtensibilityVS Engine
Additional Resources Community Resources Modding API Updates Programming Languages List of server commandsList of client commandsClient startup parametersServer startup parameters
Example ModsAPI DocsGitHub Repository