2D Side-Scrolling Terrain Generator
Richard Leover, Marcus-Imre Tikerpe, Kristjan Radsin
Repository link: https://github.com/marcusut/2d-terraingen
Final build link: https://drive.google.com/file/d/1P1x7TLHozp-FymLtTED_wKAha84g3dlY/view?usp=sharing
Overview
The idea is to build an interactive 2D world that is generated procedurally at runtime. You can move a player through an infinite side-scrolling world that starts simple, just terrain and gradually gains depth (biomes, physics interactions, lighting, and ambience). The goal is to learn core procedural generation concepts. Although the initial idea was to use Godot, we opted to use Unity instead due to better understanding of it.
Initial progress
Features
- A numeric seed produces the same world each run.
- Perlin noise to generate ground and grass tiles on a Unity Tilemap.
- Controllable player character for traversing the world.
- Following camera
- Generate tiles in fixed size chunks around the player and unload distant chunks.
Initial build link: https://drive.google.com/file/d/1F7q6kCrclcFAICg-OlWGhXUt82SG5EVg/view?usp=sharing
Intermediary progress
(08.12.25)

Features
- Seed-based tree and rock generation with configurable variables
- Background moving clouds generation
- A minimap
Final release
World generation
The world is generated procedurally in chunks around the player, so exploration can continue indefinitely without loading screens.
A large set of exposed parameters lets you tweak how the world looks and plays: terrain height and roughness, underground density, and the spawn rates and size of features like trees, rocks and caves
Cave generation
The underground is carved using deterministic 2D noise, so caves regenerate consistently from the same seed.
Added cave entrances where they are carved using a short worm path that can drift diagonally and sideways, with a wider mouth near the surface.
Caves are backed by a dedicated wall tilemap so tunnels feel like actual spaces rather than holes cut into nothing.
Block breaking (interactive digging)
You can remove blocks by clicking them

Lighting
Implemented dynamic URP 2D lighting where terrain casts shadows, creating a naturally dark underground that requires light sources to explore. Added placeable torches with a flickering flame effect; torches interact with the world and will fall if the block beneath them is destroyed. There is no directional light in Unity's Light 2D, so we had to compromise with a faraway light source instead.
Day & night cycle
A full 24-hour cycle drives the world's atmosphere, transitioning skybox colors, ambient light, and cloud tints through sunrise, day, sunset, and night. The Sun and Moon feature a custom parallax orbit system, ensuring they remain visible in the sky while casting consistent "directional" shadows across the terrain.
Cloud system improvements
Parallax clouds that wrap seamlessly around the camera so the sky always feels populated.
Cloud tint updates dynamically based on the day/night cycle.
New prettier textures & tile polish
New pixel art was drawn for the textures.
Tiles on the edges of terrain use proper versions with borders, giving everything a nicer look.
Tiles get darker the deeper underground they are, done by adjusting their color based on depth.
The code for generating trees and rocks was updated with extra checks to avoid cutoff and awkward placement.
Technical notes
Everything remains seed-based and chunked, so the world stays infinite and consistent.
Caves and entrances are generated deterministically from tile coordinates and the world seed, which helps avoid seams when chunks load/unload.
Build link: https://drive.google.com/file/d/1P1x7TLHozp-FymLtTED_wKAha84g3dlY/view?usp=sharing

