Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:4thfever Cultivation world simulator make avatars

From Leeroopedia
Knowledge Sources
Domains Procedural_Generation, Game_Initialization
Last Updated 2026-10-22 14:00 GMT

Overview

Concrete tool for procedurally generating a group of NPC avatars with randomized attributes, sects, and relationships, provided by the Cultivation World Simulator avatar initialization system.

Description

The make_avatars function uses a `PopulationPlanner` to plan a group of N avatars with balanced sect distribution, then delegates to `AvatarFactory.build_group` to instantiate each avatar with randomized name, gender, age, race, cultivation level, sect, personas, and potential relationships.

Avatars whose rolled lifespan is already exhausted are flagged as dead-on-arrival; the init flow routes them through `handle_death`.

Usage

Import and call this function when:

  • Game initialization: generating the initial NPC population
  • Population injection: adding more NPCs to an existing world (though the init flow is the primary caller)

Code Reference

Source Location

Signature

def make_avatars(
    world: World,
    count: int = 12,
    current_month_stamp: MonthStamp = MonthStamp(100 * 12),
    existed_sects: Optional[List[Sect]] = None,
) -> dict[str, Avatar]:

Import

from src.sim.avatar_init.factory import make_avatars

I/O Contract

Inputs

Name Type Required Description
world World Yes World instance to populate
count int No Target NPC count (default 12)
current_month_stamp MonthStamp No Current time stamp (default Year 100, January)
existed_sects None No Active sects for assignment (default None)

Outputs

Name Type Description
return dict[str, Avatar] Mapping of avatar ID to Avatar instance

Usage Examples

Generate Initial NPC Population

from src.sim.avatar_init.factory import make_avatars

avatars = make_avatars(
    world=world,
    count=run_config.init_npc_num,
    current_month_stamp=world.month_stamp,
    existed_sects=existed_sects,
)
world.avatar_manager.avatars.update(avatars)

Related Pages

Implements Principle

Required Environments

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment