Simulation Data for My Unreleased Game

I whipped up an algorithm in a few minutes to simulate a player rerolling their race in my game. I’m making this post specifically to link it in its Trello for when the game’s released. The algorithm rerolls the race if it’s the same as the previous one to prevent the player from spending over 200 Robux for nothing.

Hopefully, this will give players a better idea of what to expect before spending their money.
(Please don’t moderate me Roblox)

The Algorithm (less of an algorithm and more like a complicated printer of the hidden function):

local PF = require(game.ServerStorage.Modules.PlayerFunctions) -- The module (If you really want to find the function you can go through my activity on my profile, if you find it, know the function and rates are not the same)

local fake_player = "raceless"

local x = 1000 -- x is equal to the number of simulations rolled

-- Poor scripting, I know
local Native = 0
local Sprigan = 0
local Seafolk = 0
local Lumboid = 0
local Golem = 0
local Cyborg = 0
local Catfolk = 0
local Necrasian = 0
local Sharkfolk = 0
local Oni = 0
local Vampire = 0
local Sightless = 0
local Angel = 0
local Terkaal = 0
local Caribou = 0

local Common = 0
local Uncommon = 0
local Rare = 0

for i = 1,x,1 do
	local Race = PF.GenerateRace()

	if Race == fake_player then
		repeat Race = PF.GenerateRace() until Race ~= fake_player
		fake_player = Race
	else
		fake_player = Race
	end
	if fake_player == "Native" then
		Native = Native + 1
		Common = Common + 1
	elseif fake_player == "Sprigan" then
		Sprigan = Sprigan + 1
		Common = Common + 1
	elseif fake_player == "Seafolk" then
		Seafolk = Seafolk + 1
		Common = Common + 1
	elseif fake_player == "Lumboid" then
		Lumboid = Lumboid + 1
		Uncommon = Uncommon + 1
	elseif fake_player == "Golem" then
		Golem = Golem + 1
		Common = Common + 1
	elseif fake_player == "Cyborg" then
		Cyborg = Cyborg + 1
		Uncommon = Uncommon + 1
	elseif fake_player == "Catfolk" then
		Catfolk = Catfolk + 1
		Uncommon = Uncommon + 1
	elseif fake_player == "Necrasian" then
		Necrasian = Necrasian + 1
		Uncommon = Uncommon + 1
	elseif fake_player == "Sharkfolk" then
		Sharkfolk = Sharkfolk + 1
		Rare = Rare + 1
	elseif fake_player == "Oni" then
		Oni = Oni + 1
		Rare = Rare + 1
	elseif fake_player == "Vampire" then
		Vampire = Vampire + 1
		Rare = Rare + 1
	elseif fake_player == "Sightless" then
		Sightless = Sightless + 1
		Rare = Rare + 1
	elseif fake_player == "Angel" then
		Angel = Angel + 1
		Rare = Rare + 1
	elseif fake_player == "Terkaal" then
		Terkaal = Terkaal + 1
		Common = Common + 1
	elseif fake_player == "Caribou" then
		Caribou = Caribou + 1
		Uncommon = Uncommon + 1
	end
end

Set 1 Results | 1,000 simulations (cleaned up the output so it looks nicer)

23:07:10.669 Native: 124 – The name of the race and the amount of times it was rolled out of x
23:07:10.669 Sprigan: 103
23:07:10.669 Seafolk: 98
23:07:10.669 Lumboid: 84
23:07:10.670 Golem: 99
23:07:10.670 Cyborg: 78
23:07:10.670 Catfolk: 73
23:07:10.670 Necrasian: 71
23:07:10.670 Sharkfolk: 27
23:07:10.670 Oni: 20
23:07:10.670 Vampire: 23
23:07:10.671 Sightless: 30
23:07:10.671 Angel: 5
23:07:10.671 Terkaal: 100
23:07:10.671 Caribou: 65
23:07:10.671 ===============
23:07:10.671 Common: 524
23:07:10.671 Uncommon: 371
23:07:10.671 Rare: 105

Set 2 Results | 1,000 simulations

