๐Ÿ”ด SIM LOCKDOWN ยท Episode 2 of 3 ยท See All Episodes
๐Ÿ”ด Episode 2 ยท Advanced ยท Scripting

SIM LOCKDOWN
3 Maps, Never the Same

No two matches should look alike. In this episode you give the game three completely different themes, then write a generator that rebuilds each one as a brand new course every single round. Same code, endless maps.

๐Ÿง’ Ages 9+ โฑ๏ธ ~1.5 Hours ๐ŸŸฆ Roblox Studio โœ“ Free
๐ŸŽฒ Random seeds ๐Ÿงฉ Tables ๐Ÿ”ง Instance.new ๐Ÿงฎ Loops + maths ๐ŸŒˆ Materials
โญ
0 XP
Level 1
๐Ÿ”ฅ0
Your Progress 0 / 6 steps
๐ŸฆŠ
Lumo says: this episode is about one idea, a map made out of nodes. A node is just a position. Move the nodes, change the theme, and the whole course changes. Once you see it, procedural levels are easy.
1
๐ŸŽจ
Give Each Map a Theme
Colours, sky, material and obstacle mix, one table per theme
Active
๐ŸŽฏ
Goal for this step

Three themes, each with its own look and its own favourite obstacles.

We store each theme as a table. A table is a labelled box of values. Here is the shape, with one theme filled in:

Config (ModuleScript)
Config.THEMES = { { name = "SECTOR::GRID", material = Enum.Material.SmoothPlastic, palette = { Color3.fromRGB(34,196,236), Color3.fromRGB(153,104,255) }, weights = { gap = 3, movers = 3, spinner = 2, hazard = 2 }, }, -- CRYO (slippery ice) and FORGE (lava rock) look completely different } return Config
๐Ÿ’ก
weights are the odds. A weight of 3 means that obstacle shows up three times as often as one with weight 1. That is how one theme can feel full of spinning bars and another full of moving platforms.
๐Ÿ“
Fill in the Concept
+15 XP
Each entry in Config.THEMES holds a of colours and a table that decides how often each obstacle appears.
๐Ÿง 
Knowledge Check
+15 XP
What does the weights table control?
AHow heavy the platforms are, so they fall faster
BHow bright the sky is
CHow often each obstacle is chosen
2
๐Ÿ›ค๏ธ
A Path of Nodes
Generate a list of positions, then connect them with platforms
Locked
๐ŸŽฏ
Goal for this step

Turn a random list of positions into a walkable course.

  • 1Make a Random object so we can pick random numbers, and a list called nodes.
  • 2Loop, and each time push the cursor forward a little and sideways a random amount.
  • 3For each node, create a Part platform with Instance.new.
