Documentation ¶
Index ¶
- Constants
- Variables
- type Classification
- type Deity
- type Generator
- func (g *Generator) GenFaithName(tokens []genstory.TokenReplacement) (*genstory.Generated, error)
- func (g *Generator) GenNameFaitOfSupreme(supreme string) string
- func (g *Generator) GenNamedIsm(name string) string
- func (g *Generator) GenerateDeityMeaning(approach string) (*genstory.Generated, error)
- func (g *Generator) GenerateDeityMeaningV2(provided []genstory.TokenReplacement, approach string) (*genstory.Generated, error)
- func (g *Generator) GenerateDeityMeaningV3(provided []genstory.TokenReplacement) (*genstory.Generated, error)
- func (g *Generator) GetDeity() (*Deity, error)
- func (g *Generator) GetDeityWithApproach(approach string) (*Deity, error)
- func (g *Generator) NewClassification(group string) *Classification
- func (g *Generator) NewClassificationWithForm(group, form string) *Classification
- func (g *Generator) NewCreation(god *Deity) (*genstory.Generated, error)
- func (g *Generator) Ra(array []string) string
- func (g *Generator) RandDeityGenMethod() string
- func (g *Generator) RandFormFromGroup(group string) string
- func (g *Generator) RandGenMethod() string
- func (g *Generator) RandTypeFromForm(form string) string
- func (g *Generator) Rw(mp map[string]int) string
- func (g *Generator) SetSeed(seed int64)
Constants ¶
const ( CreationTokenIntro = "[INTRO]" CreationTokenWorld = "[WORLD]" CreationTokenCreation = "[CREATION]" CreationTokenGod = "[GOD]" CreationTokenAdjective = "[ADJECTIVE]" CreationTokenMaterial = "[MATERIAL]" CreationTokenShaping = "[SHAPING]" )
const ( TokenNumber = "[NUMBER]" TokenBeing = "[BEING]" TokenAdjective = "[ADJECTIVE]" TokenColor = "[COLOR]" TokenAnimal = "[ANIMAL]" TokenGenitive = "[GENITIVE]" )
const ( TemplateMeaningNumber = "[NUMBER]" TemplateMeaningBeing = "[BEING]" TemplateMeaningAdjective = "[ADJECTIVE]" TemplateMeaningColorAnimal = "[COLOR] [ANIMAL]" TemplateMeaningAdjectiveAnimal = "[ADJECTIVE] [ANIMAL]" TemplateMeaningAdjectiveBeing = "[ADJECTIVE] [BEING]" TemplateMeaningAdjectiveGenitive = "[ADJECTIVE] [GENITIVE]" TemplateMeaningColorBeing = "[COLOR] [BEING]" TemplateMeaningColorGenitive = "[COLOR] [GENITIVE]" TemplateMeaningBeingOfGenitive = "[BEING] of [GENITIVE]" TemplateMeaningBeingOfTheGenitive = "[BEING] of the [GENITIVE]" TemplateMeaningAnimalOfGenitive = "[ANIMAL] of [GENITIVE]" TemplateMeaningAdjectiveBeingOfGenitive = "[ADJECTIVE] [BEING] of [GENITIVE]" TemplateMeaningAdjectiveAnimalOfGenitive = "[ADJECTIVE] [ANIMAL] of [GENITIVE]" )
const ( MethodRandomType = "[RANDOM] [TYPE]" MethodRandomIsm = "[RANDOM:trimvowels]ism" MethodSurpremeIsm = "[SUPREME:trimvowels]ism" MethodFaithOfSupreme = "[FAITH] of [SUPREME]" MethodPlaceIsm = "[PLACE:trimvowels]ism" MethodCultureIsm = "[CULTURE:trimvowels]ism" MethodPlaceIanType = "[PLACE]ian [TYPE]" MethodCultureType = "[CULTURE] [TYPE]" )
const ( TokenPlace = "[PLACE]" TokenCulture = "[CULTURE]" TokenRandom = "[RANDOM]" TokenSurpreme = "[SUPREME]" TokenType = "[TYPE]" TokenFaith = "[FAITH]" )
const ( // Expansion modes. ReligionExpGlobal = "global" ReligionExpState = "state" ReligionExpCulture = "culture" )
const ( // Religion groups. GroupFolk = "Folk" GroupOrganized = "Organized" GroupCult = "Cult" GroupHeresy = "Heresy" // Religion forms. FormShamanism = "Shamanism" FormAnimism = "Animism" FormAncestorWorship = "Ancestor worship" FormPolytheism = "Polytheism" FormDualism = "Dualism" FormMonotheism = "Monotheism" FormNontheism = "Non-theism" FormCult = "Cult" FormDarkCult = "Dark Cult" FormHeresy = "Heresy" )
Religions are logically organized like this:
Group (Folk, Organized, ...) -> Form (Polytheism, Dualism, ...) -> Type (Church, Cult, ...)
The type is more of a descriptive name for the religion, e.g. "Church" or "Cult".
Variables ¶
var CreationConfig = &genstory.TextConfig{ TokenPools: map[string][]string{ CreationTokenIntro: CreationIntros, CreationTokenCreation: WorldCreationPool, CreationTokenAdjective: WorldMaterialAdjectivesPool, CreationTokenMaterial: WorldMaterialsPool, CreationTokenShaping: WorldShapingPool, }, TokenIsMandatory: map[string]bool{ CreationTokenWorld: true, CreationTokenGod: true, }, Tokens: CreationTokens, Templates: StoryTemplates, UseAllProvided: true, }
var CreationIntros = []string{
"Long ago,",
"As it is written in the ancient texts,",
"According to the legends,",
"According to the ancient texts,",
"In the time before time,",
"In the beginning,",
"During the spark of creation,",
}
CreationIntros contains the intro lines for the world creation mythos.
var CreationTokens = []string{ CreationTokenIntro, CreationTokenWorld, CreationTokenCreation, CreationTokenGod, CreationTokenAdjective, CreationTokenMaterial, CreationTokenShaping, }
var DeityMeaningApproaches []string
var DeityMeaningConfig = &genstory.TextConfig{ TokenPools: map[string][]string{ TokenNumber: GenBase[GenBaseNumber], TokenBeing: GenBase[GenBaseBeing], TokenAdjective: GenBase[GenBaseAdjective], TokenColor: GenBase[GenBaseColor], TokenAnimal: GenBase[GenBaseAnimal], TokenGenitive: GenBase[GenBaseGenitive], }, TokenIsMandatory: map[string]bool{}, Tokens: []string{ TokenNumber, TokenBeing, TokenAdjective, TokenColor, TokenAnimal, TokenGenitive, }, Templates: []string{ TemplateMeaningNumber, TemplateMeaningBeing, TemplateMeaningAdjective, TemplateMeaningColorAnimal, TemplateMeaningAdjectiveAnimal, TemplateMeaningAdjectiveBeing, TemplateMeaningAdjectiveGenitive, TemplateMeaningColorBeing, TemplateMeaningColorGenitive, TemplateMeaningBeingOfGenitive, TemplateMeaningBeingOfTheGenitive, TemplateMeaningAnimalOfGenitive, TemplateMeaningAdjectiveBeingOfGenitive, TemplateMeaningAdjectiveAnimalOfGenitive, }, UseAllProvided: true, }
var FaitOfSupremePrefixes = []string{
"Faith",
"Way",
"Path",
"Word",
"Truth",
"Law",
"Order",
"Light",
"Darkness",
"Gift",
"Grace",
"Witnesses",
"Servants",
"Messengers",
"Believers",
"Disciples",
"Followers",
"Children",
"Brothers",
"Sisters",
"Brothers and Sisters",
"Sons",
"Daughters",
"Sons and Daughters",
"Brides",
"Grooms",
"Brides and Grooms",
}
FaitOfSupremePrefixes contains a list of prefixes identifying the group of followers of a supreme deity or leader.
var Forms = map[string]map[string]int{ GroupFolk: { FormShamanism: 2, FormAnimism: 2, FormAncestorWorship: 1, FormPolytheism: 2, }, GroupOrganized: { FormPolytheism: 5, FormDualism: 1, FormMonotheism: 4, FormNontheism: 1, }, FormCult: { FormCult: 1, FormDarkCult: 1, }, FormHeresy: { FormHeresy: 1, }, }
Forms maps a religion group to religion forms with a weighed probability.
var GenBase = genlanguage.GenBase
var GenBaseAdjective = genlanguage.GenBaseAdjective
var GenBaseAnimal = genlanguage.GenBaseAnimal
var GenBaseBeing = genlanguage.GenBaseBeing
var GenBaseColor = genlanguage.GenBaseColor
var GenBaseGenitive = genlanguage.GenBaseGenitive
var GenBaseNumber = genlanguage.GenBaseNumber
var GenBaseTheGenitive = genlanguage.GenBaseTheGenitive
var GenMeaningApproaches = map[string]int{
TemplateMeaningNumber: 1,
TemplateMeaningBeing: 3,
TemplateMeaningAdjective: 5,
TemplateMeaningColorAnimal: 5,
TemplateMeaningAdjectiveAnimal: 5,
TemplateMeaningAdjectiveBeing: 5,
TemplateMeaningAdjectiveGenitive: 1,
TemplateMeaningColorBeing: 3,
TemplateMeaningColorGenitive: 3,
TemplateMeaningBeingOfGenitive: 2,
TemplateMeaningBeingOfTheGenitive: 1,
TemplateMeaningAnimalOfGenitive: 1,
TemplateMeaningAdjectiveBeingOfGenitive: 2,
TemplateMeaningAdjectiveAnimalOfGenitive: 2,
}
GenMeaningApproaches contains a map of name generation approaches and their relative chance to be selected.
var GenReligionMethods = map[string]int{
MethodRandomType: 3,
MethodRandomIsm: 1,
MethodSurpremeIsm: 5,
MethodFaithOfSupreme: 5,
MethodPlaceIsm: 1,
MethodCultureIsm: 2,
MethodPlaceIanType: 6,
MethodCultureType: 4,
}
genReligionMethods contains a map of religion name generation methods and their relative chance to be selected.
var NameConfig = genstory.TextConfig{ TokenIsMandatory: map[string]bool{ TokenSurpreme: true, TokenCulture: true, TokenRandom: true, TokenPlace: true, TokenType: true, }, TokenPools: map[string][]string{ TokenFaith: FaitOfSupremePrefixes, }, Tokens: []string{ TokenPlace, TokenCulture, TokenRandom, TokenSurpreme, TokenType, TokenFaith, }, Templates: []string{ MethodRandomType, MethodRandomIsm, MethodSurpremeIsm, MethodFaithOfSupreme, MethodPlaceIsm, MethodCultureIsm, MethodPlaceIanType, MethodCultureType, }, Modifiers: map[string]func(string) string{ "trimvowels": func(s string) string { return genlanguage.TrimVowels(s, 3) }, }, UseAllProvided: false, }
var StoryTemplates = []string{
"[INTRO] [WORLD] was [CREATION] by [GOD].",
"[INTRO] [WORLD] was [SHAPING] from a [ADJECTIVE] [MATERIAL].",
"[INTRO] [WORLD] was [SHAPING] from a [MATERIAL] by [GOD].",
}
var Types = map[string]map[string]int{ FormShamanism: { "Beliefs": 3, "Shamanism": 2, "Spirits": 1, }, FormAnimism: { "Spirits": 1, "Beliefs": 1, }, FormAncestorWorship: { "Beliefs": 1, "Forefathers": 2, "Ancestors": 2, }, FormPolytheism: { "Deities": 3, "Faith": 1, "Gods": 1, "Pantheon": 1, }, FormDualism: { "Religion": 3, "Faith": 1, "Cult": 1, }, FormMonotheism: { "Religion": 1, "Church": 1, }, FormNontheism: { "Beliefs": 3, "Spirits": 1, }, FormCult: { "Cult": 4, "Sect": 4, "Arcanum": 1, "Coterie": 1, "Order": 1, "Worship": 1, }, FormDarkCult: { "Cult": 2, "Sect": 2, "Blasphemy": 1, "Circle": 1, "Coven": 1, "Idols": 1, "Occultism": 1, }, FormHeresy: { "Heresy": 3, "Sect": 2, "Apostates": 1, "Brotherhood": 1, "Circle": 1, "Dissent": 1, "Dissenters": 1, "Iconoclasm": 1, "Schism": 1, "Society": 1, }, }
Types maps a religion form to religion types with a weighed probability.
var WorldCreationPool = []string{
"created by",
"shaped in a dream of",
"given existence by",
"brought into being by",
}
var WorldMaterialAdjectivesPool = []string{
"lone",
"pure",
"perfect",
"perfectly round",
"perfectly square",
"precious",
"beautiful",
"beautifully round",
}
var WorldMaterialsPool = []string{
"pearl",
"gem",
"crystal",
"piece of stone",
"rock",
"chunk of clay",
"speck of dust",
"drop of water",
"gust of air",
"mote of fire",
"ball of earth",
}
var WorldShapingPool = []string{
"formed",
"shaped",
"created",
"made",
}
Functions ¶
This section is empty.
Types ¶
type Classification ¶
Classification represents a religion type.
func (*Classification) HasDeity ¶
func (c *Classification) HasDeity() bool
HasDeity returns true if the religion has one or multiple deities.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator is a generator for religions.
func NewGenerator ¶
func NewGenerator(seed int64, lang *genlanguage.Language) *Generator
NewGenerator creates a new religion generator.
func (*Generator) GenFaithName ¶
GenFaithName generates a name for a faith.
func (*Generator) GenNameFaitOfSupreme ¶
GenNameFaitOfSurpreme generates a name for a faith of a supreme deity or leader. E.g. "Way of Grognark".
func (*Generator) GenNamedIsm ¶
GenNamedIsm generates a name for a religion based on a given religion form ("Polytheism", "Dualism", etc). E.g. "Pradaniumism".
func (*Generator) GenerateDeityMeaning ¶
GenerateDeityMeaning generates a meaning for a deity name. This code is based on: https://github.com/Azgaar/Fantasy-Map-Generator/blob/master/modules/religions-generator.js
func (*Generator) GenerateDeityMeaningV2 ¶
func (g *Generator) GenerateDeityMeaningV2(provided []genstory.TokenReplacement, approach string) (*genstory.Generated, error)
GenerateDeityMeaningV2 generates a meaning for a deity name.
func (*Generator) GenerateDeityMeaningV3 ¶
func (g *Generator) GenerateDeityMeaningV3(provided []genstory.TokenReplacement) (*genstory.Generated, error)
GenerateDeityMeaningV3 generates a meaning for a deity name.
func (*Generator) GetDeity ¶
GetDeity returns a deity name for the given culture. This code is based on: https://github.com/Azgaar/Fantasy-Map-Generator/blob/master/modules/religions-generator.js
func (*Generator) GetDeityWithApproach ¶
GetDeityWithApproach returns a deity name for the given culture.
func (*Generator) NewClassification ¶
func (g *Generator) NewClassification(group string) *Classification
NewClassification returns a religion classification. NOTE: If form or type are empty, a random one is chosen.
func (*Generator) NewClassificationWithForm ¶
func (g *Generator) NewClassificationWithForm(group, form string) *Classification
NewClassificationWithForm returns a religion classification.
func (*Generator) NewCreation ¶
NewCreation generates a new world creation mythos using the given seed.
func (*Generator) RandDeityGenMethod ¶
RandDeityMeaningGenMethod returns a random deity meaning generation method.
func (*Generator) RandFormFromGroup ¶
RandFormFromGroup returns a random religion form based on a given religion group ("Folk", "Organized", etc).
func (*Generator) RandGenMethod ¶
RandGenMethod returns a random religion generation method.
func (*Generator) RandTypeFromForm ¶
RandTypeFromForm generates a random religion type based on a given religion form ("Polytheism", "Dualism", etc).