80k x 80k Procedural Voxel World
Role: Systems Programmer
Timeline: Apr 2024 - Jun 2024
Code Preview
heropeak_generator_script.lua
luau
1local isWorker = script.Parent and script.Parent:IsA("Actor")23if isWorker then4 -- BACKGROUND WORKER LOGIC5 local actor = script.Parent :: Actor6 local ProgressEvent = actor:WaitForChild("ProgressEvent") :: BindableEvent7 8 local EROSION_ITERATIONS = 39 local MARGIN = 410 local GRID_DIM = Config.CHUNK_SIZE + 2 * MARGIN11 12 local poolHeightMap = table.create(GRID_DIM)13 local poolNextMap = table.create(GRID_DIM)14 for i = 1, GRID_DIM do15 poolHeightMap[i] = table.create(GRID_DIM, 0)16 poolNextMap[i] = table.create(GRID_DIM, 0)17 end18 19 local Config_CHUNK_HEIGHT = 25620 local rowPoolMat = table.create(Config.CHUNK_SIZE)Overview
A multi-threaded procedural terrain generator designed to stream an 80,000 x 80,000 voxel map on Roblox at 60 FPS. Calculations are distributed across worker threads using Parallel Luau, and memory usage is kept under ~300 MB through hierarchical octrees and dynamic surface-only shell pruning.
Stack
Parallel LuauSharedTablesOctreesPerlin NoiseDomain Warping
The Hard Part
Generating large terrain without running into Roblox memory limits or freezing the main thread during batch generation.
How It Was Handled
Dispatched chunk math across an Actor worker pool, stored only visible surface voxels in memory, and generated chunks outward in a spiral around the player.