Parts

From Grassy Landscape Wiki
Jump to navigation Jump to search

Parts are Roblox parts in Grassy Landscape that spawn throughout the Map. They can be picked up, welded, and cut by players. Parts come in a variety of colors, shapes and sizes. They are one of the core building materials of the game, the other being items.

Spawning

Upon server start, 4,800 parts are spawned around the map. Each part has a random position, size, material, shape and color. For positioning, the map has designated spawn areas for parts and items. An algorithm picks between these areas, giving each one a probability equal to its volume, then calculates a random position and rotation within the area. For shape, each part has a ~60% chance of being a block and a ~40% chance of being a cylinder.

Materials

For material, one is picked according to the probability table below.

Material Chance Value
CorrodedMetal 30.6% 0.8
Metal 19.6% 1
SmoothPlastic 19.6% 1
DiamondPlate 13.6% 1.2
Glass 13.6% 1.2
Foil 3.1% 2.5

Below is the code used to calculate that table, which can be run by any injector such as Synapse or Script-Ware. The reason for the (1 / v) ^ 2 formula is that the part spawning script uses that formula when choosing which material to pick. (confirmed by the developer)

local valuebook = require(game.ReplicatedStorage.ValueBook)

local total = 0
for _, v in pairs(valuebook.MaterialValues) do
	total += (1 / v) ^ 2
end

for _, v in pairs(valuebook.Materials) do
	local value = (1 / valuebook.MaterialValues[v])^2
	print(v, tostring((value / total) * 100) .. '%', value)
end

Sizing

