bio

package
v0.0.0-...-17a2a95 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BioLevelKingdom = iota
	BioLevelFamily
	BioLevelGenus
	BioLevelSpecies
	BioLevelSubspecies
)

Variables

View Source
var (
	KingdomFauna = NewKingdom("Fauna")
	KingdomFlora = NewKingdom("Flora",
		BioLevelDigestion(DigestivePhotosynthetic))
	KingdomFungi = NewKingdom("Fungi",
		BioLevelDigestion(DigestiveDecomposer),
		BioLevelHumidityRange(0.2, 1))

	// Trees.
	FamilyTree = KingdomFauna.NewChild("Tree",
		BioLevelEcosphere(EcosphereTypeLand),
		BioLevelSteepRange(0, 0.5),
		BioLevelTempRange(0, 35),
		BioLevelHumidityRange(0.4, 0.9),
		BioLevelElevRange(0, 0.7))

	// Leaf trees.
	GenusLeafyTree = FamilyTree.NewChild("Leafy Tree") // Trees that produce leaves.
	SpeciesOak     = GenusLeafyTree.NewChild("Oak",
		BioLevelHumidityRange(0.4, 0.8))

	// Needle trees.
	GenusNeedleTree = FamilyTree.NewChild("Needle Tree") // Trees that produce needles.
	SpeciesPine     = GenusNeedleTree.NewChild("Pine",
		BioLevelHumidityRange(0.4, 0.8))

	// Shrubs.
	FamilyShrub = KingdomFlora.NewChild("Shrub",
		BioLevelEcosphere(EcosphereTypeLand))
	GenusLeafyShrub  = FamilyShrub.NewChild("Leafy Shrub")  // Shrubs that produce leaves.
	GenusNeedleShrub = FamilyShrub.NewChild("Needle Shrub") // Shrubs that produce needles.

	// Grasses.
	FamilyGrass = KingdomFlora.NewChild("Grass",
		BioLevelTempRange(0, 35),
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver)) // Grasses can grow alongside rivers.
	GenusCereal = FamilyGrass.NewChild("Cereal",
		BioLevelTempRange(14, 28),
		BioLevelHumidityRange(0.1, 0.8),
		BioLevelAppendHereditary(BioPropertyEdibleSeed),
	)
	SpeciesWheat = GenusCereal.NewChild("Wheat",
		BioLevelTempRange(20, 25),
		BioLevelSteepRange(0, 0.7))
	SpeciesRice = GenusCereal.NewChild("Rice",
		BioLevelTempRange(21, 37),
		BioLevelHumidityRange(0.6, 1),
		BioLevelSteepRange(0, 0.4))
	SpeciesBarley = GenusCereal.NewChild("Barley",
		BioLevelTempRange(12, 25))
	SpeciesOats = GenusCereal.NewChild("Oats",
		BioLevelTempRange(15, 23))
	SpeciesCorn = GenusCereal.NewChild("Corn",
		BioLevelTempRange(20, 30))
	SpeciesRye = GenusCereal.NewChild("Rye",
		BioLevelTempRange(25, 35))
	SpeciesBuckwheat = GenusCereal.NewChild("Buckwheat",
		BioLevelTempRange(17, 27))
	SpeciesMillet = GenusCereal.NewChild("Millet",
		BioLevelTempRange(26, 29))
	SpeciesSorghum = GenusCereal.NewChild("Sorghum",
		BioLevelTempRange(26, 34))

	GenusReed        = FamilyGrass.NewChild("Reed")
	SpeciesSugarCane = GenusReed.NewChild("Sugar Cane",
		BioLevelHumidityRange(0.6, 1),
		BioLevelTempRange(20, 35))
	SpeciesBamboo = GenusReed.NewChild("Bamboo",
		BioLevelTempRange(15, 26))

	// Generic grasses.
	GenusGrass       = FamilyGrass.NewChild("Grass")
	SpeciesGrass     = GenusGrass.NewChild("Grass")
	SpeciesCrabGrass = GenusGrass.NewChild("Crab Grass")

	// Herbs.
	FamilyHerb = KingdomFlora.NewChild("Herb",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver))

	// Flowers.
	FamilyFlower = KingdomFlora.NewChild("Flower",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver))

	// Leafy greens.
	GenusLeafyGreen = FamilyFlower.NewChild("Leafy Green",
		BioLevelAppendHereditary(BioPropertyEdibleLeafs))
	SpeciesCabbage = GenusLeafyGreen.NewChild("Cabbage")
	SpeciesLettuce = GenusLeafyGreen.NewChild("Lettuce")
	SpeciesSpinach = GenusLeafyGreen.NewChild("Spinach")

	// Generic flowers.
	GenusFlower  = FamilyFlower.NewChild("Flower")
	SpeciesRose  = GenusFlower.NewChild("Rose")
	SpeciesTulip = GenusFlower.NewChild("Tulip")
	SpeciesDaisy = GenusFlower.NewChild("Daisy")

	// Ferns.
	FamilyFern = KingdomFlora.NewChild("Fern",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver))

	// Mosses.
	FamilyMoss = KingdomFlora.NewChild("Moss",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver))

	// Vines.
	FamilyVine = KingdomFlora.NewChild("Vine",
		BioLevelEcosphere(EcosphereTypeLand))
	GenusGrapeVine = FamilyVine.NewChild("Grape Vine",
		BioLevelAppendHereditary(BioPropertyEdibleFruit))
	SpeciesWineGrape = GenusGrapeVine.NewChild("Wine Grape",
		BioLevelTempRange(12, 20),
		BioLevelHumidityRange(0.4, 0.8))
	SpeciesKiwiVine = GenusGrapeVine.NewChild("Kiwi Vine",
		BioLevelTempRange(18, 28),
		BioLevelHumidityRange(0.4, 0.8))

	GenusClimbingVine   = FamilyVine.NewChild("Climbing Vine")
	SpeciesMorningGlory = GenusClimbingVine.NewChild("Morning Glory")
	SpeciesClimbingBean = GenusClimbingVine.NewChild("Climbing Bean")

	// Cacti.
	FamilyCactus = KingdomFlora.NewChild("Cactus",
		BioLevelHumidityRange(0, 0.2),
		BioLevelTempRange(10, 35),
		BioLevelEcosphere(EcosphereTypeLand))
	FamilySucculent = KingdomFlora.NewChild("Succulent",
		BioLevelHumidityRange(0, 0.2),
		BioLevelTempRange(10, 35),
		BioLevelEcosphere(EcosphereTypeLand))

	// Insects.
	FamilyInsect = KingdomFauna.NewChild("Insect",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver),
		BioLevelDigestion(DigestiveSystemHerbivore),
		BioLevelLocomotion(LocomotionWalk|LocomotionClimb))
	GenusAnt         = FamilyInsect.NewChild("Ant")
	GenusBeetle      = FamilyInsect.NewChild("Beetle")
	GenusCaterpillar = FamilyInsect.NewChild("Caterpillar")
	GenusGrasshopper = FamilyInsect.NewChild("Grasshopper")
	GenusButterfly   = FamilyInsect.NewChild("Butterfly",
		BioLevelLocomotion(LocomotionFly))
	GenusDragonfly = FamilyInsect.NewChild("Dragonfly",
		BioLevelLocomotion(LocomotionFly))
	GenusFly = FamilyInsect.NewChild("Fly",
		BioLevelLocomotion(LocomotionFly))
	GenusMoth = FamilyInsect.NewChild("Moth",
		BioLevelLocomotion(LocomotionFly))

	// Arachnids.
	FamilyArachnid = KingdomFauna.NewChild("Arachnid",
		BioLevelEcosphere(EcosphereTypeLand),
		BioLevelLocomotion(LocomotionWalk|LocomotionClimb))
	GenusSpider   = FamilyArachnid.NewChild("Spider")
	GenusScorpion = FamilyArachnid.NewChild("Scorpion")
	GenusTick     = FamilyArachnid.NewChild("Tick")

	// Mammals.
	FamilyMammal = KingdomFauna.NewChild("Mammal")
	GenusWhale   = FamilyMammal.NewChild("Whale",
		BioLevelEcosphere(EcosphereTypeOcean),
		BioLevelDigestion(DigestiveSystemCarnivore),
		BioLevelSize(SpeciesSizeLarge),
		BioLevelLocomotion(LocomotionSwim))
	SpeciesBlueWhale     = GenusWhale.NewChild("Blue Whale")
	SpeciesHumpbackWhale = GenusWhale.NewChild("Humpback Whale")

	GenusCanine = FamilyMammal.NewChild("Canine",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver),
		BioLevelDigestion(DigestiveSystemCarnivore),
		BioLevelLocomotion(LocomotionWalk))
	SpeciesDog = GenusCanine.NewChild("Dog",
		BioLevelSize(SpeciesSizeSmall),
		BioLevelTempRange(21, 26))
	SpeciesWolf = GenusCanine.NewChild("Wolf",
		BioLevelSize(SpeciesSizeMedium),
		BioLevelTempRange(-50, 48.8))
	SpeciesFox = GenusCanine.NewChild("Fox",
		BioLevelSize(SpeciesSizeSmall),
		BioLevelTempRange(-15, 15))

	// Felines.
	GenusFeline = FamilyMammal.NewChild("Feline",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver),
		BioLevelDigestion(DigestiveSystemCarnivore),
		BioLevelLocomotion(LocomotionWalk))
	SpeciesCat = GenusFeline.NewChild("Cat",
		BioLevelSize(SpeciesSizeSmall),
		BioLevelTempRange(25, 30),
	)
	SpeciesLion = GenusFeline.NewChild("Lion",
		BioLevelSize(SpeciesSizeMedium),
		BioLevelTempRange(20, 30),
	)
	SpeciesTiger = GenusFeline.NewChild("Tiger",
		BioLevelSize(SpeciesSizeMedium))
	SpeciesLeopard = GenusFeline.NewChild("Leopard",
		BioLevelSize(SpeciesSizeMedium),
		BioLevelTempRange(25, 32),
	)
	SpeciesSandCat = GenusFeline.NewChild("Sand Cat",
		BioLevelSize(SpeciesSizeTiny),
		BioLevelPreferredBiomes(genbiome.WhittakerModBiomeSubtropicalDesert),
		BioLevelTempRange(25, 35),
	)

	// Rodents.
	GenusRodent = FamilyMammal.NewChild("Rodent",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver),
		BioLevelDigestion(DigestiveSystemHerbivore),
		BioLevelSize(SpeciesSizeTiny),
		BioLevelLocomotion(LocomotionBurrow|LocomotionClimb|LocomotionSwim|LocomotionWalk))
	SpeciesMouse     = GenusRodent.NewChild("Mouse")
	SpeciesRat       = GenusRodent.NewChild("Rat")
	SpeciesHamster   = GenusRodent.NewChild("Hamster")
	SpeciesGuineaPig = GenusRodent.NewChild("Guinea Pig")
	SpeciesSquirrel  = GenusRodent.NewChild("Squirrel")
	SpeciesChipmunk  = GenusRodent.NewChild("Chipmunk")
	SpeciesRaccoon   = GenusRodent.NewChild("Raccoon")
	SpeciesBeaver    = GenusRodent.NewChild("Beaver",
		BioLevelEcosphere(EcosphereTypeRiver))
	SpeciesPorcupine = GenusRodent.NewChild("Porcupine")
	SpeciesGopher    = GenusRodent.NewChild("Gopher")
	SpeciesGroundhog = GenusRodent.NewChild("Groundhog")

	// Birds.
	FamilyBird = KingdomFauna.NewChild("Bird",
		BioLevelEcosphere(EcosphereTypeLand),
		BioLevelLocomotion(LocomotionFly))

	// Fishes.
	FamilyFish = KingdomFauna.NewChild("Fish",
		BioLevelLocomotion(LocomotionSwim))
	GenusSaltwaterFish = FamilyFish.NewChild("Saltwater Fish",
		BioLevelEcosphere(EcosphereTypeOcean),
		BioLevelDigestion(DigestiveSystemCarnivore))
	SpeciesShark   = GenusSaltwaterFish.NewChild("Shark")
	SpeciesTuna    = GenusSaltwaterFish.NewChild("Tuna")
	SpeciesCod     = GenusSaltwaterFish.NewChild("Cod")
	SpeciesHaddock = GenusSaltwaterFish.NewChild("Haddock")
	SpeciesHerring = GenusSaltwaterFish.NewChild("Herring")

	GenusFreshwaterFish = FamilyFish.NewChild("Freshwater Fish",
		BioLevelEcosphere(EcosphereTypeRiver|EcosphereTypeLake))
	SpeciesTrout  = GenusFreshwaterFish.NewChild("Trout")
	SpeciesSalmon = GenusFreshwaterFish.NewChild("Salmon")
	SpeciesBass   = GenusFreshwaterFish.NewChild("Bass")

	// Crustaceans.
	FamilyCrustacean = KingdomFauna.NewChild("Crustacean",
		BioLevelLocomotion(LocomotionWalk|LocomotionSwim))

	// Crabs.
	GenusCrab        = FamilyCrustacean.NewChild("Crab")
	SpeciesRiverCrab = GenusCrab.NewChild("River Crab",
		BioLevelEcosphere(EcosphereTypeRiver),
		BioLevelElevRange(-0.01, 0.01),
	)
	SpeciesRockCrab = GenusCrab.NewChild("Rock Crab",
		BioLevelEcosphere(EcosphereTypeOcean|EcosphereTypeLand),
		BioLevelElevRange(-0.3, -0.1),
	)

	// Shrimp.
	GenusShrimp = FamilyCrustacean.NewChild("Shrimp",
		BioLevelEcosphere(EcosphereTypeOcean),
		BioLevelTempRange(14, 29),
	)

	// Lobsters.
	GenusLobster    = FamilyCrustacean.NewChild("Lobster")
	SpeciesCrayfish = GenusLobster.NewChild("Crayfish",
		BioLevelEcosphere(EcosphereTypeRiver|EcosphereTypeLake),
		BioLevelTempRange(18, 25),
	)
	SpeciesLobster = GenusLobster.NewChild("Lobster",
		BioLevelEcosphere(EcosphereTypeOcean),
		BioLevelTempRange(16, 18),
	)

	// Mollusks.
	FamilyMollusk = KingdomFauna.NewChild("Mollusk")

	// Clams.
	GenusClam     = FamilyMollusk.NewChild("Clam")
	SpeciesMussel = GenusClam.NewChild("Mussel",
		BioLevelEcosphere(EcosphereTypeOcean|EcosphereTypeRiver|EcosphereTypeLake))
	SpeciesOyster = GenusClam.NewChild("Oyster",
		BioLevelEcosphere(EcosphereTypeOcean))

	// Snails.
	GenusSnail = FamilyMollusk.NewChild("Snail",
		BioLevelDigestion(DigestiveSystemHerbivore),
		BioLevelLocomotion(LocomotionSlither))
	SpeciesSlug = GenusSnail.NewChild("Slug",
		BioLevelEcosphere(EcosphereTypeLand),
		BioLevelHumidityRange(0.2, 1),
		BioLevelTempRange(15, 20),
	)
	SpeciesSeaSnail = GenusSnail.NewChild("Sea Snail",
		BioLevelEcosphere(EcosphereTypeOcean),
		BioLevelElevRange(-0.01, 0.0),
	)

	// Octopuses.
	GenusOctopus = FamilyMollusk.NewChild("Octopus",
		BioLevelEcosphere(EcosphereTypeOcean),
		BioLevelDigestion(DigestiveSystemCarnivore),
		BioLevelLocomotion(LocomotionSwim))
	SpeciesSquid = GenusOctopus.NewChild("Squid")

	// Amphibians.
	FamilyAmphibian = KingdomFauna.NewChild("Amphibian",
		BioLevelLocomotion(LocomotionSwim|LocomotionWalk))

	// Frogs.
	GenusFrog = FamilyAmphibian.NewChild("Frog",
		BioLevelHumidityRange(0.2, 1))
	SpeciesBullfrog = GenusFrog.NewChild("Bullfrog",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver),
		BioLevelElevRange(0, 0.1),
	)
	SpeciesTreeFrog = GenusFrog.NewChild("Tree Frog",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver),
		BioLevelElevRange(0.1, 0.4),
		BioLevelPreferredBiomes(
			genbiome.WhittakerModBiomeTemperateSeasonalForest,
			genbiome.WhittakerModBiomeTemperateRainforest,
			genbiome.WhittakerModBiomeTropicalSeasonalForest,
			genbiome.WhittakerModBiomeTropicalRainforest,
		),
	)

	// Toads.
	GenusToad   = FamilyAmphibian.NewChild("Toad")
	SpeciesBufo = GenusToad.NewChild("Bufo",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver),
		BioLevelElevRange(0, 0.1),
	)
	GenusSalamander = FamilyAmphibian.NewChild("Salamander")

	// Reptiles.
	FamilyReptile = KingdomFauna.NewChild("Reptile",
		BioLevelDigestion(DigestiveSystemCarnivore))

	// Snakes.
	GenusSerpent = FamilyReptile.NewChild("Serpent",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver),
		BioLevelTempRange(15, 30),
		BioLevelElevRange(0, 0.4),
		BioLevelLocomotion(LocomotionSlither),
		BioLevelSize(SpeciesSizeSmall))
	SpeciesSnake = GenusSerpent.NewChild("Snake",
		BioLevelHumidityRange(0.2, 1),
	)
	SpeciesCobra = GenusSerpent.NewChild("Cobra",
		BioLevelHumidityRange(0.01, 1),
		BioLevelPreferredBiomes(
			genbiome.WhittakerModBiomeTemperateRainforest,
			genbiome.WhittakerModBiomeTropicalRainforest,
		),
	)
	SpeciesRattlesnake = GenusSerpent.NewChild("Rattlesnake",
		BioLevelHumidityRange(0.01, 0.2),
		BioLevelPreferredBiomes(
			genbiome.WhittakerModBiomeSubtropicalDesert,
		),
	)
	SpeciesAnaconda = GenusSerpent.NewChild("Anaconda",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver),
		BioLevelSize(SpeciesSizeLarge),
		BioLevelLocomotion(LocomotionSlither|LocomotionClimb),
		BioLevelPreferredBiomes(
			genbiome.WhittakerModBiomeTropicalSeasonalForest,
			genbiome.WhittakerModBiomeTropicalRainforest,
		),
	)

	// Crocodiles.
	GenusCrocodilia = FamilyReptile.NewChild("Crocodilia",
		BioLevelTempRange(20, 30),
		BioLevelLocomotion(LocomotionWalk|LocomotionSwim),
		BioLevelSize(SpeciesSizeLarge))
	SpeciesCrocodile = GenusCrocodilia.NewChild("Crocodile",
		BioLevelEcosphere(EcosphereTypeRiver|EcosphereTypeLake|EcosphereTypeOcean),
		BioLevelElevRange(0, 0.01),
	)
	SpeciesAlligator = FamilyReptile.NewChild("Alligator",
		BioLevelEcosphere(EcosphereTypeRiver),
		BioLevelElevRange(0, 0.02),
	)

	// Lizards.
	GenusLizard = FamilyReptile.NewChild("Lizard",
		BioLevelEcosphere(EcosphereTypeLand|EcosphereTypeRiver),
		BioLevelElevRange(0, 0.2),
		BioLevelHumidityRange(0.2, 1),
		BioLevelTempRange(15, 30),
		BioLevelLocomotion(LocomotionWalk),
	)
	SpeciesIguana = GenusLizard.NewChild("Iguana")
	SpeciesGecko  = GenusLizard.NewChild("Gecko")

	// Turtles.
	GenusTurtle = FamilyReptile.NewChild("Turtle",
		BioLevelLocomotion(LocomotionWalk|LocomotionSwim))
	SpeciesTortoise = GenusTurtle.NewChild("Tortoise",
		BioLevelEcosphere(EcosphereTypeLand),
		BioLevelElevRange(0, 0.2),
		BioLevelHumidityRange(0.2, 1),
		BioLevelTempRange(10, 20),
	)
	SpeciesTurle = GenusTurtle.NewChild("Turle",
		BioLevelEcosphere(EcosphereTypeOcean),
		BioLevelElevRange(-0.01, 0.0),
	)

	// Worms.
	FamilyWorm = KingdomFauna.NewChild("Worm",
		BioLevelDigestion(DigestiveSystemOmnivore),
		BioLevelLocomotion(LocomotionSlither|LocomotionBurrow),
	)
	GenusEarthworm = FamilyWorm.NewChild("Earthworm",
		BioLevelEcosphere(EcosphereTypeLand),
		BioLevelElevRange(0, 0.2),
		BioLevelHumidityRange(0.2, 1),
		BioLevelTempRange(10, 20),
	)

	// Fungi.
	FamilyMushroom    = KingdomFungi.NewChild("Mushroom")
	GenusMushroom     = FamilyMushroom.NewChild("Mushroom")
	SpeciesChampignon = GenusMushroom.NewChild("Champignon",
		BioLevelEcosphere(EcosphereTypeLand),
		BioLevelElevRange(0, 0.2),
		BioLevelTempRange(10, 20),
		BioLevelPreferredBiomes(genbiome.WhittakerModBiomeTemperateSeasonalForest, genbiome.WhittakerModBiomeTemperateRainforest),
	)
	FamilyMold = KingdomFungi.NewChild("Mold")
)

