Documentation ¶
Index ¶
- func BlendTypeStrings() []string
- func DeterministicIndexOf[V any](prng *rand.Rand, s []V) int
- func StrategyTargetFilterStrings() []string
- type Blend
- type BlendType
- type Code
- type Generated
- type Generator
- type LinearGradientTerrainStrategy
- type NoiseTerrainStrategy
- type OpponentSquad
- type OpponentSquads
- type Pair
- type Paths
- type Placement
- type RadialGradientTerrainStrategy
- type StrategyTargetFilter
- func (f StrategyTargetFilter) Generate(prng *rand.Rand, extents map[geom.DirectionType]geom.Key) geom.DirectionType
- func (i StrategyTargetFilter) IsAStrategyTargetFilter() bool
- func (i StrategyTargetFilter) MarshalJSON() ([]byte, error)
- func (i StrategyTargetFilter) String() string
- func (i *StrategyTargetFilter) UnmarshalJSON(data []byte) error
- type TerrainBuilder
- type TerrainChances
- type TerrainGradient
- type TerrainGradientSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlendTypeStrings ¶
func BlendTypeStrings() []string
BlendTypeStrings returns a slice of all String values of the enum
func StrategyTargetFilterStrings ¶
func StrategyTargetFilterStrings() []string
StrategyTargetFilterStrings returns a slice of all String values of the enum
Types ¶
type BlendType ¶
type BlendType int
func BlendTypeString ¶
BlendTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func BlendTypeValues ¶
func BlendTypeValues() []BlendType
BlendTypeValues returns all values of the enum
func (BlendType) IsABlendType ¶
IsABlendType returns "true" if the value is listed in the enum definition. "false" otherwise
func (BlendType) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for BlendType
func (*BlendType) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for BlendType
type Code ¶
type Code string
Code uniquely identifies either a Terrain or a Fill for an overworld tile.
type Generated ¶
type Generated struct { Recipe string Paths Paths // PathExtents are only being exposed for debugging purposes. PathExtents map[geom.DirectionType]geom.Key Terrain map[geom.Key]Code Opponents map[geom.Key]squad.RecipeID GenerationDuration time.Duration }
func (*Generated) Complexity ¶
func (*Generated) MarshalJSON ¶
func (*Generated) UnmarshalJSON ¶
type Generator ¶
type Generator struct { RecipeName string MakePaths pathFunc `json:"pathGeneration"` Terrain TerrainBuilder `json:"terrainBuilder"` TerrainOverrides map[string]Code `json:"terrainSpecialOverrides"` Baddies OpponentSquads }
Generator holds configuration data to construct overworld maps.
func (*Generator) UnmarshalJSON ¶
type LinearGradientTerrainStrategy ¶
type LinearGradientTerrainStrategy struct { TargetFilter StrategyTargetFilter Overflows Code Underflows Code Gradients TerrainGradientSlice PathOverrides map[Code]Code }
type NoiseTerrainStrategy ¶
type NoiseTerrainStrategy struct { Smoothing int Outside Code Components TerrainChances }
type OpponentSquad ¶
type OpponentSquads ¶
type OpponentSquads []OpponentSquad
type Paths ¶
type Paths struct { Algorithm string Seed int64 Start geom.Key Goal geom.Key Nodes map[geom.Key]Placement Specials map[string][]geom.Key }
Paths represents a procedurally generated set of pathways.
type Placement ¶
type Placement struct {
Connections map[geom.DirectionType]struct{}
}
Placement holds info about what roads or paths have been placed on a Key.
type RadialGradientTerrainStrategy ¶
type RadialGradientTerrainStrategy struct { Overflows Code Underflows Code Gradients TerrainGradientSlice PathOverrides map[Code]Code // contains filtered or unexported fields }
type StrategyTargetFilter ¶
type StrategyTargetFilter int
const ( AnyTarget StrategyTargetFilter = iota Widest Narrowest )
func StrategyTargetFilterString ¶
func StrategyTargetFilterString(s string) (StrategyTargetFilter, error)
StrategyTargetFilterString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func StrategyTargetFilterValues ¶
func StrategyTargetFilterValues() []StrategyTargetFilter
StrategyTargetFilterValues returns all values of the enum
func (StrategyTargetFilter) Generate ¶
func (f StrategyTargetFilter) Generate(prng *rand.Rand, extents map[geom.DirectionType]geom.Key) geom.DirectionType
func (StrategyTargetFilter) IsAStrategyTargetFilter ¶
func (i StrategyTargetFilter) IsAStrategyTargetFilter() bool
IsAStrategyTargetFilter returns "true" if the value is listed in the enum definition. "false" otherwise
func (StrategyTargetFilter) MarshalJSON ¶
func (i StrategyTargetFilter) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for StrategyTargetFilter
func (StrategyTargetFilter) String ¶
func (i StrategyTargetFilter) String() string
func (*StrategyTargetFilter) UnmarshalJSON ¶
func (i *StrategyTargetFilter) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for StrategyTargetFilter
type TerrainBuilder ¶
TerrainBuilder is anything that can generate terrain for a set of paths.
type TerrainChances ¶
type TerrainGradient ¶
type TerrainGradientSlice ¶
type TerrainGradientSlice []TerrainGradient
func (TerrainGradientSlice) SubGradient ¶
func (gradients TerrainGradientSlice) SubGradient(percent float64) (int, float64)
SubGradient returns which gradient the percent through indicates, as well as the percent through that gradient.