Skip to main content

Module noise

Module noise 

Expand description

The bit-exact foundations, from their own crate (banished-core). The engine’s Perlin noise, which the terrain generator uses.

It is value noise: a hash gives a value for each integer point, the values are smoothed over the 3 × 3 neighbours and joined with cosine interpolation, and several octaves are added. Every float operation is single precision and in the original’s order, and cosf is the C runtime’s (crate::crt::cosf), so the values match the original to the last bit.

use banished_core::noise::PerlinNoise;

let noise = PerlinNoise::new(0.5, 4.0, 17, 31);
let value = noise.generate(12.5, 40.25);
assert!(value.is_finite());

Original: Utility::PerlinNoise, Runtime 0x18010ad80 to 0x18010b520.

Structs§

PerlinNoise
A noise field: its persistence, octaves and two seeds.