MapGen (ModuleScript)
local mapgen = {} local function newPart(parent, size, pos, colour) local p = Instance.new("Part") p.Size = size p.Position = pos p.Color = colour p.Anchored = true p.Parent = parent return p end function mapgen.buildPath(parent, theme, rng) local nodes = {} local z = 0 for i = 1, 30 do z = z + rng:NextInteger(18, 26) local x = rng:NextInteger(-20, 20) nodes[i] = Vector3.new(x, 0, z) end for i, pos in ipairs(nodes) do local colour = theme.palette[rng:NextInteger(1, #theme.palette)] newPart(parent, Vector3.new(18, 2, 20), pos, colour) end return nodes end return mapgen
๐Ÿ”ง
Platforms need to overlap or the gap is impossible to cross. Keep the sideways step small (here 20) compared to the platform width (18 to 26) so each platform touches the next.
โŒจ๏ธ
Code Challenge
+20 XP

Create a new Part and place it at a position:

local p = .new("Part") p.Position = .new(0, 0, 10) p.Anchored = true
Hint: the service that makes new objects, and the type that stores an X Y Z position.
๐Ÿง 
Knowledge Check
+15 XP
What is a "node" in this map system?
AA position the course is built around
BA type of Roblox script
CA player in the game
3
๐ŸŒ€
Layout Archetypes
Five different shapes the path can take, chosen at random
Locked
๐ŸŽฏ
Goal for this step

Make the course come out in completely different shapes, not just different colours.

A straight line gets boring. Instead we pick a random archetype and let it decide where the nodes go:

  • 1line, the path drifts gently forward.
  • 2zigzag, the path swings left and right.
  • 3spiral, the path curls outward like a snail shell.
  • 4tower, the platforms climb upward in a helix.
  • 5islands, scattered platforms you jump between.
MapGen (ModuleScript)
local function generateNodes(archetype, rng) local nodes, z, y, theta = {}, 0, 0, 0 for i = 1, 32 do local pos if archetype == "spiral" then theta = theta + 0.45 local R = 26 + i * 1.4 pos = Vector3.new(math.cos(theta) * R, 0, math.sin(theta) * R) elseif archetype == "tower" then theta = theta + 0.45 y = (i - 1) * 4 -- climb 4 studs each step pos = Vector3.new(math.cos(theta) * 20, y, math.sin(theta) * 20) else z = z + 20 -- line and zigzag just move forward pos = Vector3.new(rng:NextInteger(-25, 25), 0, z) end nodes[i] = pos end return nodes end
๐Ÿ’ก
Because we pick the archetype with rng, the same theme can be a spiral one match and an island hop the next. That is the trick that makes every play different.
๐Ÿ”ข
Put the build steps in order
+15 XP

Click the steps in the order the generator runs them:

Pick a random theme and archetype
Generate the list of node positions
Build a platform at each node
Scatter obstacles and collectibles
๐Ÿง 
Knowledge Check
+15 XP
What makes the spiral archetype different from the line?
AIt is always green
BIts nodes curve around a centre instead of going straight
CIt has no platforms at all
4
๐ŸŒฆ๏ธ
Mood and Obstacles
Jitter the sky and scatter obstacles using the theme weights
Locked
๐ŸŽฏ
Goal for this step

Two maps of the same theme should still feel different, because of mood and obstacle density.

  • 1Shuffle the palette order so the colours land differently.
  • 2Nudge the fog and brightness a little each match.
  • 3Pick each node's obstacle with a helper that reads the theme weights.
MapGen (ModuleScript)
-- a weighted pick: higher weight = more likely local function pickWeighted(weights, rng) local total = 0 for _, w in pairs(weights) do total = total + w end local roll = rng:NextNumber() * total for kind, w in pairs(weights) do roll = roll - w if roll <= 0 then return kind end end return "plain" end -- mood: shuffle the palette and jitter the sky function mapgen.moodify(theme, rng) local sky = theme.sky sky.FogEnd = sky.FogEnd * (0.7 + rng:NextNumber() * 0.6) sky.Brightness = 2 + rng:NextNumber() return theme end
๐Ÿ’ก
This is the same idea as a dice roll. NextNumber() gives a value between 0 and 1. Multiply it by the total weight, then walk down the list subtracting until you go below zero. Whatever you land on is your obstacle.
๐Ÿง 
Knowledge Check
+15 XP
What does rng:NextNumber() return?
AA random whole number like 4 or 9
BThe colour of the next platform
CA decimal between 0 and 1
5
โ™ป๏ธ
A Fresh Map Every Round
Delete the old course, build a new one from a new random seed
Locked
๐ŸŽฏ
Goal for this step

Hook the generator into the match loop so every round gets its own course.

  • 1Put the course inside a single Folder so we can clear it in one go.
  • 2At the start of each round, wipe the folder and build again with a new seed.
  • 3Give each round a random theme, and mix the order so the three themes never repeat in a fixed pattern.
ObbyServer (Script)
local MapGen = require(game.ServerScriptService.MapGen) local function newCourse(theme) for _, child in ipairs(courseFolder:GetChildren()) do child:Destroy() -- clear the old map end local seed = os.time() + math.random(1, 1000000) local rng = Random.new(seed) return MapGen.build(courseFolder, theme, rng) end -- inside runRound(): local theme = Config.THEMES[math.random(1, #Config.THEMES)] newCourse(theme)
๐Ÿ”ง
Always Destroy the old map before building the new one, or the world fills up with hundreds of parts and the game slows down.
โŒจ๏ธ
Code Challenge
+20 XP

Clear the old course, then make a seeded random number generator:

for _, child in ipairs(courseFolder:GetChildren()) do child:() end local rng = .new(os.time())
Hint: the method that removes an object, and the object that makes repeatable random numbers from a seed.
๐Ÿง 
Knowledge Check
+15 XP
Why do we pass a random seed into Random.new?
ASo each round generates a different course
BSo the map loads faster
CSo players move quicker
6
๐ŸŽฒ
Play It Twice
Prove the course changes, and that every archetype is crossable
Locked
๐ŸŽฏ
Goal for this step

Run the game a few times and watch a different course appear each round.

  • 1Play the game and note the shape and colours of round one.
  • 2Wait for the next round. It should be a different theme, shape and mood.
  • 3Play a few more rounds. Every one is new, and every one is finishable.
๐Ÿ’ก
Rule of thumb: a jump in Roblox travels about 12 studs at normal speed. Keep gaps under 11, and keep upward steps to 4 studs, and your generated maps stay fair. The tower archetype climbs 4 studs each step for exactly that reason.
๐Ÿ‘จโ€๐Ÿ‘ง
Try this together: in generateNodes, change the loop count from 32 to 60. The courses get much longer. Then change it back. Small numbers, big changes.
๐Ÿง 
Knowledge Check
+15 XP
What makes every match look different?
AThe players choose a map before each round
BA new random seed and archetype every round
CThe maps are drawn by hand each time
๐ŸŽ‰โœจ๐ŸŽŠโญ๐ŸŽ‰
Endless Maps!

You built a generator that turns nodes into courses, with three themes and five layout shapes. Every round is new. Now Episode 3 turns it into a real party game with pushing, elimination and a final.

0
Total XP
1
Level
0
Best Streak
0%
Accuracy