Documentation ¶
Overview ¶
Package simvillage is a port of the wonderful village simulator by Kontari. See: https://github.com/Kontari/Village/
Index ¶
- Constants
- Variables
- type Age
- type Calendar
- type CityManager
- type Death
- type GenderType
- type HistoryManager
- type Instance
- type Job
- type JobManager
- type Log
- type MarkovGen
- type Marriage
- type MgenIf
- type MgenModel
- type Mngi
- type Mood
- type MoodEvent
- type PeopleManager
- type Person
- type Personality
- type RandomEffects
- type Relations
- type Relationship
- type Resource
- type SocialEvents
Constants ¶
const ( AgeInfant = "Infant" AgeChild = "Child" AgeYoungAdult = "Young Adult" AgeAdult = "Adult" AgeOldPerson = "Old Person" AgeElder = "Elder" )
const ( SeasonWinter = "Winter" SeasonSpring = "Spring" SeasonSummer = "Summer" SeasonFall = "Fall" )
const ( VERSION = 1.1 VERBOSE = true // Tier 0 -- World events // Tier 1 -- Character information // Tier 2 -- Daily happenings // Tier 3 -- Details // Tier 4 -- Math details // Tier 5 -- Everything LOGGING_VERBOSITY = 3 // How many villagers to start with, // cannot select less than 8 // Default: 10 STARTING_POP = 4 // FRIENDLY_CHANCE // Controls how likely neutral villagers will respond // positively to interactions // Default: 0.6 // Range: 0.0 - 1.0 FRIENDLY_CHANCE = 0.6 // How often settlers will arrive // at your village per year // Default = 12 SETTLER_CHANCE = 22 // WORLD_SADNESS // This controls how likely it is for people to have a good day // Default: 0.7 // Accepted Range: 0.0 - 1.0 AVG_HAPPY = 0.7 // SOCIAL_CHANCE // This controls the % of the population that has a social // interaction every day. Setting this to 0.0 will disable // all social events. // Warning: Setting this above 1 might cause performance // issues. // Default: 0.6 // Accepted Range: 0.0 <= SOCIAL_CHANCE = 0.6 // DISEASE_ENABLED // Enables and disables the disease module DISEASE_ENABLED = false // DISEASE_CHANCE // This controls how frequenty disease will break out // on average per year // Default: 1 DISEASE_CHANCE = 1 // DISEASE_SEVERITY // This controls how much of a population will be effected // by the sickness // Default: 0.2 // Accepted Range: 0.0 - 1.0 DISEASE_SEVERITY = 0.1 )
const ( MoodIndifferent = "Indifferent" MoodJoyous = "Joyous" MoodHappy = "Happy" MoodSad = "Sad" MoodMelancholic = "Melancholic" MoodDepressed = "Depressed" )
const ( GenderStrMale = "Male" GenderStrFemale = "Female" )
const ( RelDisliked = "Disliked" RelNeutral = "Neutral" RelLiked = "Liked" RelFriendly = "Friendly" )
Variables ¶
var ( JobMiner = &Job{ name: "Miner", successMsg: "%s mines %.0f stone.", produces: ResStone, produceBase: 15.0, chance: 0, } JobFarmer = &Job{ name: "Farmer", successMsg: "%s harvests %.0f crops.", produces: ResCrops, produceBase: 10.0, chance: 0, } JobWoodcutter = &Job{ name: "Woodcutter", successMsg: "%s chops %.0f wood.", produces: ResWood, produceBase: 20.0, chance: 0, } JobHunter = &Job{ name: "Hunter", successMsg: "%s hunts and brings back %.0f food", failMsg: "%s hunts and catches nothing.", produces: ResGame, produceBase: 20.0, canFail: true, chance: 2, } JobInfant = &Job{ name: "Infant", successMsg: "%s poops %.0f times", failMsg: "%s didn't poop", produces: ResNothing, produceBase: 2, canFail: true, chance: 2, } JobChild = &Job{ name: "Child", successMsg: "%s groans %.0f times", failMsg: "%s was helpful in the household", produces: ResNothing, canFail: true, produceBase: 1, chance: 2, } JobOldPerson = &Job{ name: "Old Person", successMsg: "%s complains %.0f times", produces: ResNothing, canFail: false, produceBase: 1, chance: 2, } )
Functions ¶
This section is empty.
Types ¶
type Age ¶
type Age struct {
// contains filtered or unexported fields
}
Age manages birthdays, and age-related job eligability.
func NewAgeWithBDay ¶
type Calendar ¶
type Calendar struct {
// contains filtered or unexported fields
}
Calendar manages time and seasons
func NewCalendar ¶
func NewCalendar() *Calendar
type CityManager ¶
type CityManager struct {
// contains filtered or unexported fields
}
CityManager manages the villages stockpiles and items.
func NewCityManager ¶
func NewCityManager(people *PeopleManager) *CityManager
func (*CityManager) Tick ¶
func (c *CityManager) Tick() []string
type Death ¶
type Death struct {
// contains filtered or unexported fields
}
Death controls chance of death, and death events
func NewDeath ¶
func NewDeath(pmanager *PeopleManager, mark *MarkovGen) *Death
type GenderType ¶
type GenderType int
const ( GenderMale GenderType = 0 GenderFemale GenderType = 1 GenderRandom GenderType = -1 )
type HistoryManager ¶
type HistoryManager struct {
// contains filtered or unexported fields
}
HistoryManager manages game ticks and logging events
func NewHistoryManager ¶
func NewHistoryManager(gameTimer *Calendar) *HistoryManager
func (*HistoryManager) Tick ¶
func (m *HistoryManager) Tick() []string
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
func NewInstance ¶
func NewInstance() *Instance
type JobManager ¶
type JobManager struct {
// contains filtered or unexported fields
}
func NewJobManager ¶
func NewJobManager(peopleManager *PeopleManager, cityStats *CityManager) *JobManager
func (*JobManager) Tick ¶
func (m *JobManager) Tick() []string
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log object represents a single tick in the village
type MarkovGen ¶
type MarkovGen struct {
// contains filtered or unexported fields
}
func NewMarkovGen ¶
func NewMarkovGen() *MarkovGen
type Marriage ¶
type Marriage struct {
// contains filtered or unexported fields
}
Subclass of the people manager
- Decides who is eligable for Marriage
- Allows romantic events to happen in the social manager
func NewMarriage ¶
type Mood ¶
type Mood struct {
// contains filtered or unexported fields
}
Mood manages daily moods and emotions
type MoodEvent ¶
type MoodEvent struct {
// contains filtered or unexported fields
}
func NewMoodEvent ¶
Moods can be effected by larger events like having a kid, losing a loved one, or getting a promotion at work. These last multiple days and effect sadness and happiness daily.
type PeopleManager ¶
type PeopleManager struct {
// contains filtered or unexported fields
}
func NewPeopleManager ¶
func NewPeopleManager() *PeopleManager
func (*PeopleManager) Tick ¶
func (m *PeopleManager) Tick() []string
type Personality ¶
type Personality struct {
// contains filtered or unexported fields
}
func NewPersonality ¶
func NewPersonality(name string) *Personality
Each villager gets a personality archetype which effects how social, work, and life events effect them.
type RandomEffects ¶
type RandomEffects struct { }
func NewRandomEffects ¶
func NewRandomEffects() *RandomEffects
type Relations ¶
type Relations struct {
// contains filtered or unexported fields
}
func NewRelations ¶
type Relationship ¶
type SocialEvents ¶
type SocialEvents struct {
// contains filtered or unexported fields
}
func NewSocialEvents ¶
func NewSocialEvents(peopleObjs *PeopleManager) *SocialEvents
func (*SocialEvents) Tick ¶
func (s *SocialEvents) Tick() []string