genreligion

package
v0.0.0-...-ce97658 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

README

genreligion

The deity generation code is based on: https://github.com/Azgaar/Fantasy-Map-Generator/blob/master/modules/religions-generator.js

TODO:

  • Move religion generation to a separate package? Where we can also generate the pantheon?

Documentation

Index

Constants

View Source
const (
	CreationTokenIntro     = "[INTRO]"
	CreationTokenWorld     = "[WORLD]"
	CreationTokenCreation  = "[CREATION]"
	CreationTokenGod       = "[GOD]"
	CreationTokenAdjective = "[ADJECTIVE]"
	CreationTokenMaterial  = "[MATERIAL]"
	CreationTokenShaping   = "[SHAPING]"
)
View Source
const (
	TokenNumber    = "[NUMBER]"
	TokenBeing     = "[BEING]"
	TokenAdjective = "[ADJECTIVE]"
	TokenColor     = "[COLOR]"
	TokenAnimal    = "[ANIMAL]"
	TokenGenitive  = "[GENITIVE]"
)
View Source
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]"
)
View Source
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]"
)
View Source
const (
	TokenPlace    = "[PLACE]"
	TokenCulture  = "[CULTURE]"
	TokenRandom   = "[RANDOM]"
	TokenSurpreme = "[SUPREME]"
	TokenType     = "[TYPE]"
	TokenFaith    = "[FAITH]"
)
View Source
const (
	// Expansion modes.
	ReligionExpGlobal  = "global"
	ReligionExpState   = "state"
	ReligionExpCulture = "culture"
)
View Source
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

View Source
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,
}
View Source
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.

View Source
var DeityMeaningApproaches []string
View Source
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.

Forms maps a religion group to religion forms with a weighed probability.

View Source
var GenBaseAdjective = genlanguage.GenBaseAdjective
View Source
var GenBaseAnimal = genlanguage.GenBaseAnimal
View Source
var GenBaseBeing = genlanguage.GenBaseBeing
View Source
var GenBaseColor = genlanguage.GenBaseColor
View Source
var GenBaseGenitive = genlanguage.GenBaseGenitive
View Source
var GenBaseNumber = genlanguage.GenBaseNumber
View Source
var GenBaseTheGenitive = genlanguage.GenBaseTheGenitive
View Source
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.

View Source
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.

View Source
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].",
}
View Source
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.

View Source
var WorldCreationPool = []string{
	"created by",
	"shaped in a dream of",
	"given existence by",
	"brought into being by",
}
View Source
var WorldMaterialAdjectivesPool = []string{
	"lone",
	"pure",
	"perfect",
	"perfectly round",
	"perfectly square",
	"precious",
	"beautiful",
	"beautifully round",
}
View Source
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",
}
View Source
var WorldShapingPool = []string{
	"formed",
	"shaped",
	"created",
	"made",
}

Functions

This section is empty.

Types

type Classification

type Classification struct {
	Group string
	Form  string
	Type  string
}

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 Deity

type Deity struct {
	Name    string
	Meaning *genstory.Generated
}

Deity represents a deity name.

func (*Deity) FullName

func (d *Deity) FullName() string

FullName returns the full name of the deity (including the meaning, if any).

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

func (g *Generator) GenFaithName(tokens []genstory.TokenReplacement) (*genstory.Generated, error)

GenFaithName generates a name for a faith.

func (*Generator) GenNameFaitOfSupreme

func (g *Generator) GenNameFaitOfSupreme(supreme string) string

GenNameFaitOfSurpreme generates a name for a faith of a supreme deity or leader. E.g. "Way of Grognark".

func (*Generator) GenNamedIsm

func (g *Generator) GenNamedIsm(name string) string

GenNamedIsm generates a name for a religion based on a given religion form ("Polytheism", "Dualism", etc). E.g. "Pradaniumism".

func (*Generator) GenerateDeityMeaning

func (g *Generator) GenerateDeityMeaning(approach string) (*genstory.Generated, error)

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

func (g *Generator) GetDeity() (*Deity, error)

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

func (g *Generator) GetDeityWithApproach(approach string) (*Deity, error)

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

func (g *Generator) NewCreation(god *Deity) (*genstory.Generated, error)

NewCreation generates a new world creation mythos using the given seed.

func (*Generator) Ra

func (g *Generator) Ra(array []string) string

func (*Generator) RandDeityGenMethod

func (g *Generator) RandDeityGenMethod() string

RandDeityMeaningGenMethod returns a random deity meaning generation method.

func (*Generator) RandFormFromGroup

func (g *Generator) RandFormFromGroup(group string) string

RandFormFromGroup returns a random religion form based on a given religion group ("Folk", "Organized", etc).

func (*Generator) RandGenMethod

func (g *Generator) RandGenMethod() string

RandGenMethod returns a random religion generation method.

func (*Generator) RandTypeFromForm

func (g *Generator) RandTypeFromForm(form string) string

RandTypeFromForm generates a random religion type based on a given religion form ("Polytheism", "Dualism", etc).

func (*Generator) Rw

func (g *Generator) Rw(mp map[string]int) string

func (*Generator) SetSeed

func (g *Generator) SetSeed(seed int64)

SetSeed sets the seed for the generator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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