Copyright | Brent Yorgey |
---|---|
License | BSD-3-Clause |
Maintainer | byorgey@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Procedural world generation via coherent noise.
Synopsis
- testWorld1 :: Coords -> (TerrainType, Maybe Text)
- data Size
- data Hardness
- data Origin
- type Seed = Int
- testWorld2Entites :: Set Text
- readEntity :: EntityMap -> Text -> Entity
- testWorld2 :: EntityMap -> Seed -> WorldFun TerrainType Entity
- testWorld2FromArray :: EntityMap -> Array (Int64, Int64) (TerrainType, Maybe Entity) -> Seed -> WorldFun TerrainType Entity
- findOffset :: Integer -> ((Coords -> (t, Maybe e)) -> Bool) -> WorldFun t e -> WorldFun t e
- findPatchWith :: [Text] -> WorldFun t Entity -> WorldFun t Entity
- findTreeOffset :: WorldFun t Entity -> WorldFun t Entity
- findGoodOrigin :: WorldFun t Entity -> WorldFun t Entity
Documentation
testWorld1 :: Coords -> (TerrainType, Maybe Text) Source #
A simple test world used for a while during early development.
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 (Int64, Int64) (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.