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.
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
}
returnConfig
๐ก
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.
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.
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)
localfunctiongenerateNodes(archetype, rng)
localnodes, z, y, theta = {}, 0, 0, 0fori = 1, 32dolocalposifarchetype == "spiral"thentheta = theta + 0.45localR = 26 + i * 1.4pos = Vector3.new(math.cos(theta) * R, 0, math.sin(theta) * R)
elseifarchetype == "tower"thentheta = theta + 0.45y = (i - 1) * 4-- climb 4 studs each steppos = Vector3.new(math.cos(theta) * 20, y, math.sin(theta) * 20)
elsez = z + 20-- line and zigzag just move forwardpos = Vector3.new(rng:NextInteger(-25, 25), 0, z)
endnodes[i] = posendreturnnodesend
๐ก
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 likelylocalfunctionpickWeighted(weights, rng)
localtotal = 0for _, winpairs(weights) dototal = total + wendlocalroll = rng:NextNumber() * totalforkind, winpairs(weights) doroll = roll - wifroll <= 0thenreturnkindendendreturn"plain"end-- mood: shuffle the palette and jitter the skyfunctionmapgen.moodify(theme, rng)
localsky = theme.skysky.FogEnd = sky.FogEnd * (0.7 + rng:NextNumber() * 0.6)
sky.Brightness = 2 + rng:NextNumber()
returnthemeend
๐ก
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.
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 _, childinipairs(courseFolder:GetChildren()) dochild:()
endlocalrng = .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
๐น๏ธ
Build it in the browser first
Try this project step by step right here: write the code, watch it run, then download it and keep building in your engine.