gleeps

Types

TBD

pub type Action
pub type Armor {
  WoodenArmor
  MetalArmor
}

Constructors

  • WoodenArmor
  • MetalArmor

Used to produce weapons and armor

pub type Armory {
  ArmoryStructure
}

Constructors

  • ArmoryStructure

Movable storage

pub type Cart {
  CartStructure(capacity: Int, contents: List(Item))
}

Constructors

  • CartStructure(capacity: Int, contents: List(Item))

Like a wall, but walkable for friendlies.

pub type Gate {
  GateStructure
}

Constructors

  • GateStructure

Large housing capacity and unit generation over time.

pub type House {
  HouseStructure
}

Constructors

  • HouseStructure

size is the space this item will take up in a storage

pub type Item {
  Wood
  Stone
  Metal
  Weapon(weapon: Weapon)
  Armor(armor: Armor)
}

Constructors

  • Wood
  • Stone
  • Metal
  • Weapon(weapon: Weapon)
  • Armor(armor: Armor)
pub type Position {
  Position(x: Int, y: Int)
}

Constructors

  • Position(x: Int, y: Int)
pub type Runtime(state) {
  Runtime(
    init: fn() -> state,
    encode: fn(state) -> json.Json,
    decode: decode.Decoder(state),
    loop: fn(state, World) -> #(state, List(Action)),
  )
}

Constructors

Small housing capacity and unit generation over time.

May be upgraded to a house or armory.

pub type Shack {
  ShackStructure(next_unit: Tick)
}

Constructors

  • ShackStructure(next_unit: Tick)

Storage for any one resource

pub type Storage {
  StorageStructure(capacity: Int, contents: List(Item))
}

Constructors

  • StorageStructure(capacity: Int, contents: List(Item))
pub type Structure {
  Watchtower(
    position: Position,
    health: Int,
    structure: Watchtower,
  )
  Cart(position: Position, health: Int, structure: Cart)
  Shack(position: Position, health: Int, structure: Shack)
  Storage(position: Position, health: Int, structure: Storage)
  Tower(position: Position, health: Int, structure: Tower)
  Wall(position: Position, health: Int, structure: Wall)
  Gate(position: Position, health: Int, structure: Gate)
  House(position: Position, health: Int, structure: House)
  Armory(position: Position, health: Int, structure: Armory)
  Toolsmith(
    position: Position,
    health: Int,
    structure: Toolsmith,
  )
}

Constructors

  • Watchtower(
      position: Position,
      health: Int,
      structure: Watchtower,
    )

    Increased vision & ranged attack range

  • Cart(position: Position, health: Int, structure: Cart)

    Movable storage

  • Shack(position: Position, health: Int, structure: Shack)

    Small housing capacity and unit generation over time.

    May be upgraded to a house or armory.

  • Storage(position: Position, health: Int, structure: Storage)

    Storage for any one resource

  • Tower(position: Position, health: Int, structure: Tower)

    Upgraded watchtower Increased vision, ranged attack range and damage resistance.

    Slots in between walls & gates

  • Wall(position: Position, health: Int, structure: Wall)

    Blocks any and all units from moving through a tile. Self explanatory.

  • Gate(position: Position, health: Int, structure: Gate)

    Like a wall, but walkable for friendlies.

  • House(position: Position, health: Int, structure: House)

    Large housing capacity and unit generation over time.

  • Armory(position: Position, health: Int, structure: Armory)

    Used to produce weapons and armor

  • Toolsmith(position: Position, health: Int, structure: Toolsmith)

    Used to produce tools to increase work speed and yield

pub type Terrain {
  Plains
  Swamp
  Blocked
}

Constructors

  • Plains

    Normal tile

  • Swamp

    Harder to move through

  • Blocked

    Impossible to move through

Denotes a specific game tick

pub type Tick {
  Tick(Int)
}

Constructors

  • Tick(Int)

Used to produce tools to increase work speed and yield

pub type Toolsmith {
  ToolsmithStructure
}

Constructors

  • ToolsmithStructure

Upgraded watchtower Increased vision, ranged attack range and damage resistance.

Slots in between walls & gates

pub type Tower {
  TowerStructure
}

Constructors

  • TowerStructure
pub type Unit {
  Unit(position: Position, owner: BitArray)
}

Constructors

  • Unit(position: Position, owner: BitArray)

Blocks any and all units from moving through a tile. Self explanatory.

pub type Wall {
  WallStructure
}

Constructors

  • WallStructure

Increased vision & ranged attack range

pub type Watchtower {
  WatchtowerStructure
}

Constructors

  • WatchtowerStructure
pub type Weapon {
  Stick
  Bow
  Spear
  Sword
}

Constructors

  • Stick
  • Bow
  • Spear
  • Sword
pub type World {
  World(
    terrain: dict.Dict(Position, Terrain),
    structures: dict.Dict(Position, Structure),
    units: dict.Dict(Position, Unit),
  )
}

Constructors

TBD

pub type WorldState {
  WorldState
}

Constructors

  • WorldState

    TBD

Values

pub const init_signature: String

The required public signature in your module

pub fn item_size(item: Item) -> Int

Get the storage size a given item takes up

pub fn new(
  init init: fn() -> state,
  encode encode: fn(state) -> json.Json,
  decode decode: decode.Decoder(state),
  loop loop: fn(state, World) -> #(state, List(Action)),
) -> Runtime(state)

creates a new runtime

Search Document