gen

package
v0.0.0-...-2271788 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GenderMale   = "Male"
	GenderFemale = "Female"
)
View Source
const (
	TablesPath                   = "tables"
	TableBuildingsFileName       = "building.txt"
	TableCharacteristicsFileName = "characteristic.txt"
	TableProfessionsFileName     = "profession.txt"
)
View Source
const (
	WorldComplexitySimple     = 1
	WorldComplexityNormal     = 2
	WorldComplexityLarge      = 3
	WorldComplexityExtraLarge = 4
)

Variables

View Source
var (
	SyllableStructures = []string{"CV", "VC"}
	ConsonantPresets   = []string{"ptkbdgmnlrsqxʧ", "pbgdzklmnrstʤ",
		"pbgdzklmnrstv"}
	VowelPresets = []string{"aeiou", "aeio", "aeou"}
	FinalPresets = []string{"mnsk", "mnŋsk", "mnʃsk"}
	Orthography  = map[string]string{"ʃ": "sh", "ʧ": "ch",
		"ʤ": "j", "ŋ": "ng", "x": "kh", "ɣ": "gh"}
	Alphabet = "abcdefghijklmnopqrstuvwxyz"
)

Functions

func GenerateCharacter

func GenerateCharacter(l *Language, gender string) *rpg.Character

func GenerateRegionConnections

func GenerateRegionConnections(w *rpg.World)

func GenerateSubregionConnections

func GenerateSubregionConnections(re *rpg.Region, wg *sync.WaitGroup)

func GenerateWorld

func GenerateWorld(l *Language, complexity uint8) *rpg.World

func InitRandomTables

func InitRandomTables()

func PopulateFamilyTree

func PopulateFamilyTree(node *FamilyTreeNode, w *rpg.World,
	wg *sync.WaitGroup)

func PopulateRegion

func PopulateRegion(r *rpg.Region, l *Language, complexity uint8, wg *sync.WaitGroup)

func PopulateWorld

func PopulateWorld(w *rpg.World, l *Language, complexity uint8)

func RandomGender

func RandomGender() string

func Reseed

func Reseed()

Types

type Family

type Family struct {
	Surname  string
	Origin   *rpg.Region
	Language *Language
}

func GenerateFamily

func GenerateFamily(l *Language, r *rpg.Region) *Family

type FamilyTree

type FamilyTree struct {
	Root FamilyTreeNode
}

func GenerateFamilyTree

func GenerateFamilyTree(f *Family, w *rpg.World,
	numStartingChildren int) *FamilyTree

type FamilyTreeNode

type FamilyTreeNode struct {
	Character   *rpg.Character
	BirthFamily *Family           `json:"-"`
	Mother      *FamilyTreeNode   `json:"-"`
	Father      *FamilyTreeNode   `json:"-"`
	Spouse      *FamilyTreeNode   `json:"-"`
	Children    []*FamilyTreeNode `json:",omitempty"`
}

func (*FamilyTreeNode) CanHaveChildren

func (n *FamilyTreeNode) CanHaveChildren() bool

func (*FamilyTreeNode) GenerateSpouse

func (n *FamilyTreeNode) GenerateSpouse(w *rpg.World)

func (*FamilyTreeNode) Married

func (n *FamilyTreeNode) Married() bool

func (*FamilyTreeNode) Siblings

func (n *FamilyTreeNode) Siblings() []*FamilyTreeNode

type Language

type Language struct {
	*Phonemes
	ID           primitive.ObjectID `bson:"_id,omitempty"`
	Structure    string
	MinSyllables int8
	MaxSyllables int8
}

func GenerateLanguage

func GenerateLanguage() *Language

func (*Language) Name

func (l *Language) Name() string

func (*Language) Syllable

func (l *Language) Syllable() string

func (*Language) Word

func (l *Language) Word() string

type Phonemes

type Phonemes struct {
	Consonants string
	Vowels     string
	Finals     string
}

Phonemes - https://worldbuildingworkshop.com/constructing-languages/

func (*Phonemes) Type

func (p *Phonemes) Type(r rune) string

type Possibility

type Possibility struct {
	// contains filtered or unexported fields
}

func NewPossibility

func NewPossibility() *Possibility

func (*Possibility) Increase

func (p *Possibility) Increase()

func (*Possibility) Reduce

func (p *Possibility) Reduce()

type RandomTable

type RandomTable struct {
	Name   string
	Values map[int]string
	// contains filtered or unexported fields
}
var (
	Tables = []*RandomTable{
		&TableBuildings,
		&TableCharacteristics,
		&TableProfessions,
	}
	TableBuildings       RandomTable
	TableCharacteristics RandomTable
	TableProfessions     RandomTable
)

func NewRandomTable

func NewRandomTable(path string) (RandomTable, error)

func (*RandomTable) Parse

func (rt *RandomTable) Parse(path string) error

func (*RandomTable) Roll

func (rt *RandomTable) Roll() string

Jump to

Keyboard shortcuts

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