RNGNeeds symbol

RNGNeeds text logo

Nothing is improbable.*

* tagline was chosen randomly (ofc)

Get on Asset Store
The ultimate probability distribution plugin for unity

Overview

RNGNeeds is a plugin that lets you effortlessly design and manage probability lists for any value, type, or custom object directly within the Unity Inspector. Take control of your dice rolls, monster spawns, card decks, item drops, damage modifiers, or even organic animations using probability distribution with unparalleled simplicity and ease-of-use.

Design your lists with probabilities, variable pick counts, and seeding right in the inspector, or harness the powerful API to control everything from code. Experience lightning-fast performance with burst-compiled selection methods, extensibility, seeding options, repeat prevention, pick history, and much more.

Unlock endless possibilities with the innovative concept of Probability Influence Provider. Need to raise the odds of a critical strike based on player stats? Want to increase the chance of spawning that elite monster when it's close to midnight? Perhaps you need to make the battle more intense when the music volume is loud. RNGNeeds is here for - probably - all your random needs.

RNGNeeds interface screenshot w-full h-auto

Features

POWERFUL & ACCESSIBLE

Generic

Use with any value or reference type, be it Unity's or your own. No restrictions.

For Coders & Designers

All features are accessible via the Inspector and an easy-to-use API.

Wide Editor Support

Supports all LTS versions. Developed in 2020 LTS and tested up to 2023 Alpha.

Selection Methods

Pick multiple items at once using various probability methods, including pure random selection.

Lighting-fast

Choose burst-compiled variants of selection methods to pick millions of items in milliseconds.

Seeding Options

Retain a preferred seed, set a custom one, or implement your own Seed Provider.

Extensible

Easily implement and register your custom Selection Methods or seeding options.

USER FRIENDLY

The Stripe

Visually author probabilities using the Stripe widget directly within the Inspector.

Direct Probability Input

Type in exact probability values for any item with precision up to 0.00001 %.

Lock Probabilities

Lock items to preserve their odds when other probabilities are adjusted or recalculated.

Disable Items

Exclude Items from selection while keeping them in the list by simply disabling them.

Fully Customizable

Customize themes, info displays, and appearance options individually for each drawer.

Color Themes

Choose from a variety of color themes, create your own, or use monochrome mode to visualize variances effectively.

Color Dimming

Use color dimming based on probability to easily identify even subtle differences.

DYNAMIC & ADAPTABLE

Probability Influence

Design Influence Providers to dynamically modify probabilities based on external factors.

Proportional Normalization

Item probabilities are automatically recalculated, maintaining their original ratios.

Flexible Pick Counts

Choose a fixed pick count, or select a random range with an adjustable curve to control bias.

Repeat Prevention

Avoid consecutive item selections with multiple repeat prevention techniques.

Pick History

Track previous item picks for each list separately and employ history to mimic deterministic probability behavior.

Selection Testing

Test the outcome of your settings in the Inspector, with color-coded results for evaluating variations.

ON THE ROADMAP

Dynamic Modification

Utilize multiple Mod Providers for items to dynamically manage probability adjustments and multipliers.
(ie. crit chance +1.5% and/or *0.95)

Card Deck Extensions

A collection of handy methods to treat lists like card decks. Draw from the top/bottom, add cards, peek, cut decks, deal hands, or shuffle.

Depletable List

Assign units to items in the list and allow picks to deplete them. Depleted items won't be selected, while the probability distribution of others remains unchanged.

Usage examples

The Probability List

The generic ProbabilityList lies at the heart of RNGNeeds. This versatile tool is compatible with any value or reference type—be it int, float, bool, Vector3, Color, Scriptable Object, MonoBehaviour, GameObject, Enum, or your custom classes. Simply ask ProbabilityList to "Pick Value," and you're good to go.

Let’s spawn a random monster type with random level at a random spawn location. Set up the logic and leave the rest to your designers.

public class Monster : ScriptableObject
{
    public GameObject monsterPrefab;
}

public class SpawnLocation : MonoBehaviour
{
    public Vector3 coordinates;
}

public class MonsterSpawner : MonoBehaviour
{
    public ProbabilityList<Monster> monsterTypes;
    public ProbabilityList<int> monsterLevels;
    public ProbabilityList<SpawnLocation> spawnLocations;


    public void SpawnMonster()
    {
        Monster monster = monsterTypes.PickValue();
        Vector3 position = spawnLocations.PickValue().coordinates;

        GameObject monsterObject = Instantiate(monster.monsterPrefab, position, rotation);
        monsterObject.GetComponent<MonsterStats>().SetStatsByLevel(monsterLevels.PickValue());
    }
}
RNGNeeds interface screenshot

Custom Drawer & The Stripe

Leave the logic to the coders and take it from there. Effortlessly design your lists within the Inspector. Use The Stripe to adjust probabilities by dragging, fine-tuning values with the scroll wheel, or entering them directly. Lock items to preserve their odds while making adjustments, and disable items to prevent selection.

Customizable Drawers

Stay organized and focused with customizable drawers tailored to your needs. Select from a wide range of color themes or create your own. Modify preview bars, appearance options, or info displays. Dim colors based on probability to easily identify variances, or let your items bring their distinct colors to the list. RNGNeeds remembers your preferences for each individual drawer.

public class CardRarity : ScriptableObject
{
    public Color rarityColor;
}

public class Card : ScriptableObject, IProbabilityItemColorProvider
{
    public CardRarity cardRarity;
    public Color ItemColor => cardRarity.rarityColor;
}

public class CardDeck : ScriptableObject
{
    public ProbabilityList<CardRarity> cardRarities;
    public ProbabilityList<Card> cards;
}
RNGNeeds interface screenshot

Probability Influence

Enhance your distinct game mechanics with dynamic probability adjustments based on external factors. Assign a Probability Influence Provider to any item and fine-tune the degree to which factors alter its odds.

Want to drop health potions more often in tutorial scenarios? Increase storm frequency as the player progresses through the story? Make it less likely for this NPC to approach the player at night? Or perhaps speed up this animation as the player gets closer? With Probability Influence, the possibilities are endless.

public enum DamageType
{
    Normal,
    CriticalStrike,
    CrushingBlow,
    Piercing,
    Stun,
    SplashDamage
}

public class PlayerAttack : MonoBehaviour
{
    public ProbabilityList<DamageType> damageType;

    [Header("Odds of Idle Dance Pose")]
    public ProbabilityList<bool> oddsOfIdleDancing;
}

public class PlayerManager : MonoBehaviour, IProbabilityInfluenceProvider
{
    public int playerLevel;
    public string InfluenceInfo => $"Increased based on player level. Current: {playerLevel}";
    public float ProbabilityInfluence => ((float)playerLevel).Remap(1, 20, -1f, 1f);
}

public class AudioManager : MonoBehaviour, IProbabilityInfluenceProvider
{
    public float musicLevel;
    public string InfluenceInfo => $"Higher chance if music over 75%. Current: {musicLevel}";
    public float ProbabilityInfluence => musicLevel.Remap(.75f, 1f, 0f, 1f);
}
RNGNeeds interface screenshot
Get on Asset Store