Core Concepts

Node

Nodes are the basic building block of a game in Seika Engine. There are many node types that inherit from the base Node class and more information about their API usage can be found here. Python scripts can be attached to Nodes to add to their functionality.

Scene

A scene is a collection of nodes. Must contain a root node and there can only be one root node per scene. Scenes can be instanced. When a scene is destroyed the root node as well as all it's children will also be removed. In Seika Engine all scenes are stored as json files. Here is an example of how a scene with just a root node is serialized to json.

{
    "name": "Main",
    "type": "Node",
    "tags": [],
    "external_scene_source": "",
    "components": [],
    "children": []
}

More examples of how nodes are serialized can be found here.

Scene Tree

The scene tree contains active scenes nodes. There are two types of active scenes.

Main Scene

The current main scene, there can only be one at a time.

Singleton Scene

Scenes that are made active when the game is initialized. They will stay active during the duration of the game unless queue_deletion() is called on them.

Signal

Signals can be used to apply the observer pattern to game logic. They are also used for notifying interested listeners about events for some of the systems within the engine (e.g. joystick disconnecting). Signals are defined within the base Node class.

from seika.nodes import AnimatedSprite

class Seika(AnimatedSprite):
    def _start(self) -> None:
        self.connect_signal("animation_finished", self, "_on_AnimatedSprite_animation_finished")
        self.play(animation_name="swim")

    def _on_AnimatedSprite_animation_finished(self, args : list) -> None:
        if self.animation.name == "swim":
            self.play(animation_name="idle")

Example to play an animation named 'idle' after the 'swim' animation is played.