Functions

This section is empty.

Types

type Bio

type Bio struct {
	*BioConfig
	*geo.Geo
	Species                []*Species              // All species on the map.
	SpeciesFamilyToRegions map[SpeciesFamily][]int // Regions where each species is found.
	SpeciesRegions         []int                   // Regions where each species is found.
	GrowthDays             []int                   // Number of days within the growth period for each region.
	GrowthInsolation       []float64               // Average insolation for each region during the growth period.
	// contains filtered or unexported fields
}

Bio handles the generation of life on the map (plants, animals, etc.).

func NewBio

func NewBio(geo *geo.Geo, cfg *BioConfig) *Bio

func (*Bio) GenerateBiology

func (b *Bio) GenerateBiology()

func (*Bio) GetEcosphere

func (b *Bio) GetEcosphere(r int) EcosphereType

GetEcosphere returns the ecosphere of the given region.

func (*Bio) PlaceSpecies

func (b *Bio) PlaceSpecies(sf func(int) float64, distSeedFunc func() []int) *Species

PlaceSpecies places another species on the map at the region with the highest fitness score.

func (*Bio) PlaceSpeciesAt

func (b *Bio) PlaceSpeciesAt(r int) *Species

PlaceSpeciesAt places a species at the given region. TODO: Allow specifying the species type/subtype?

