![]() |
CRM64Pro GDK v0.18.0
A free cross-platform game development kit built on top of SDL 3.0
|
Advanced 2D scene and game world management system [v26.02.0].
Scene subsystems and shared Scene API types.
The parent Scene group contains shared enums and small data structures used by Scene, SceneMgr and Scene layers. Concrete classes are documented in the Scene Layer, Scene, and Scene Manager subgroups.
The Scene module is a comprehensive 2D world management system designed for building complex, high-performance game environments. It acts as the backbone of the game loop, featuring a unified layer architecture that seamlessly integrates standard Tile Maps, high-performance Entity/Object layers, and dynamic Image layers into a single cohesive rendering and logic pipeline.
Fully compatible with the industry-standard Tiled level editor (TMX format), it bridges the gap between level design and runtime execution. Developers can visually construct their worlds while leveraging advanced engine features such as Hybrid Entity-Grid Architecture (HEGA), object factory-driven entity creation, and authoritative world-state persistence back to TMX/TSX resources.
Trigger events are dispatched in three scopes, in this order:
SceneObject::setOnTriggerEvent() SceneLayerObject::setOnTriggerEvent() Scene::setOnTriggerEvent() Use object scope for local object behavior, layer scope for domain-level systems, and global scope for cross-cutting systems (analytics, quest bus, debug overlays).
The engine supports three distinct layer types, all inheriting from a common base:
| Tile Layers | Grid-based mapping. Supports multiple tilesets, animations, and efficient rendering. Ideal for terrain and static environments. |
|---|---|
| Object Layers (HEGA) | Advanced entity management system. Uses HEGA spatial hashing for ultra-fast region queries, frustum culling, and precise collision detection. Supports geometric shapes, triggers, and dynamic visual sprites. |
| Image Layers | Single-image rendering. Perfect for parallax backgrounds, skies, or foreground overlays. Supports tiling and scrolling. |
| Custom Layers | User-defined rendering and logic. Extend the engine by inheriting from any layer type and implementing custom behaviors. |
The Scene is designed for modern, multi-threaded game architectures:
addObject() and closeObject() are thread-safe and use an internal Command Buffer. Requests are queued under a high-performance lock and applied at a safe synchronization point at the end of each layer's update logic. update() callbacks or collision queries without fear of iterator invalidation. setMTFriendly() is enabled). The Scene is designed for compatibility with Tiled (TMX format).
| TMX Version | v1.0 to v1.10 (Orthogonal orientation, Right-Down render order). |
|---|---|
| Data encoding | CSV, Base64 (uncompressed or zlib compressed). |
| Global settings | 'infinite' and 'backgroundcolor' are ignored. |
| C64SCENE Extensions | Embedded map (v3.0). Layer IDs start with 1. Custom properties (c64te_*) configure engine-specific features. |
| Templates | Supports Tiled object templates (.tx) with optional external <tileset source="..."> and template instances in TMX object layers. |
| Object rotation | Tile and geometric objects support rotation (including negative angles), cached rotated AABB, precise rotated hit-testing, and rotated shape rendering. |
There is a fundamental difference between Tiled and the CRM64Pro Scene regarding layer ordering:
id attribute is purely informational. Important: When designing in Tiled, ensure that your layers' id attributes follow an increasing numerical sequence that matches your desired visual stacking (e.g., Background=1, Ground=2, Foreground=3). If the TMX file contains non-sequential IDs or IDs that do not match the XML node order, the render order in the engine will differ from Tiled.
This is a standard manager: objects are not shared and must be unique using its name as the key. You cannot create an object with the same name as another one already created.
Resource names are restricted to prevent collisions with system assets. The characters '#' and '@' are reserved for internal engine use. Any attempt to create or rename a resource starting with these characters will be rejected (returning a negative error code).
Topics | |
| Scene Layer | |
| Data classes for Scene Layer management [v26.02.0]. | |
| Scene | |
| Scene objects for 2D tile-based game development. | |
| Scene Manager | |
| Scene Manager for lifecycle and asset management. | |
Classes | |
| struct | CRM64Pro::SceneCameraParams |
| Camera configuration parameters. More... | |
| enum CRM64Pro::eSceneLayerFeature : Uint32 |
Features for Scene layers.
These flags can be combined using bitwise operators.
| Enumerator | |
|---|---|
| SLF_NONE | No layer features are enabled. Default value. |
| SLF_REPEATX | Enable the layer image to be repeated along the X-axis. |
| SLF_REPEATY | Enable the layer image to be repeated along the Y-axis. |
| SLF_UPDATE | Enable the updating feature. Check update() for further details. |
| SLF_RENDER | Enable the rendering feature. Enabling this flag also enables ::SLF_UPDATE. Disabling render does not disable update. |
| SLF_SMOOTHSCROLL | Enable the smooth rendering feature. Check render() for further details. |
| SLF_PAUSE | Pause the layer. Engine-driven movement/interpolation are frozen for this layer. Scene::update()/render() should still be called to keep global timing and rendering flow consistent. |
| enum CRM64Pro::eSceneDebugOverlay : Uint32 |
Scene unified debug overlay flags.
| enum CRM64Pro::eSceneTileSetType : Sint32 |
| enum CRM64Pro::eSceneStorageMode : Sint32 |
Specifies where the tileset data is physically stored.
| Enumerator | |
|---|---|
| SSM_DISK | Standard file on the physical disk. |
| SSM_CDC | Inside a CRM64Pro::Archive (CDC) file. |
| SSM_INTERNAL | |
| enum CRM64Pro::eSceneShapeType : Sint32 |
Specifies the geometric shape type of a SceneObject.
| enum CRM64Pro::eSceneLayerType : Sint32 |
Specifies the type of a Scene layer.
| Enumerator | |
|---|---|
| SLT_EMPTY | Layer slot exists but has no type-specific data assigned. |
| SLT_TILE | Layer contains tile data (SceneLayerTile). |
| SLT_OBJECT | Layer contains game objects (SceneLayerObject). |
| SLT_IMAGE | Layer displays an image (SceneLayerImage). |
| SLT_USER_START | Start of user-defined layer types. |
| enum CRM64Pro::eSceneObjectRenderOrder : Sint32 |
Specifies object rendering order policy for SceneLayerObject.
| enum CRM64Pro::eSceneTriggerEventType : Uint32 |
| enum CRM64Pro::eSceneCameraMode : Uint32 |
Camera controller modes for a Scene layer.
Camera processing is evaluated during Scene::update() and applied to the selected layer position. The selected layer remains the "camera authority" and linked parallax layers continue to be updated.
| Enumerator | |
|---|---|
| SCM_MANUAL | Manual mode. Camera is controlled only through setLayerPosition()/setCameraPosition(). |
| SCM_AUTOSCROLL | Automatic scrolling by velocity (SceneCameraParams::ptAutoScrollSpeed), then optional damping/clamping. |
| SCM_SNAP | Instant target tracking each logic tick (no damping, no deadzone behavior). |
| SCM_SMOOTH | Damped target tracking using SceneCameraParams::fDamping. |
| SCM_DEADZONE | Damped deadzone tracking; deadzone is centered on SceneCameraParams::ptScreenAnchor. |
| SCM_OFFSET | Damped tracking plus dynamic offset callback (mouse/stick/cinematic bias). |