For size, the value of the picked material is used as a bias. The bias skews the random distribution such that higher bias values cause lower random numbers to be more common. In practice this means that parts with rarer materials tend to spawn smaller, but all sizes are still possible. Then, the Y and Z values are randomly generated. Each component is calculated as math.random()^bias * 9 + 1, which means a random number from 1 to 10, skewed by the bias. Again, higher biases (such as foil's bias of 2.5) mean that the size will tend towards the 1, while lower biases (such as in the case of corroded metal) tend to skew towards 10.

The maximum value for the X component will be a value N such that Y * Z * N == 125. In order words the maximum volume of the part will be 125 studs squared. The minimum value of the X component is always 0.2. Then a random number is generated between those two values, skewed by the bias once again.

The full function is thusly:

function Part:RandomSize(bias)
	local y = math.random()^bias * 9 + 1
	local z = math.random()^bias * 9 + 1
	local x = math.min(math.random()^bias * (125 / (y * z) - 0.2) + 0.2, 10)
	
	return Vector3.new(x, y, z)
end

Colors

Parts mainly spawn in dull and muted tones, with some greys and whites mixed in. Rather than a list of BrickColors, part colors are generated as Color3 values, so there is an entire spectrum of possible colors. Nonetheless, the spectrum is limited and is only a small fraction of the color space. Here is a graph showing the entire part color spectrum (click on it for a larger version):

GLS color spectrum.png

On the left is the hue and lightness spectrum, and on the right is the saturation spectrum. The range of saturation values for a color depends on its lightness, which is why there is a separate saturation graph next to the main one. To pick a color from the spectrum, first the game chooses the hue and lightness from the graph on the left, and then it chooses a saturation from the graph on the right. As you can see, brighter colors have a smaller saturation range.

The color generation code is as follows:

local hue = math.random()
local lightness = rand(0.1, 1, 0.75)
local saturation = rand(0.1, 0.5 - (lightness^0.5 * 0.4), 5)

rand(min, max, bias) generates a random number between its two first arguments, biased by the third argument. Notice that lightnesses below 0.1 are impossible to spawn and so are saturations below 0.1, which are both reflected in the graph.

BrickColors found in-game

Visual Name RGB Percentage Rarity
Quill grey 216.85, 223.87, 217.85 7.213750% One in 13
Mid gray 212.83, 203.80, 202.79 7.055560% One in 14
Institutional white 255.00, 253.99, 255.00 6.291210% One in 15
White 242.95, 242.95, 244.96 4.378370% One in 22
Dark grey 93.36, 114.45, 113.44 4.337610% One in 23
Black 33.13, 40.16, 41.16 4.192400% One in 23
Ghost grey 196.77, 191.75, 204.80 3.625740% One in 27
Sage green 186.73, 198.78, 193.76 3.471220% One in 28
Dirt brown 73.29, 62.24, 76.30 3.254440% One in 30
Oyster 189.74, 173.68, 170.67 3.243290% One in 30
Light grey 194.76, 201.79, 189.74 3.172110% One in 31
Light stone grey 228.89, 227.89, 232.91 3.111170% One in 32
Earth green 39.15, 49.19, 42.16 3.052920% One in 32
Dark taupe 87.34, 70.27, 77.30 2.795100% One in 35
Cloudy grey 176.69, 169.66, 155.61 2.758360% One in 36
Smoky grey 88.34, 109.43, 105.41 2.684150% One in 37
Sand violet 134.52, 105.41, 127.50 2.599380% One in 38
Sand green 129.51, 152.60, 146.57 2.152280% One in 46
Hurricane grey 157.62, 135.53, 136.53 2.108570% One in 47
Pearl 231.90, 234.92, 230.90 1.998100% One in 50
Slime green 90.35, 112.44, 92.36 1.877930% One in 53
Grey 163.64, 166.65, 147.58 1.863350% One in 53
Sand red 141.55, 107.42, 126.49 1.648170% One in 60
Artichoke 146.57, 159.62, 137.54 1.583570% One in 63
Silver 152.60, 156.61, 170.67 1.559070% One in 64
Fossil 144.56, 155.61, 172.67 1.510290% One in 66
Flint 96.38, 107.42, 87.34 1.384830% One in 72
Lily white 237.93, 233.91, 237.93 1.249030% One in 80
Sand yellow 146.57, 147.58, 123.48 1.185030% One in 84
Earth blue 56.22, 64.25, 69.27 1.158380% One in 86
Dark stone grey 81.32, 99.39, 97.38 1.139170% One in 87
Faded green 116.45, 145.57, 121.47 1.084030% One in 92
Cadet blue 166.65, 177.69, 187.73 0.927810% One in 107
Pine Cone 109.43, 76.30, 83.33 0.887230% One in 112
Medium stone grey 178.70, 147.58, 167.65 0.884820% One in 113
Linen 165.65, 157.62, 141.55 0.873990% One in 114
Sand blue 126.49, 123.48, 157.62 0.830180% One in 120
Grime 128.50, 139.54, 108.42 0.775500% One in 128
Lilac 103.40, 101.40, 137.54 0.475640% One in 210
Fog 210.82, 214.84, 218.85 0.446790% One in 223
Earth yellow 79.31, 95.37, 58.23 0.420640% One in 237
Reddish lilac 141.55, 112.44, 153.60 0.345150% One in 289
Really black 30.12, 22.09, 31.12 0.331880% One in 301
Laurel green 168.66, 180.71, 159.62 0.305770% One in 327
Copper 146.57, 103.40, 107.42 0.294650% One in 339
Cocoa 53.21, 38.15, 36.14 0.281290% One in 355
Mulberry 86.34, 47.18, 72.28 0.188020% One in 531
Moss 123.48, 156.61, 102.40 0.163320% One in 612
Seashell 224.88, 216.85, 218.85 0.113880% One in 878
Brown 125.49, 81.32, 94.37 0.099800% One in 1002
Lavender 143.56, 97.38, 148.58 0.095390% One in 1048
Bright violet 104.41, 68.27, 109.43 0.072590% One in 1377
Medium bluish violet 101.40, 118.46, 148.58 0.049780% One in 2008
Bright reddish lilac 126.49, 85.33, 127.50 0.045700% One in 2188
Plum 121.47, 73.29, 119.47 0.038530% One in 2595
Shamrock 94.37, 131.51, 85.33 0.037020% One in 2701
Tawny 131.51, 88.34, 84.33 0.034180% One in 2925
Bronze 127.50, 116.45, 77.30 0.030800% One in 3246
Earth orange 97.38, 68.27, 56.22 0.030510% One in 3277
Steel blue 85.33, 123.48, 135.53 0.027820% One in 3594
Bright bluish violet 80.31, 77.30, 123.48 0.027100% One in 3690
Medium lilac 70.27, 65.25, 108.42 0.026260% One in 3808
Medium green 161.63, 176.69, 146.57 0.017990% One in 5558
Storm blue 58.23, 86.34, 101.40 0.017740% One in 5636
Parsley green 56.22, 95.37, 54.21 0.011880% One in 8417
Beige 190.74, 191.75, 168.66 0.011060% One in 9041
Light lilac 178.70, 180.71, 198.78 0.010070% One in 9930
Bright reddish violet 128.50, 80.31, 117.46 0.008180% One in 12224
Dark green 51.20, 91.36, 70.27 0.006010% One in 16638
Light bluish green 184.72, 200.78, 201.79 0.005190% One in 19267
Turquoise 138.54, 174.68, 174.68 0.004010% One in 24937
Royal blue 86.34, 107.42, 138.54 0.003270% One in 30581
Reddish brown 107.42, 62.24, 65.25 0.002430% One in 41152
Sea green 57.22, 99.39, 64.25 0.001240% One in 80645
Bright green 75.29, 125.49, 75.29 0.000160% One in 625000
Burgundy 114.45, 68.27, 67.26 0.000150% One in 666666

Debug Colors

A debug part, with the BrickColor "Deep orange".

Older versions of Grassy Landscape spawned random BrickColors instead of using a color spectrum. Colors outside the spawnable spectrum are referred to as "debug colors", since they used an unfinished algorithm for debugging purposes (i.e. to get the rest of the game working first). Since there is currently no save system, and all debug colors have been removed from the game, it is no longer possible to encounter a part color outside of the spectrum.

"Rare BrickColors"

When generating colors, the game will refuse to generate any color that happens to be a "rare BrickColor". The list of rare BrickColors is below:

Visual Name Reason
Lig. Yellowich orange Typo
Light green (Mint) Parenthesis
Phosph. White Cool name
Transparent Transparent
Tr. Red Transparent
Tr. Lg blue Transparent
Tr. Blue Transparent
Tr. Yellow Transparent
Tr. Flu. Reddish orange Transparent
Tr. Green Transparent
Tr. Flu. Green Transparent
Tr. Brown Transparent
Tr. Medi. reddish violet Transparent
Tr. Bright bluish violet Transparent
Tr. Flu. Blue Transparent
Tr. Flu. Yellow Transparent
Tr. Flu. Red Transparent
Red flip/flop Flip/flop
Yellow flip/flop Flip/flop
Silver flip/flop Flip/flop
Sand blue metallic Metallic
Sand violet metallic Metallic
Sand yellow metallic Metallic
Dark grey metallic Metallic
Black metallic Metallic
Light grey metallic Metallic
Gun metallic Metallic
Lemon metalic Bkerr's favorite color

If the algorithm generates a color that is "rare", it will simply re-roll until it lands on one that isn't. Most likely, if someone has a part with one of these colors, it was obtained from an event or someone with the debug GUI.