Documentation
¶
Overview ¶
Package worldgen provides core types and interfaces for dynamic world generation.
Package worldgen provides core types and interfaces for dynamic world generation.
Package worldgen provides core types and interfaces for dynamic world generation.
Index ¶
- Constants
- func BlendEdge(chunk ChunkData, neighbors map[ChunkCoord]ChunkData, similarity float64, ...)
- func GetTransitionProbability(from, to TileType) float64
- func ShouldTransition(currentTile, neighborTile TileType, similarity float64, rng *rand.Rand) bool
- type ChunkCoord
- type ChunkData
- type Generator
- type NeighborProvider
- type TileType
Constants ¶
View Source
const ( // ChunkSize defines the dimensions of each chunk (32x32 tiles). ChunkSize = 32 // DefaultDifficulty is the default difficulty coefficient. DefaultDifficulty = 0.5 // DefaultSimilarity is the default similarity coefficient. DefaultSimilarity = 0.8 )
Variables ¶
This section is empty.
Functions ¶
func BlendEdge ¶
func BlendEdge(chunk ChunkData, neighbors map[ChunkCoord]ChunkData, similarity float64, rng *rand.Rand)
BlendEdge blends the edges of a chunk with its neighbors.
func GetTransitionProbability ¶
GetTransitionProbability returns the natural transition probability between two tile types.
Types ¶
type ChunkCoord ¶
type ChunkCoord struct {
X, Y int
}
ChunkCoord represents the unique coordinates of a map chunk.
type Generator ¶
type Generator interface {
// GenerateChunk generates chunk data for the given coordinates.
// neighbors provides adjacent chunk data for seamless transitions.
GenerateChunk(coord ChunkCoord, difficulty, similarity float64,
neighbors map[ChunkCoord]ChunkData) (ChunkData, error)
}
Generator is the core interface for world generation algorithms.
type NeighborProvider ¶
type NeighborProvider func(coord ChunkCoord) (ChunkData, error)
NeighborProvider is a function type for querying neighboring chunk data. This allows the generator to remain decoupled from chunk storage.
Click to show internal directories.
Click to hide internal directories.