babylon.data.game
Game entity JSON data files.
Contains static game data (characters, classes, factions, etc.) migrated from XML format.
- Usage:
from babylon.data.game import GAME_DATA_DIR, load_json
characters = load_json(“characters.json”)
Functions
List all JSON data files in the game data directory. |
|
Load event templates from the event_templates.json file. |
|
|
Load a JSON file from the game data directory. |
- babylon.data.game.load_json(filename)[source]
Load a JSON file from the game data directory.
- Parameters:
filename (
str) – Name of the JSON file (e.g., “characters.json”)- Return type:
- Returns:
Parsed JSON data as a dictionary.
- Raises:
FileNotFoundError – If the file doesn’t exist.
json.JSONDecodeError – If the file isn’t valid JSON.
- babylon.data.game.load_event_templates()[source]
Load event templates from the event_templates.json file.
Parses the JSON file and converts each template dict to an EventTemplate Pydantic model.
- Return type:
- Returns:
List of EventTemplate objects.
- Raises:
FileNotFoundError – If event_templates.json doesn’t exist.
ValidationError – If template data is invalid.