Planet Harvest | Devlog 1| RNG, Fortune, and a New Planet!


This week in development I have solely focused on a new system for Rare Drops from planets. I wanted to introduce a Random source of drops for the players to boost their progression a little and encourage grinding.

I decided to go for a Weighted Drop System for this. 

If you don't know,  a Weighted Drop System in a game is a way to implement Random Number Generated, or RNG, into the mix with values, making certain things rare than others. You see this in a lot of MMO and Survival games as it is a really easy and efficient way to do this. The biggest game you probably see this in is Minecraft especially in its Fishing Mechanic where the game chooses a random category of items and uses weight to determine the rarity of items and which to choose.

This is also easy for me to do. All I want to do is:

  1. Create a simple loot table and reward script system.
  2. be able to gain a drop on  a certain requirement [Random Number Generation].
  3. Give the Drop to the player depending on what it is and its value.
  4. Add a Fortune Mechanic that increases the chances of getting rare drops.

Firstly I created the Scripts. This was really easy to do and I followed this person's tutorial on how it works and how to implement it here:

This is a small and easy tutorial on how this works that if you are interested in this for a game of yours you can follow along and create the same system.

It works by creating Scriptable Objects of Loot Tables and Rewards making it easy to make multiple for my different planets and to easily switch between I follow the same assignment he does in the video.

From there I created a way to get the drop.

I went simple for this in order to introduce the Fortune mechanic later too and this is how I did it:

This here runs a random number on harvest and determines whether you get a drop. There is easier ways to do this but I did it this way to use Fortune and so that I can use this short bit of code for every planet.

With that done I can just make a Loot Table with Rewards now. I started with the Mars Planet.

Here you can see the table and how it works. There is 6 different possibilities with their own Weight with the lower being the rarer. 

The Rewards are also Scriptable Objects. And how they work is they have to Values. Their name which is the type of reward, as well as their Reward Value which is how much the player receives.

And this is how I give the player the reward. Once a Drop is chosen the script determines what the name of the drop is. From there it adds the 'reward' value to the specific stat on the player based on the name. So in this case:

  1. A Drop is Rolled
  2. 1000 Junk is Chosen
  3. The Script Determines the name as 'Junk'
  4. the 'reward' value, aka 1000, is added to the Junk Stat of the player.

With this working the only thing left to do was the Fortune Mechanic. How I want this to work is when the player harvests the chance of getting a drop is determined by the base drop chance divided by the fortune stat. It is pretty easy to implement just adding it into the equation.

So the game works it out like this:

  • Base Drop Chance = 1000
  • Fortune = 1.5

Drop Chance = Base Drop Chance / Fortune;

Drop Chance = 1000 / 1.5;

Drop Chance = 666.66

It is pretty simple to understand and implement. 

The last thing I did was add a way to increase the Fortune Stat. I did this by adding it into the 'Super Upgrades' menu in the game which is where players can by separate upgrades for a rare currency called Crystals found by harvesting planets.

The Last thing I did this week was add a new planet named Glacies. This is an ice planet that is achieved after Mars by reaching level 35.  Here is how it looks:

This is everything new since last Dev-Log with the game and the game is coming ever so closer to finishing. With most Mechanics and Systems done I am now just adding extra things and content before release. As well as polishing off the game.

Thank you for taking the time to read and make sure to keep up with the next Dev-Logs which I try to do one per week.

Leave a comment

Log in with itch.io to leave a comment.