simvx.core.project

Project configuration – load/save project.simvx (JSON) files.

A project file defines the game’s display settings, input actions, autoloaded scripts, physics framerate, and main scene path.

Public API: from simvx.core.project import ProjectSettings, load_project, save_project

settings = load_project("project.simvx")
settings.name = "My Game"
save_project(settings, "project.simvx")

Module Contents

Classes

ProjectSettings

Project configuration loaded from project.simvx.

Functions

load_project

Load project settings from a project.simvx file.

save_project

Save project settings to a project.simvx file.

boot_project

Load a project and execute the boot sequence.

Data

API

simvx.core.project.log

‘getLogger(…)’

simvx.core.project.__all__

[‘ProjectSettings’, ‘load_project’, ‘save_project’]

class simvx.core.project.ProjectSettings(data: dict[str, Any] | None = None)

Project configuration loaded from project.simvx.

Attributes: name: Project display name. main_scene: Path to the main scene file (relative to project root). display: Display settings (width, height, fullscreen, vsync, stretch). input_actions: Mapping of action name -> list of key names. autoloads: Mapping of name -> script path (loaded before main scene). physics_fps: Physics update rate. target_fps: Target frame rate (0 = unlimited). audio: Audio configuration. rendering: Rendering backend configuration. project_path: Path to the project.simvx file (set on load).

Initialization

to_dict() dict[str, Any]

Serialize to a JSON-compatible dict.

get_project_dir() str

Return the directory containing the project file.

resolve_path(relative: str) str

Resolve a project-relative path to an absolute path.

apply_input_actions()

Register all input_actions with the Input singleton.

simvx.core.project.load_project(path: str | pathlib.Path) simvx.core.project.ProjectSettings

Load project settings from a project.simvx file.

Args: path: Path to the project.simvx JSON file.

Returns: ProjectSettings with all fields populated.

Raises: FileNotFoundError: If the file does not exist. json.JSONDecodeError: If the file is not valid JSON.

simvx.core.project.save_project(settings: simvx.core.project.ProjectSettings, path: str | pathlib.Path | None = None) None

Save project settings to a project.simvx file.

Args: settings: ProjectSettings to save. path: Output file path. If None, uses settings.project_path.

simvx.core.project.boot_project(path: str | pathlib.Path) simvx.core.project.ProjectSettings

Load a project and execute the boot sequence.

Boot sequence: 1. Read project.simvx 2. Register input actions 3. Return settings (caller creates App with display settings, loads autoloads/main_scene)

Args: path: Path to project.simvx.

Returns: Fully initialized ProjectSettings.