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 load cultivation world map

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

Overview

Concrete tool for loading a game map from a JSON-defined region matrix, provided by the Cultivation World Simulator map system.

Description

The load_cultivation_world_map function resolves a map preset by ID, reads its `map.json` source file, and constructs a fully populated `Map` object with tiles, regions, and metadata. It follows a region-first design: the `region_rows` matrix in `map.json` is the semantic truth, and tile types are derived from region assignments.

The function delegates to `build_map_from_source`, which:

  • Derives tile rows from region rows
  • Creates `Tile` objects with appropriate `TileType`
  • Loads region metadata from CSV configs (normal, city, cultivate, sect)
  • Applies region overrides (custom names/descriptions from the map preset)
  • Binds regions to tiles

Usage

Import this function when you need to load a game map:

  • Game initialization: called during `perform_game_initialization` with the `map_id` from the run config
  • Map preview: called by the map presets API to preview a map without creating a world

Code Reference

Source Location

Signature

def load_cultivation_world_map(map_id: str | None = None) -> Map:
    """
    从 region-first 地图源加载修仙世界地图。
    读取: maps/<map_id>/map.json
    以及: normal/city/cultivate/sect_region.csv
    """

Import

from src.run.load_map import load_cultivation_world_map

I/O Contract

Inputs

Name Type Required Description
map_id None No Map preset identifier (default "classic")

Outputs

Name Type Description
return Map Fully constructed game map with regions, tiles, landmarks, and overrides

Usage Examples

Load Default Map

from src.run.load_map import load_cultivation_world_map

# Load the default "classic" map
game_map = load_cultivation_world_map()
print(f"Map: {game_map.width}x{game_map.height}")
print(f"Regions: {len(game_map.regions)}")

Load Specific Map Preset

# Load a specific map by ID
game_map = load_cultivation_world_map("expanded")
print(f"Map preset: {game_map.map_name}")

Related Pages

Implements Principle

Required Environments

Page Connections

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