LayerProcGen is a framework that can be used to implement layer-based procedural generation that's infinite, deterministic and contextual. It works out of the box in Unity but can be used in any C#-compatible engine.
LayerProcGen is open source under the Mozilla Public Licence 2.0:
Check it out on GitHub
I took care to thoroughly explain and illustrate the concept of the framework:
Read the Documentation
LayerProcGen has inspired ports and other projects:
Check out the Discussions
The framework does not itself include any procedural generation algorithms. At its core, it's a way to keep track of dependencies between generation processes in a powerful spatial way.
Generating infinite worlds in chunks is a well-known concept since Minecraft.
However, there is a widespread misconception that the chunk-based approach can't be used deterministically with algorithms where the surroundings of a chunk would need to affect the chunk itself.
LayerProcGen is designed to help with just that.
Talk at Everything Procedural Conference 2024
In 2024 I gave a talk about Layer-Based Infinite Procedural Generation at the Everything Procedural Conference in Breda, The Nederlands. You can see it here:
Features
Contextual & deterministic
A central purpose of the framework is to support contextual generation while staying deterministic. Procedural operations can be performed across chunk boundaries, producing seamless results for context-based operations such as blurring, point relaxation, or path-finding. This is possible by dividing the generation into multiple layers and keeping a strict separation between the input and output of each layer.
Docs: Contextual Generation
Plan at scale with intent
Chunks in one layer can be orders of magnitude larger than chunks in another layer, and you can design them to operate at different levels of abstraction. You can use top-down planning to e.g. have road signs point to distant locations, unlock entire regions based on player progress, or have NPCs talk about things at the other side of the continent.
Docs: Planning at Scale
Bring your own algorithms
You implement data layers by creating pairs of layer and chunk classes, and you can use whichever generation techniques you want there, as long as they are suitable for generation in chunks on the fly.
Docs: Layers and Chunks
Handles dependencies
The framework makes it possible to build many different chunk-based procedural data layers with dependencies between each other. It automatically generates depended on chunks when they are needed by chunks in other layers, or by top level requirements.
Docs: Layer Dependencies
Two-dimensional infinity
The framework arranges chunks in either a horizontal or vertical plane. It can be used for 2D or 3D worlds, but 3D worlds can only extend infinitely in two dimensions, similar to Minecraft. The infinity is pseudo-infinite, as it is limited by the range of 32-bit integer numbers and the specifics of which calculations you use in your procedural processes.
Multi-threaded
The framework is multi-threaded based on Parallel.ForEach functionality in .Net. The degree of parallelism automatically scales to the number of available cores. When needed, actions can be enqueued to be performed on the main thread.
4 blog posts related to LayerProcGen
Layer-Based Procedural Generation
One of the problems you'll face when creating an infinite procedurally generated world is that your procedural algorithm is not completely context-free: For example, some block might need to know about neighboring blocks. To use graphics processing as an example, you might have an initial noise function which is completely context-free, but very often an interesting procedural generation algorithm will also involve a blur filter, or something else where the local result depends on the neighboring data. But since you only have a part of the world loaded/generated at a time, what do you do at the boundaries of the loaded area? The neighboring pixels or data isn't available there since it isn't loaded/generated yet. The layer-based approach I describe in this post and video is a way to address this issue. ...
Rolling Grids for Infinite Worlds
I want to share how I do the rolling grids I use in The Cluster that in essence acts as infinite 2D arrays. Originally, my procedural game The Cluster (you can read all the posts about The Cluster here) was divided into "levels". The levels lined up seamlessly so wouldn't be noticed by the player, but in the implementation they were completely separate. Tons of code was used to deal with the boundaries of the levels. Every algorithm that handled some kind of grid, and which looked at neighbor cells in that grid, had to have special boundary case handling for the edges, which was a pain. ...
Technologies in my Procedural Game The Cluster
This post is about The Cluster, my 2.5D platform game under development with focus on non-linear exploration, set in a big, continuous world. You can read all the posts about The Cluster here. In this post I'm creating an overview of the different technical aspects of The Cluster and listing links to posts I've written in each area. I'm also describing areas I haven't written about (yet). If there's any of these areas you'd like to hear more about, let me know in the comments. This can help me decide which areas to prioritize in future posts. ...
Forcing Structure in Procedural Spaces
The procedural game I'm working on in my spare time, The Cluster, has a focus on non-linear exploration and is set in a big, continuous world. When I've let people play it in its current state they've been happy to roam around at first, but quickly become bewildered from a lack of sense of direction and purpose because they could go so many places but had little idea of what they're supposed to do other than running around aimlessly. That got me thinking about ways to direct the experience better. ...