func (*Bio) Tick

func (b *Bio) Tick()

type BioConfig

type BioConfig struct {
	EnableRandomSpecies bool // Enable random species generation
	NumSpecies          int  // Number of randomly generated species
}

BioConfig is a struct that holds all configuration options for biology generation.

func NewBioConfig

func NewBioConfig() *BioConfig

NewBioConfig returns a new config for biology generation.

type BioLevel

type BioLevel struct {
	Name        string
	Level       int
	Parent      *BioLevel
	Children    []*BioLevel
	Hereditary  []BioProperty // Guaranteed to be inherited.
	Inheritable []BioProperty // May be inherited.
	SpeciesProperties
	SpeciesTolerances
}

func NewKingdom

func NewKingdom(name string, options ...BioLevelOption) *BioLevel

func (*BioLevel) NewChild

func (b *BioLevel) NewChild(name string, options ...BioLevelOption) *BioLevel

func (*BioLevel) ToSpecies

func (b *BioLevel) ToSpecies() *Species

type BioLevelOption

type BioLevelOption func(*BioLevel)

func BioLevelAppendHereditary

func BioLevelAppendHereditary(heredity ...BioProperty) BioLevelOption

BioLevelAppendHereditary appends hereditary features of a species.

func BioLevelDigestion

func BioLevelDigestion(digestion DigestiveSystem) BioLevelOption

