← Back to Portfolio
Unity · C# · Procedural Generation Complete

Procedural
Unity World

A runtime-generated open world in Unity 2022, chunk-based 3D terrain, L-system vegetation, Mitchell's Best Candidate spatial distribution, multi-modal animal controllers, and a custom audio system with per-channel routing and playlist handling. Four independent systems built to coexist within a real frame budget.

🎮 Unity 2022 ⚡ C# 🌿 L-Systems 🔊 Custom Audio ⏱ 6–8 weeks
01 · Procedural World Generation

🏔️ Systems

  • Chunk-based 3D terrain: adjustable size, quality, and collision detail; each chunk generates, activates, and destroys independently based on player proximity
  • Map configuration interface: players configure parameters and save up to five custom maps between sessions
  • Async generation: heavy computation offloaded via C# async/await to keep frame timing stable during world build
  • Custom shaders: terrain-specific shaders maintain visual consistency without standard pipeline overhead

⚙️ Engineering Decisions

01

Chunk-based over heightmap

Chunk streaming lets large worlds exist without loading everything into memory: activate and dispose on proximity rather than holding a full scene.

02

async/await over coroutines

Cleaner cancellation semantics and better integration with Unity's job system for long-running generation tasks.

02 · Algorithmic Placement & Optimisation

🌿 Systems

  • L-system vegetation: parametric rules produce unique tree structures per instance, no manual placement needed
  • Mitchell's Best Candidate sampling: Poisson-disc-style distribution of vegetation and animals eliminates visible clustering
  • Distance-based activation: plants and animals enable/disable by player proximity, eliminating unnecessary update calls at distance
  • Runtime integration: newly purchased animals inject directly into the live distribution, no scene reload required

⚙️ Engineering Decisions

01

L-systems over prefab variants

A single rule set produces genuinely varied trees at scale: no need for hundreds of hand-authored prefabs as the world grows.

02

Mitchell's over pure random

Pure random placement clusters visibly. Mitchell's produces natural spread fast enough for runtime generation.

03 · Player Interaction & Systems

🎮 Systems

  • Multi-modal controllers: seamless switching between ground, swimming, and flight movement without separate scenes or loading screens
  • Shop unlock system: players purchase additional animal types, integrated live into the procedural distribution
  • Consistent control feel: shared input architecture ensures uniform response across all movement modes and terrain types

⚙️ Engineering Decisions

01

State machine per animal

Each controller is a state machine sharing a common input interface. Switching animals swaps the active machine: no duplicated input code.

02

Shop integrated into distributor

Newly unlocked animals register directly with the placement system, keeping the world alive and populated during player progression.

04 · Audio & Music Systems

🔊 Systems

  • Custom music player: playlist handling, scrubbing, real-time timing feedback, and track metadata display
  • Separate audio routing: music and ambient on independent Unity AudioMixer groups with individual volume controls
  • Extensible architecture: designed with hooks for future adaptive audio, triggered events, and dynamic mixing layers

⚙️ Engineering Decisions

01

AudioManager singleton

All audio calls route through one manager: centralised mixing state, no simultaneous music instances, and a clear path to future Wwise migration.

02

Separate mixer groups

Independent groups for music and ambient allow volume control and future DSP inserts without cross-contamination between channels.

05 · Technology Stack
Unity 2022
Engine, rendering, build pipeline
C#
All gameplay & systems scripting
Procedural Generation
Runtime terrain & object placement
async / await
Non-blocking generation pipeline
Custom Shaders
Terrain visual rendering
Unity AudioMixer
Multi-channel audio routing
06 · Reflection

🎓 What this project was about

The challenge wasn't building any one system, it was making them coexist. Chunk generation, async placement, live animal registration, and per-channel audio routing all share the same frame budget. The emphasis throughout was on extensible, performance-aware architecture that leaves room for future layers rather than brittle one-shot implementations.

Interested in Procedural Systems?

Happy to discuss Unity architecture, procedural generation, or the audio manager design in detail.