Sponsored By

RNGesus and the int randomNumber = random.Next() //Disciples

For some, Random Number Generators (RNGs) can feel like arcane complex systems. This article briefly explores a few possible ways of setting up an RNG system to help aid the budding developer or designer.

Aaron Cook, Blogger

November 21, 2017

5 Min Read

Foreword

First off, the above C# script in the title is why I'm a producer and not a programmer. This article won't discuss how to implement each Random Number Generator (RNG) system. Rather, it will examine different RNG systems conceptually and how each is beneficial. Working in games that rely heavily on RNG systems, this concept felt intuitive to me. I recently realized however that for some, RNG systems can seem arcane. The purpose of this article is to dispell as much mystery around these systems as I can. 

Additionally, I cite a few examples from games in this article. I am in no way saying this is how these systems function, but rather how they might function. 

Pure RNG

This is the most brute force, basic way of setting up an RNG. It is possible Rocket League's crate system works this way. Each crate is a weighted RNG pull on the opening of the crate. Players have the same odds every time they open a crate of its type (Turbo Crates, CC1, etc.). The way it works is you (as a developer) create a range of numbers, say 1 to 100 for the sake of simplicity. Then you assign each item a set of numbers from that range. For example, you could set rarer items like Mystery Decals to only pull on 1 and 2 giving Mystery Decals a 1 in 50 odds of being awarded. To get a more granular frequency, you simply increase the range that could be pulled from, I.e. 1 to 1000 instead of 1 to 100.

For systems with a small range of potential rewards and the desire to create a small number of high-value items, a pure RNG can lead to a highly volatile experience if not polished by a designer or programmer with a keen understanding of computational mathematics. Although, that's not to say that would lead to a "bad" player experience either. It depends on the game and whether the most desired reward is considered needed or wanted by the player. High-end weapons and armor suffer in this kind of system because players feel the game (or worse the development team) is against them. However, cosmetic items and "trash loot" tend to perform well in these systems. 

In games where there is a shared experience like MMO's, implementing a "need before greed" like that found in World of Warcraft typically helps make these systems more palatable to players. Rogue-like games can greatly benefit from this type of RNG system though.

Nested RNG

Really, this is just a slight variation of a Pure RNG system. The key distinction being having multiple RNG pulls rather than one. Let's continue the Rocket League crate analysis. Some of the items awarded from the crates can be "painted" or colored a unique color as well as "certified" which tracks specific stats. Rather than place all the possible color variations under one RNG pull, you can set up your system to first pull the item, then conduct a two secondary RNG pulls to determine what color the item is (weighted towards base coloring) and if it is certified (weighted towards base condition). 

This allows designers and developers to quickly introduce a seemingly wide amount of variation without compromising the experience of the current loot table. Games like Borderlands likely make use of a nested RNG systems to manage the scope of their loot table without needing to include every single edge condition possible. 

Scripted RNG

Similar to Nested RNG, a scripted RNG can help ensure variety as well as balance across loot tables. There are two ways to execute on this. Developers can choose to pull all RNG pulls at one time where the next pull is based on the previous pull, or at set events. 

For this type of system, let's look at Destiny's loot system, specifically engrams. The player is playing through open world content when a glowing dodecahedron drops on the ground. This is the first RNG pull. The glowing polygon may be white, green, blue, purple, or yellow. Based on the player character's light level, table for this little dodecahedron will vary. 

Let's the player's light level is 285 and the engram was purple. So the player now needs to go to pick it up by walking over it. Here's where the next RNG pull could be. Depending on how nuanced you want the control of this system to be, it could look at what is worse overall, equipped weapons or equipped armor and conduct a weighted evaluation leaning towards the lesser aggregate. Alternatively, it could look at all equipped items and conduct that same evaluation leaning towards the lowest light level item. Or it could simply pull for any equipable slots with equal weighting or weighting that leans towards something specific. 

For the sake of continuing to analyze how these work, let's say it was a primary weapon engram. Now the player makes their way back to the tower and turns it in. This is where the next series of RNG pulls could be made. You could set the system up to do an equal pull for one of the four primary weapon types, followed by a weighted pull based on that result. Let's say that all results in the Assembly II Auto Rifle. In Destiny, it still needs to pull three weapon sight options, two columns of two modifiers, and one last modifier. Here's what that looks like visually.

The key distinction between a nested and scripted system is here. In a nested system, it says if Hip Fire is awarded. In a scripted system, the weighting of whether or not Hip Fire is awarded is determined based on whether the player chooses to hip fire with auto rifles frequently, and which sites are awarded. Each preceding event further alters the weighting of each possible outcome for the next RNG award aspect of the weapon. Additionally, in a nested RNG system, it simply states that 3 total sites are selected and 5 total perks are awarded. In a scripted system, it further refines how those could be awarded and allocated. 

Read more about:

Blogs

About the Author(s)

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like