BioLevelDigestion sets the digestion type for a species.

func BioLevelEcosphere

func BioLevelEcosphere(ecosphere EcosphereType) BioLevelOption

BioLevelEcosphere sets the ecosphere for a species.

func BioLevelElevRange

func BioLevelElevRange(min, max float64) BioLevelOption

BioLevelElevRange sets the minimum and maximum elevation range for a species from -1.0 - 1.0.

func BioLevelHumidityRange

func BioLevelHumidityRange(min, max float64) BioLevelOption

BioLevelHumidityRange sets the minimum and maximum humidity range for a species in dm.

func BioLevelLocomotion

func BioLevelLocomotion(locomotion Locomotion) BioLevelOption

BioLevelLocomotion sets the locomotion type for a species.

func BioLevelName

func BioLevelName(name string) BioLevelOption

func BioLevelPreferredBiomes

func BioLevelPreferredBiomes(biomes ...int) BioLevelOption

BioLevelPreferredBiomes sets the preferred biomes for a species.

func BioLevelRainRange

func BioLevelRainRange(min, max float64) BioLevelOption

BioLevelRainRange sets the minimum and maximum rain range for a species in dm.

func BioLevelSize

func BioLevelSize(size SpeciesSize) BioLevelOption

BioLevelSize sets the size of a species.

