Crates.io | layer-proc-gen |
lib.rs | layer-proc-gen |
version | 1.0.0 |
source | src |
created_at | 2024-11-09 11:45:48.799116 |
updated_at | 2024-11-09 11:45:48.799116 |
description | easy to use chunk based procedural generation library with top-down planning |
homepage | |
repository | https://github.com/oli-obk/layer-proc-gen |
max_upload_size | |
id | 1441993 |
size | 337,791 |
A Rust implementation of https://github.com/runevision/LayerProcGen
Each layer can use information from its dependency layers, including an arbitrarily larger region of information from its dependency layers. This allows you to write chunk-based logic, without caring about boundary conditions, as there are none.
If you are tempted to use boundary conditions out of any reason, add another layer.
Chunks are cached once computed, so accessing them repeatedly is cheap. Once too many chunks are loaded, those that have been accessed the longest time in the past will get freed automatically. By default reasonable limits for the number of loaded chunks are chosen, but you can increase or decrease them if the layers have specific other requirements.
An example game is included in the examples
section of this crate. It is an infinite
world of small towns and medium sized cities, connected by inter-city roads.
The game supports various debug views to experience the layer algorithms visually via the
F
keys:
Up
and Down
keys for zooming in and out. If you zoom out far enough, you see the roads loading in the distance.Up
and Down
make this actually interesting, as you can see when chunks start unloading in the distance.ESC
to leave.Chunk
s, not Layer
s, as the latter are a provided struct exposing everything you need from a layer for a specific Chunk
type.Chunk
so you don't accidentally mix them with others