viva_aion/generator

Generator - The Architect of the Inevitable

Generates deterministic labyrinths using Recursive Backtracker. Same seed = same labyrinth. Always.

“All You Zombies” - The seed determines the entire history and future of the world.

Types

A generated labyrinth

pub type Labyrinth {
  Labyrinth(
    seed: seed.Seed,
    width: Int,
    height: Int,
    grid: grid.Grid,
    start: position.Position,
    core: position.Position,
  )
}

Constructors

  • Labyrinth(
      seed: seed.Seed,
      width: Int,
      height: Int,
      grid: grid.Grid,
      start: position.Position,
      core: position.Position,
    )

    Arguments

    seed

    The seed that created this universe

    width

    Width in tiles

    height

    Height in tiles

    grid

    The spatial grid

    start

    Starting position (spawn point)

    core

    Core position (Leviathan - singularity)

Values

pub const default_height: Int
pub const default_width: Int

Default labyrinth size

pub fn generate(seed: seed.Seed) -> Labyrinth

Generate a labyrinth from seed

pub fn generate_sized(
  seed: seed.Seed,
  width: Int,
  height: Int,
) -> Labyrinth

Generate a labyrinth with custom size

pub fn is_core(lab: Labyrinth, pos: position.Position) -> Bool

Check if position is the core

pub fn is_passable(
  lab: Labyrinth,
  pos: position.Position,
) -> Bool

Check if position is passable

pub fn passable_neighbors(
  lab: Labyrinth,
  pos: position.Position,
) -> List(position.Position)

Get passable neighbors

pub fn path_count(lab: Labyrinth) -> Int

Count path tiles

pub fn to_string(lab: Labyrinth) -> String

Visualize the labyrinth

pub fn to_string_at(
  lab: Labyrinth,
  pos: position.Position,
) -> String

Visualize with current position marked

Search Document