23:08:25.076 Native: 138
23:08:25.076 Sprigan: 98
23:08:25.076 Seafolk: 115
23:08:25.076 Lumboid: 74
23:08:25.076 Golem: 81
23:08:25.076 Cyborg: 74
23:08:25.076 Catfolk: 83
23:08:25.077 Necrasian: 69
23:08:25.077 Sharkfolk: 36
23:08:25.077 Oni: 22
23:08:25.077 Vampire: 14
23:08:25.077 Sightless: 25
23:08:25.077 Angel: 4
23:08:25.077 Terkaal: 92
23:08:25.078 Caribou: 75
23:08:25.078 ===============
23:08:25.078 Common: 524
23:08:25.078 Uncommon: 375
23:08:25.078 Rare: 101

Set 3 Results | 10 simulations (proof the rates aren’t completely busted)

23:10:21.234 Native: 1
23:10:21.234 Sprigan: 0
23:10:21.235 Seafolk: 1
23:10:21.235 Lumboid: 1
23:10:21.235 Golem: 0
23:10:21.235 Cyborg: 1
23:10:21.235 Catfolk: 0
23:10:21.235 Necrasian: 1
23:10:21.235 Sharkfolk: 0
23:10:21.235 Oni: 0
23:10:21.235 Vampire: 0
23:10:21.236 Sightless: 1
23:10:21.236 Angel: 2 – Do not expect that, I don’t understand math sometimes
23:10:21.236 Terkaal: 2
23:10:21.236 Caribou: 0
23:10:21.236 ===============
23:10:21.236 Common: 4
23:10:21.236 Uncommon: 3
23:10:21.236 Rare: 3

Set 4 Results | 10 simulations (what the average player can expect)

23:12:23.733 Native: 1
23:12:23.733 Sprigan: 1
23:12:23.733 Seafolk: 1
23:12:23.734 Lumboid: 1
23:12:23.734 Golem: 0
23:12:23.734 Cyborg: 1
23:12:23.734 Catfolk: 1
23:12:23.734 Necrasian: 0
23:12:23.734 Sharkfolk: 0
23:12:23.734 Oni: 0
23:12:23.735 Vampire: 0
23:12:23.735 Sightless: 1
23:12:23.735 Angel: 0
23:12:23.735 Terkaal: 2
23:12:23.735 Caribou: 1
23:12:23.735 ===============
23:12:23.735 Common: 5
23:12:23.735 Uncommon: 4
23:12:23.735 Rare: 1

Set 5 Results | 100,000 simulations (long-term outlook)

23:17:11.217 Native: 12441
23:17:11.217 Sprigan: 10093
23:17:11.217 Seafolk: 10377
23:17:11.217 Lumboid: 7821
23:17:11.217 Golem: 9230
23:17:11.217 Cyborg: 8256
23:17:11.217 Catfolk: 7974
23:17:11.218 Necrasian: 7403
23:17:11.218 Sharkfolk: 2526
23:17:11.218 Oni: 1995
23:17:11.218 Vampire: 1732
23:17:11.218 Sightless: 2869
23:17:11.219 Angel: 324
23:17:11.219 Terkaal: 9326
23:17:11.219 Caribou: 7633
23:17:11.219 ===============
23:17:11.219 Common: 51467
23:17:11.219 Uncommon: 39087
23:17:11.219 Rare: 9446

Set 6 Results | 1,000,000 simulations (I’m just having fun now)

23:18:52.499 Native: 125462
23:18:52.499 Sprigan: 102847
23:18:52.499 Seafolk: 102300
23:18:52.499 Lumboid: 79778
23:18:52.499 Golem: 91359
23:18:52.499 Cyborg: 81344
23:18:52.499 Catfolk: 79263
23:18:52.499 Necrasian: 74570
23:18:52.500 Sharkfolk: 25108
23:18:52.500 Oni: 19561
23:18:52.500 Vampire: 17084
23:18:52.500 Sightless: 27846
23:18:52.500 Angel: 2850
23:18:52.500 Terkaal: 93710
23:18:52.500 Caribou: 76918
23:18:52.500 ===============
23:18:52.501 Common: 515678
23:18:52.501 Uncommon: 391873
23:18:52.501 Rare: 92449

There you go. You should now have an idea of the rates. I had to redo this multiple times because I found a surprising amount of bugs. I suggest all developers do tests of their rates. There was a bug at one point where Angel kept getting 0, even after (not an exaggeration) 1,000,000,000,000 rolls. Turns out I just had to bump up the weight by about 0.1 for it to work.

1 Like