Skip to content

sonolus.script.engine

Engine

A Sonolus.py engine.

Parameters:

Name Type Description Default
name str

The name of the engine.

required
title AnyText | None

The title of the engine.

None
subtitle AnyText

The subtitle of the engine.

'Sonolus.py Engine'
author AnyText

The author of the engine.

'Unknown'
skin str | None

The default skin for the engine.

None
background str | None

The default background for the engine.

None
effect str | None

The default effect for the engine.

None
particle str | None

The default particle for the engine.

None
thumbnail Asset | None

The thumbnail for the engine.

None
data EngineData

The engine's modes and configurations.

required
tags list[Tag] | None

The tags of the engine.

None
description AnyText | None

The description of the engine.

None
meta Any

Additional metadata of the engine.

None

export()

Export the engine in a sonolus-pack compatible format.

Returns:

Type Description
ExportedEngine

An exported engine.

EngineData

A Sonolus.py engine's modes and configurations.

Parameters:

Name Type Description Default
ui UiConfig | None

The UI configuration.

None
options Options

The options for the engine.

EmptyOptions
play PlayMode | None

The play mode configuration.

None
watch WatchMode | None

The watch mode configuration.

None
preview PreviewMode | None

The preview mode configuration.

None
tutorial TutorialMode | None

The tutorial mode configuration.

None

ExportedEngine

An exported Sonolus.py engine.

write_to_dir(path)

Write the exported engine to a directory.

PlayMode

A play mode definition.

Parameters:

Name Type Description Default
archetypes list[type[_BaseArchetype]] | None

A list of play archetypes.

None
skin Skin

The skin for the play mode.

EmptySkin
effects Effects

The effects for the play mode.

EmptyEffects
particles Particles

The particles for the play mode.

EmptyParticles
buckets Buckets

The buckets for the play mode.

EmptyBuckets

PreviewMode

A preview mode definition.

Parameters:

Name Type Description Default
archetypes list[type[_BaseArchetype]] | None

A list of preview archetypes.

None
skin Skin

The skin for the preview mode.

EmptySkin

TutorialMode

A tutorial mode definition.

Parameters:

Name Type Description Default
skin Skin

The skin for the tutorial mode.

EmptySkin
effects Effects

The effects for the tutorial mode.

EmptyEffects
particles Particles

The particles for the tutorial mode.

EmptyParticles
instructions TutorialInstructions

The instructions for the tutorial mode.

EmptyInstructions
instruction_icons TutorialInstructionIcons

The instruction icons for the tutorial mode.

EmptyInstructionIcons
preprocess Callable[[], None]

A callback to be called before the tutorial starts.

required
navigate Callable[[], None]

A callback to be called when the user navigates.

required
update Callable[[], None]

A callback to be called each frame.

required

WatchMode

A watch mode definition.

Parameters:

Name Type Description Default
archetypes list[type[_BaseArchetype]] | None

A list of watch archetypes.

None
skin Skin

The skin for the watch mode.

EmptySkin
effects Effects

The effects for the watch mode.

EmptyEffects
particles Particles

The particles for the watch mode.

EmptyParticles
buckets Buckets

The buckets for the watch mode.

EmptyBuckets
update_spawn Callable[[], float]

A callback returning the spawn time used by archetypes.

required

empty_play_mode()

Create an empty play mode.

empty_preview_mode()

Create an empty preview mode.

empty_tutorial_mode()

Create an empty tutorial mode.

empty_watch_mode()

Create an empty watch mode.