func BioLevelSteepRange

func BioLevelSteepRange(min, max float64) BioLevelOption

BioLevelSteepRange sets the minimum and maximum steepness range for a species from 0.0 - 1.0.

func BioLevelTempRange

func BioLevelTempRange(min, max float64) BioLevelOption

BioLevelTempRange sets the minimum and maximum temperature range for a species in °C.

type BioProperty

type BioProperty int
const (
	BioPropertyEdibleSeed BioProperty = iota
	BioPropertyEdibleFruit
	BioPropertyEdibleFlower
	BioPropertyEdibleLeafs
)

type DigestiveSystem

type DigestiveSystem byte
const (
	DigestiveSystemCarnivore DigestiveSystem = iota
	DigestiveSystemHerbivore
	DigestiveSystemOmnivore
	DigestivePhotosynthetic
	DigestiveDecomposer
	DigestiveParasitic
)

func (DigestiveSystem) String

func (d DigestiveSystem) String() string

type EcosphereType

type EcosphereType byte
const (
	EcosphereTypeOcean EcosphereType = 1 << iota
	EcosphereTypeRiver
	EcosphereTypeLake
	EcosphereTypeLand
)

func (EcosphereType) IsWater

func (e EcosphereType) IsWater() bool

func (EcosphereType) String

