Noisetilefunctions
Based on game build 714014 | Last updated: 2026-03-10
Overview
This file defines a set of utility functions that map continuous noise values (typically from procedural noise generation) to discrete WORLD_TILES constants. These functions are used during world generation to determine which tile type should appear at a given location based on the local noise value. The file returns a table that indexes each noise type by its identifier (e.g., WORLD_TILES.VENT_NOISE) to its corresponding mapping function, plus a default entry for general use.
Usage example
local noisetilefunctions = require("noisetilefunctions")
-- Get tile for a cave noise value
local tile = noisetilefunctions[WORLD_TILES.CAVE_NOISE](0.35)
-- Use the default mapping for ground
local ground_tile = noisetilefunctions.default(0.6)
Dependencies & tags
Components used: None identified
Tags: None identified
Properties
No public properties — this is a function-returning table, not a component.
Main functions
The file exports only internal helper functions (not methods), which are invoked by world generation systems.
GetTileForVentNoise(noise)
- Description: Maps noise values to
CAVEorVENTtiles for vent regions. - Parameters:
noise(number) — a float value typically in[0, 1]. - Returns: One of
WORLD_TILES.CAVE,WORLD_TILES.VENT. - Error states: Returns
WORLD_TILES.VENTifnoise >= 0.35; otherwiseWORLD_TILES.CAVE.
GetTileForFungusMoonNoise(noise)
- Description: Maps noise values to alternating
FUNGUSandFUNGUSMOONtiles in the Fungus Moon biome. - Parameters:
noise(number) — a float value typically in[0, 1]. - Returns: One of
WORLD_TILES.FUNGUS,WORLD_TILES.FUNGUSMOON. - Error states: Returns
WORLD_TILES.FUNGUSfor most values (noise >= 0.65);FUNGUSMOONappears in narrow bands (e.g.,[0.25, 0.35),[0.45, 0.55)).
GetTileForDirtNoise(noise)
- Description: Maps noise values to
DIRTorDESERT_DIRTtiles. - Parameters:
noise(number) — a float value typically in[0, 1]. - Returns: One of
WORLD_TILES.DIRT,WORLD_TILES.DESERT_DIRT. - Error states: Returns
WORLD_TILES.DESERT_DIRTifnoise >= 0.4; otherwiseWORLD_TILES.DIRT.
GetTileForAbyssNoise(noise)
- Description: Maps noise values to
IMPASSABLEorCAVEtiles for abyss regions. - Parameters:
noise(number) — a float value typically in[0, 1]. - Returns: One of
WORLD_TILES.IMPASSABLE,WORLD_TILES.CAVE. - Error states: Returns
WORLD_TILES.IMPASSABLEfornoise < 0.75ornoise >= 0.85;WORLD_TILES.CAVEin[0.75, 0.85).
GetTileForCaveNoise(noise)
- Description: Maps noise values to
IMPASSABLE,CAVE, orUNDERROCKtiles for cave layers. - Parameters:
noise(number) — a float value typically in[0, 1]. - Returns: One of
WORLD_TILES.IMPASSABLE,WORLD_TILES.CAVE,WORLD_TILES.UNDERROCK. - Error states:
IMPASSABLEfor low (< 0.25) or high (>= 0.7) noise;CAVEin[0.25, 0.4);UNDERROCKin[0.4, 0.7).
GetTileForFungusNoise(noise)
- Description: Maps noise values to various ground tiles (
IMPASSABLE,MUD,DIRT,FUNGUS,UNDERROCK) in the fungus biome. - Parameters:
noise(number) — a float value typically in[0, 1]. - Returns: One of
WORLD_TILES.IMPASSABLE,WORLD_TILES.MUD,WORLD_TILES.DIRT,WORLD_TILES.FUNGUS,WORLD_TILES.UNDERROCK. - Error states:
IMPASSABLEfornoise < 0.25ornoise >= 0.65; other tiles appear in distinct narrow ranges.
GetTileForMeteorCoastNoise(noise)
- Description: Maps noise values to
PEBBLEBEACHorMETEORtiles for meteor coast regions. - Parameters:
noise(number) — a float value typically in[0, 1]. - Returns: One of
WORLD_TILES.PEBBLEBEACH,WORLD_TILES.METEOR. - Error states: Returns
WORLD_TILES.METEORfornoisein[0.55, 0.75); otherwisePEBBLEBEACH.
GetTileForMeteorMineNoise(noise)
- Description: Maps noise values to
ROCKY,METEOR, orROCKYtiles in alternating bands for meteor mines. - Parameters:
noise(number) — a float value typically in[0, 1]. - Returns: One of
WORLD_TILES.ROCKY,WORLD_TILES.METEOR. - Error states:
ROCKYfornoise < 0.4ornoise >= 0.8;METEORin[0.4, 0.8).
GetTileForGroundNoise(noise)
- Description: Default mapper for surface terrain, producing a gradient from
IMPASSABLEtoMARSH. - Parameters:
noise(number) — a float value typically in[0, 1]. - Returns: One of
WORLD_TILES.IMPASSABLE,WORLD_TILES.ROAD,WORLD_TILES.ROCKY,WORLD_TILES.DIRT,WORLD_TILES.GRASS,WORLD_TILES.FOREST,WORLD_TILES.MARSH. - Error states:
MARSHfornoise >= 0.75; other tiles in narrow bands (e.g.,ROADonly in[0.26, 0.27)).
Events & listeners
Not applicable — this file defines pure utility functions and does not interact with the event system.