๐ŸŒฒ Family Tree Generator

Build realistic medieval family relationships with age-appropriate logic and inheritance patterns

The Family Tree Generator creates authentic medieval family structures including parents, spouse, and children with realistic age gaps, occupation inheritance, and social class considerations based on the main character's context.

๐Ÿš€ Quick Start

Basic Family Generation

using Omnivael.MedievalBio;

// Generate a character with family
var context = new NpcContext
{
    Id = "merchant_001",
    HomeTier = SettlementTier.Town,
    TownLevelScore = 65,
    Faction = FactionType.Civilian,
    GenerateExtendedFamily = true
};

var character = CharacterBioGenerator.Generate(context);

// Access family members
var parents = character.Family.Parents;
var spouse = character.Family.Spouse;
var children = character.Family.Children;

Debug.Log($"Character: {character.Profile.DisplayName}");
Debug.Log($"Parents: {parents.Count}");
Debug.Log($"Spouse: {(spouse != null ? spouse.DisplayName : "None")}");
Debug.Log($"Children: {children.Count}");

๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Family Structure

Parents Generation
๐Ÿ‘จ Father (Age: Character Age + 20-30) ๐Ÿ‘ฉ Mother (Age: Character Age + 18-28)
โ”‚
Main Character
๐Ÿ‘ค Character (Your Generated NPC)
โ”‚
Spouse & Children Generation
๐Ÿ’ Spouse (Age: Similar to Character) โ†’ ๐Ÿ‘ถ Children (Ages: 0-Character Age - 16)

โš™๏ธ Family Generation Logic

Age-Based Generation

Occupation Inheritance System

๐Ÿ˜๏ธ Settlement Impact on Families

Family Size by Settlement Tier

Social Class Considerations

๐Ÿ’ Marriage and Spouse Generation

Spouse Selection Logic

Marriage Probability by Age

// Marriage likelihood based on character age
Age 16-25: 20% chance of being unmarried
Age 26-35: 70% chance of being married
Age 36-45: 85% chance of being married
Age 46+: 60% chance of being married (higher widow rate)

๐Ÿ‘ถ Child Generation Details

Child Count Probability

Advanced Family Generation Example

// Generate a noble family with specific parameters
var nobleContext = new NpcContext
{
    Id = "lord_thornbury",
    HomeTier = SettlementTier.City,
    TownLevelScore = 85,
    Faction = FactionType.Noble,
    AgeOverride = 45,
    GenderOverride = Gender.Male
};

var noble = CharacterBioGenerator.Generate(nobleContext);

// Access detailed family information
Debug.Log($"Lord: {noble.Profile.DisplayName}");
Debug.Log($"Age: {noble.Profile.Age}");

foreach (var parent in noble.Family.Parents)
{
    Debug.Log($"Parent: {parent.DisplayName} (Age: {parent.Age})");
    Debug.Log($"Parent Occupation: {parent.Occupation}");
}

if (noble.Family.Spouse != null)
{
    Debug.Log($"Spouse: {noble.Family.Spouse.DisplayName} (Age: {noble.Family.Spouse.Age})");
}

foreach (var child in noble.Family.Children)
{
    Debug.Log($"Child: {child.DisplayName} (Age: {child.Age})");
    Debug.Log($"Child Occupation: {child.Occupation}");
}

๐Ÿงฌ Family Traditions and Heritage

Multi-Generational Occupations

๐Ÿ”ง Manual Family Tree Construction

Using FamilyTreeGenerator Directly

// Manual family tree generation
var familyGenerator = new EnhancedFamilyTreeGenerator();
var mainCharacter = new PersonProfile { /* your character data */ };

// Generate specific family members
var parents = familyGenerator.GenerateParents(mainCharacter);
var spouse = familyGenerator.GenerateSpouse(mainCharacter);
var children = familyGenerator.GenerateChildren(mainCharacter, spouse);

// Create custom family tree
var familyTree = new FamilyTree
{
    MainCharacter = mainCharacter,
    Parents = parents,
    Spouse = spouse,
    Children = children
};

๐Ÿ’ก Pro Tips for Realistic Families

Historical Accuracy Guidelines

Storytelling Opportunities

๐ŸŽฎ Game Integration Examples

Dynamic NPC Generation

public class DynamicNpcSpawner : MonoBehaviour
{
    public void SpawnFamilyGroup(SettlementTier tier, Vector3 location)
    {
        // Generate family patriarch/matriarch
        var elderContext = new NpcContext
        {
            Id = $"elder_{location.GetHashCode()}",
            HomeTier = tier,
            TownLevelScore = GetSettlementScore(location),
            Faction = FactionType.Civilian,
            AgeOverride = Random.Range(40, 65)
        };

        var elder = CharacterBioGenerator.Generate(elderContext);
        SpawnNpc(elder, location);

        // Spawn family members
        foreach (var child in elder.Family.Children)
        {
            if (child.Age >= 16) // Only spawn adult children
            {
                SpawnNpc(child, location + Random.insideUnitSphere * 5f);
            }
        }

        if (elder.Family.Spouse != null)
        {
            SpawnNpc(elder.Family.Spouse, location + Vector3.right * 2f);
        }
    }
}
โ† Back to Medieval Bio Generator