swarm-0.3.0.1: 2D resource gathering game with programmable robots
CopyrightBrent Yorgey
LicenseBSD-3-Clause
Maintainerbyorgey@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.Game.WorldGen

Description

Procedural world generation via coherent noise.

Synopsis

Documentation

testWorld1 :: Coords -> (TerrainType, Maybe Text) Source #

A simple test world used for a while during early development.

data Size Source #

Constructors

Small 
Big 

Instances

Instances details
Read Size Source # 
Instance details

Defined in Swarm.Game.WorldGen

Show Size Source # 
Instance details

Defined in Swarm.Game.WorldGen

Methods

showsPrec :: Int -> Size -> ShowS #

show :: Size -> String #

showList :: [Size] -> ShowS #

Eq Size Source # 
Instance details

Defined in Swarm.Game.WorldGen

Methods

(==) :: Size -> Size -> Bool #

(/=) :: Size -> Size -> Bool #

Ord Size Source # 
Instance details

Defined in Swarm.Game.WorldGen

Methods

compare :: Size -> Size -> Ordering #

(<) :: Size -> Size -> Bool #

(<=) :: Size -> Size -> Bool #

(>) :: Size -> Size -> Bool #

(>=) :: Size -> Size -> Bool #

max :: Size -> Size -> Size #

min :: Size -> Size -> Size #

data Hardness Source #

Constructors

Soft 
Hard 

Instances

Instances details
Read Hardness Source # 
Instance details

Defined in Swarm.Game.WorldGen

Show Hardness Source # 
Instance details

Defined in Swarm.Game.WorldGen

Eq Hardness Source # 
Instance details

Defined in Swarm.Game.WorldGen

Ord Hardness Source # 
Instance details

Defined in Swarm.Game.WorldGen

data Origin Source #

Constructors

Natural 
Artificial 

Instances

Instances details
Read Origin Source # 
Instance details

Defined in Swarm.Game.WorldGen

Show Origin Source # 
Instance details

Defined in Swarm.Game.WorldGen

Eq Origin Source # 
Instance details

Defined in Swarm.Game.WorldGen

Methods

(==) :: Origin -> Origin -> Bool #

(/=) :: Origin -> Origin -> Bool #

Ord Origin Source # 
Instance details

Defined in Swarm.Game.WorldGen

type Seed = Int Source #

testWorld2Entites :: Set Text Source #

A list of entities available in the initial world.

readEntity :: EntityMap -> Text -> Entity Source #

Look up an entity name in an entity map, when we know the entity must exist. This is only used for entities which are named in testWorld2.

testWorld2 :: EntityMap -> Seed -> WorldFun TerrainType Entity Source #

The main world of the classic game, for historical reasons named testWorld2. If new entities are added, you SHOULD ALSO UPDATE testWorld2Entities.

testWorld2FromArray :: EntityMap -> Array (Int32, Int32) (TerrainType, Maybe Entity) -> Seed -> WorldFun TerrainType Entity Source #

Create a world function from a finite array of specified cells plus a seed to randomly generate the rest.

findOffset :: Integer -> ((Coords -> (t, Maybe e)) -> Bool) -> WorldFun t e -> WorldFun t e Source #

Offset a world by a multiple of the skip in such a way that it satisfies the given predicate.

findPatchWith :: [Text] -> WorldFun t Entity -> WorldFun t Entity Source #

Offset the world so the base starts in a 32x32 patch containing at least one of each of a list of required entities.

findTreeOffset :: WorldFun t Entity -> WorldFun t Entity Source #

Offset the world so the base starts on empty spot next to tree and grass.

findGoodOrigin :: WorldFun t Entity -> WorldFun t Entity Source #

Offset the world so the base starts in a good patch (near necessary items), next to a tree.