Getting to grips with Advanced Random's Probability Tables

25

Index

Features on these Courses

Attached Files

The following files have been attached to this tutorial:

.c3p

basic-probability-table.c3p

Download now 157.44 KB
.c3p

advanced-probability-table.c3p

Download now 167.17 KB

Stats

8,170 visits, 17,223 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 29 Oct, 2019.
.C3P

basic-probability-table.c3p

Download now 157.44 KB
.C3P

advanced-probability-table.c3p

Download now 167.17 KB

An Introduction to Probability Tables

In this tutorial, we’re going to look at using the Advanced Random (AR) plugin's probability tables feature. We'll be looking at setting up tables right the way through to creating basic random encounter and random item systems. You’ll see there are two example projects attached to this tutorial – one demonstrates the basics of probability tables, including creating and populating them, whereas the other shows building tables in bulk from project files, making changes to them at runtime and more!

The Advanced Random plugin is really useful for a variety of things, notably procedural generation via its noise-generation functions. But it also allows you to build permutation and probability tables, the latter of which we’ll be focussing on in this tutorial.

But what can we do with probability tables?

Well, the basic use of a probability table is to generate weighted random numbers. So, let’s say we have three entries in this table ‘ObjectA’, ‘ObjectB’ and ‘ObjectC’. We’ll give A a weight of 1, B a weight of 2 and C and weight of 4. In this example, ObjectC is the most likely entry to be picked from the table, as it has the biggest weight. However, we can also say it’s roughly four times as likely to be picked than ObjectA.

In game terms, we can use these to create systems that need a random element. You could use them for loot drops upon defeating an enemy, discovering random items in the overworld, random upgrades when a character levels up, encountering enemies, the list goes on! We’re going to focus on two examples later in this tutorial – random item boxes and random encounters a la Pokemon.

  • 5 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Probability tables are a great feature.

    Before the advanced random plugin you would probably have done something like choose( "A", "B", "B", "C", "C", "C", "C" ) for the 1xA, 2xB and 4xC example. Now imagine doing that for 10xA, 20xB and 40xC :P

    Great tutorial more people need to know about this feature.

  • Thanx.. I am just finishing a project that this would have saved a ton of extra coding.. My next project I will try this out and create a template for the furure.. Thanx again

  • Great! Didn't know this was possible. It's exactly what I need for loot drops. 👍

  • The only part i dont understand is the "load from JSON string" action where you have the "input" string parameter. what's the purpose of this?

  • Thank you so much! It clears a lot.