func (e EcosphereType) String() string

type Locomotion

type Locomotion byte
const (
	LocomotionNone Locomotion = 0
	LocomotionFly  Locomotion = 1 << iota
	LocomotionBurrow
	LocomotionWalk
	LocomotionSwim
	LocomotionClimb
	LocomotionSlither
)

func (Locomotion) String

func (l Locomotion) String() string

type Species

type Species struct {
	Name   string
	Origin int // The region where the species originated, acts as a seed.
	SpeciesProperties
	SpeciesTolerances
}

func (*Species) String

func (s *Species) String() string

type SpeciesFamily

type SpeciesFamily string
const (
	SpeciesFamilyNone           SpeciesFamily = "None"
	SpeciesFamilyTree           SpeciesFamily = "Tree"
	SpeciesFamilyShrub          SpeciesFamily = "Shrub"
	SpeciesFamilyGrass          SpeciesFamily = "Grass"
	SpeciesFamilyReed           SpeciesFamily = "Reed"
	SpeciesFamilyHerb           SpeciesFamily = "Herb"
	SpeciesFamilyFlower         SpeciesFamily = "Flower"
	SpeciesFamilyFern           SpeciesFamily = "Fern"
	SpeciesFamilyMoss           SpeciesFamily = "Moss"
	SpeciesFamilyVine           SpeciesFamily = "Vine"
	SpeciesFamilyCactus         SpeciesFamily = "Cactus"
	SpeciesFamilySucculent      SpeciesFamily = "Succulent"
	SpeciesFamilyInsect         SpeciesFamily = "Insect"
	SpeciesFamilyArachnid       SpeciesFamily = "Arachnid"
	SpeciesFamilyMammal         SpeciesFamily = "Mammal"
	SpeciesFamilyBird           SpeciesFamily = "Bird"
	SpeciesFamilyFish           SpeciesFamily = "Fish"
	SpeciesFamilyCrustacean     SpeciesFamily = "Crustacean"
	SpeciesFamilyMollusk        SpeciesFamily = "Mollusk"
	SpeciesFamilyMolluskClam    SpeciesFamily = "Clam"
	SpeciesFamilyMolluskSnail   SpeciesFamily = "Snail"
	SpeciesFamilyAmphibian      SpeciesFamily = "Amphibian"
	SpeciesFamilyReptileSerpent SpeciesFamily = "Serpent"
	SpeciesFamilyReptileLizard  SpeciesFamily = "Lizard"
	SpeciesFamilyRodent         SpeciesFamily = "Rodent"
	SpeciesFamilyWorm           SpeciesFamily = "Worm"
	SpeciesFamilyMushroom       SpeciesFamily = "Mushroom"
	SpeciesFamilyMold           SpeciesFamily = "Mold"
)

