← Back to Blog

Farlight needed infinite variety. The concept was simple: explore randomly generated abandoned spaceships, each one unique. But how do you procedurally generate believable spaceships that feel like real places, not random noise?

Why Procedural Generation?

Hand-crafting levels is beautiful but time-consuming. Procedural generation lets solo devs create content at scale. For Farlight, it meant:

The challenge? Making it feel authored, not random.

The Grammar-Based Approach

I use a "ship grammar"—rules that define valid ship structures. Think of it like sentence structure in language. A ship has:

The generator starts with core modules and expands outward, ensuring every ship is navigable and logical.

Wave Function Collapse

I use a simplified Wave Function Collapse algorithm. It works by:

  1. Starting with a grid of "superposition" cells (all possibilities)
  2. Collapsing one cell to a specific room type
  3. Propagating constraints—adjacent cells update their possibilities
  4. Repeat until all cells are resolved

This ensures rooms connect properly. A hallway entrance must have a hallway or room entrance adjacent, never a wall.

Module Placement Rules

Constraints make spaceships believable:

These rules emerged from research and sci-fi logic. Real spacecraft design informed the constraints.

Seeded Generation

All generation uses a seed value. Same seed = same ship. This lets players share interesting discoveries:

Detail Pass: Making It Lived-In

Once the layout is generated, a detail pass adds environmental storytelling:

This pass uses separate probability tables for each room type, making discoveries contextual.

Navigation and Flow

Good level design has flow—a sense of progression. For procedural generation, this is hard. I use:

Performance Considerations

Generating a ship needs to be fast. Optimization strategies:

Generation happens during the loading screen. Most ships generate in under 2 seconds.

Testing Procedural Content

Testing procedural games is weird. You can't test every possibility. Instead:

I found bugs where specific room combinations caused dead ends or unreachable areas. These required constraint tweaking.

Balancing Variety and Coherence

Too much variety creates visual chaos. Too little feels repetitive. I balance by:

Players should feel variety without feeling lost in randomness.

Lessons Learned

Procedural generation isn't "free content"—it's trading design time for systems engineering. Key lessons:

The Future of Procedural Design

Procedural generation is a tool, not a solution. The best procedural games combine handcrafted elements with algorithmic variety. Farlight's spaceships feel believable because the modules are carefully designed, even if the arrangements are random.

I'm excited about machine learning-assisted generation—imagine training an AI on good level design and having it generate new levels that feel authored. We're not there yet, but the potential is enormous.

Want to start with procedural generation? Begin with something constrained—dungeon rooms, 2D levels, or simple puzzles. Master the basics before attempting complex 3D environments.

Building Farlight taught me that procedural generation is a design philosophy, not just a technique. It's about creating systems that surprise you as the developer, systems that generate content you didn't explicitly design but that still feels intentional.

And when you boot up Farlight and explore a spaceship that has never existed before and will never exist again? That's when procedural generation feels like magic.

← Back to Blog