Generate detailed medieval character profiles with realistic attributes and backstories
using Omnivael.MedievalBio;
// Create a basic character context
var context = new NpcContext
{
Id = "merchant_001",
HomeTier = SettlementTier.Town,
TownLevelScore = 65,
Faction = FactionType.Civilian
};
// Generate the character
var character = CharacterBioGenerator.Generate(context);
// Access character data
Debug.Log($"Name: {character.Profile.DisplayName}");
Debug.Log($"Occupation: {character.Profile.Occupation}");
Debug.Log($"Social Class: {character.Profile.SocialClass}");
| Parameter | Type | Description | Default |
|---|---|---|---|
Id |
string | Unique identifier for the character | Required |
HomeTier |
SettlementTier | Settlement type (Wilderness to Keep) | SettlementTier.Village |
TownLevelScore |
int | Wealth/development level (0-100) | 50 |
Faction |
FactionType | Character's faction affiliation | FactionType.Civilian |
Position |
Vector3 | World position (optional) | Vector3.zero |
GenderOverride |
Gender? | Force specific gender | Random |
AgeOverride |
int? | Force specific age | Age-appropriate |
OccupationHint |
Occupation? | Suggest occupation | Context-based |
SocialClassHint |
SocialClass? | Suggest social class | Context-based |
GenerateExtendedFamily |
bool | Generate family tree | true |
GenerateEnhancedAttributes |
bool | Generate personality/physical traits | true |
var banditContext = new NpcContext
{
Id = "bandit_chief_001",
HomeTier = SettlementTier.Wilderness,
TownLevelScore = 10,
Faction = FactionType.Bandit,
AgeOverride = 35,
GenderOverride = Gender.Male
};
var bandit = CharacterBioGenerator.Generate(banditContext);
// Results in: "Black Jack" the Cutthroat, with criminal background
var nobleContext = new NpcContext
{
Id = "lord_001",
HomeTier = SettlementTier.City,
TownLevelScore = 85,
Faction = FactionType.Noble,
SocialClassHint = SocialClass.Noble
};
var noble = CharacterBioGenerator.Generate(nobleContext);
// Results in: "Lord Aldric of House Thornbury" with appropriate titles
var merchantContext = new NpcContext
{
Id = "merchant_001",
HomeTier = SettlementTier.Town,
TownLevelScore = 70,
Faction = FactionType.Civilian,
OccupationHint = Occupation.Merchant,
SocialClassHint = SocialClass.Merchant
};
var merchant = CharacterBioGenerator.Generate(merchantContext);
// Forces merchant occupation with appropriate social class
public class NpcSpawner : MonoBehaviour
{
public void SpawnNpc(Vector3 position, SettlementTier tier)
{
var context = new NpcContext
{
Id = System.Guid.NewGuid().ToString(),
Position = position,
HomeTier = tier,
TownLevelScore = GetTownScore(position),
Faction = DetermineFaction(position)
};
var character = CharacterBioGenerator.Generate(context);
// Apply character data to your NPC
var npc = Instantiate(npcPrefab, position, Quaternion.identity);
npc.GetComponent<NpcData>().Initialize(character);
}
}