func (SpeciesFamily) Locomotion

func (s SpeciesFamily) Locomotion() Locomotion

func (SpeciesFamily) String

func (s SpeciesFamily) String() string

type SpeciesKingdom

type SpeciesKingdom string
const (
	SpeciesKingdomFlora SpeciesKingdom = "flora"
	SpeciesKingdomFauna SpeciesKingdom = "fauna" // Maybe split this up into different types of fauna?
	SpeciesKingdomFunga SpeciesKingdom = "funga"
)

func (SpeciesKingdom) DigestiveSystems

func (s SpeciesKingdom) DigestiveSystems() []DigestiveSystem

func (SpeciesKingdom) String

func (s SpeciesKingdom) String() string

type SpeciesProperties

type SpeciesProperties struct {
	Kingdom    SpeciesKingdom  // General type of the species.
	Family     SpeciesFamily   // Subtype of the species.
	Digestion  DigestiveSystem // What kind of food the species can eat.
	Size       SpeciesSize     // Size of the species.
	Locomotion Locomotion      // How the species moves. (TODO: Primary locomotion)
}

SpeciesProperties defines the properties of a species.

func (*SpeciesProperties) CompetitorHash

func (s *SpeciesProperties) CompetitorHash() int64

CompetitorHash returns a hash that can be used to compare two species and determine if they are competitors. This will be helpful when spreading the species and avoiding competing species.

func (*SpeciesProperties) String

func (s *SpeciesProperties) String() string

type SpeciesSize

type SpeciesSize byte
const (
	SpeciesSizeDefault SpeciesSize = iota
	SpeciesSizeTiny
	SpeciesSizeSmall
	SpeciesSizeMedium
	SpeciesSizeLarge
	SpeciesSizeHuge
)

func (SpeciesSize) String

func (s SpeciesSize) String() string

type SpeciesTolerances

type SpeciesTolerances struct {
	Ecosphere       EcosphereType // Ocean, River, Land, Lake
	TempRange       [2]float64    // Min, Max temperature
	HumRange        [2]float64    // Min, Max humidity
	RainRange       [2]float64    // Min, Max rain
	ElevRange       [2]float64    // Min, Max elevation (this should be maybe in meters?)
	SteepRange      [2]float64    // Min, Max steepness
	PreferredBiomes []int         // Only applies to non-marine species.
}

SpeciesTolerances defines the environmental tolerances of a species.

func (*SpeciesTolerances) String

func (s *SpeciesTolerances) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL