DEKI/ENGINE ドキュメント
deki-tiledmapeditor-integration 0.19.0
Deki パッケージリファレンス
deki-tiledmapeditor-integration

Tiled Map Editor との連携。.tmj ファイルをプロジェクトに置くと、エディターがストリーミング可能なバイナリのタイルマップにベイクします。

リポジトリ: github.com/dekiengine/deki-tiledmapeditor-integration · 最新リリース: 0.19.0 · エンジン 0.19.0 以降が必要 · 依存: deki-2d, deki-rendering

DekiEditor --packages-add deki-tiledmapeditor-integration <project> か、パッケージマネージャーからインストールします。エンジン自身のコンポーネントと C++ API は Deki のドキュメントにあります。

エディターでは Tiled Map Editor Integration と表示されます。

コンポーネント

コンポーネント カテゴリ 説明
TilemapColliderComponent タイルマップ タイルマップのレイヤーにあるタイルごとの衝突形状を、クエリで使えるようにします。
TilemapComponent タイルマップ Tiled のマップを描きます。カメラの周りのチャンクを順次読み込みます。
TilemapObjectSpawner タイルマップ シーンの読み込み時に、Tiled マップのオブジェクトレイヤーからオブジェクトを生成します。

機能フラグ

ビルドから外せる部分です。define を持つ機能はその define で切り替わり、それ以外はコンポーネントと一緒に取り除かれます。

機能 define デフォルト
Tilemap Rendering DEKI_FEATURE_TILEMAP_RENDER オン
Tilemap Collision DEKI_FEATURE_TILEMAP_COLLISION オン
Object Layers DEKI_FEATURE_TILEMAP_OBJECTS オン

コンポーネントリファレンス

TilemapColliderComponent

タイルマップのレイヤーにあるタイルごとの衝突形状を、クエリで使えるようにします。

インスペクターでの名前: タイルマップコライダーコンポーネント · カテゴリ: タイルマップ · 型: DekiTiledMap::TilemapColliderComponent

プロパティ 型 デフォルト 制約 説明
tilemap AssetRef (Tilemap) "" タイルを当たり判定にするマップです。
collisionLayer int32 0 マップのどのレイヤーに衝突用のタイルがあるかです。そのレイヤーにタイルがあるマスは通れず、空のマスは通れます。
loopX bool false ループするマップに合わせて、当たり判定を横方向に繰り返します。
wrapPeriodX int32 0 loopX が許すときに表示 横方向の 1 回分の繰り返しの幅 (タイル数) です。0 ではマップ自体の幅を使います。
loopY bool false 当たり判定を縦方向に繰り返します。
wrapPeriodY int32 0 loopY が許すときに表示 縦方向の 1 回分の繰り返しの高さ (タイル数) です。0 ではマップ自体の高さを使います。

TilemapComponent

Tiled のマップを描きます。カメラの周りのチャンクを順次読み込みます。

インスペクターでの名前: タイルマップコンポーネント · カテゴリ: タイルマップ · 型: DekiTiledMap::TilemapComponent

プロパティ 型 デフォルト 制約 説明
tilemap AssetRef (Tilemap) "" Tiled から書き出したマップです。
visibleLayerMask int32 2147483647 マップのどのレイヤーを描くかを、レイヤーごとに 1 ビットで指定します。すべてのビットを立てるとすべて描きます。
chunkPadding int32 1 画面の端の外側で、読み込んで描いておくチャンクの数です。少し余白があると、スクロール中に端でタイルが突然現れるのを防げます。
chunkCacheKiB int32 256 16 から 262144 このマップがデコード済みのチャンクを保持できるメモリ量 (KiB) です。上限を超えると最も長く描かれていないチャンクから捨てられ、必要になったときにストレージから読み直します。そのため小さすぎると、何かが欠けるのではなく、スクロール中のカクつきとして現れます。ESP32 には 256 が向いており、デスクトップならずっと多く使えます。
tintColor Color "#FFFFFFFF" すべてのタイルに乗算します。白ならマップはそのままです。
pixelsPerMeter float 16 1 から 256 マップの何ピクセルで 1 メートルになるかです。これでマップとシーン内のほかのものの位置が揃います。
loopX bool false マップを横方向に繰り返し、端を越えてスクロールすると反対側につながります。
wrapPeriodX int32 0 loopX が許すときに表示 横方向の 1 回分の繰り返しの幅 (タイル数) です。0 ではマップ自体の幅を使います。
loopY bool false マップを縦方向に繰り返します。
wrapPeriodY int32 0 loopY が許すときに表示 縦方向の 1 回分の繰り返しの高さ (タイル数) です。0 ではマップ自体の高さを使います。

sortingOrder, ignoreClip, pixelSnap, alphaMode を RendererComponent から継承します。

TilemapObjectSpawner

シーンの読み込み時に、Tiled マップのオブジェクトレイヤーからオブジェクトを生成します。

インスペクターでの名前: タイルマップのオブジェクト生成 · カテゴリ: タイルマップ · 型: DekiTiledMap::TilemapObjectSpawner

プロパティ 型 デフォルト 制約 説明
tilemap AssetRef (Tilemap) "" オブジェクトレイヤーを読み込むマップです。Tiled で配置した各オブジェクトがシーンのオブジェクトになります。
pixelsPerMeter float 16 1 から 256 マップの何ピクセルで 1 メートルになるかです。これで生成したオブジェクトが Tiled で置いた位置に来ます。

変更履歴

変更履歴は英語です。

0.19.0

Changed

  • minEngine 0.19.0: built against engine 0.19.0, whose component metadata records the package each class is in. A build of this package from before does not load and is rebuilt.

Added

  • Japanese, Simplified Chinese and Korean: editor/lang/ja.json, zh.json and ko.json translate the names, tooltips and enum values this package's components show in the Inspector.
  • The package's editor text goes through the editor's translation (Tr), so it shows in the editor's language. Needs the editor release that adds Localization.h; raise minEngine to it when releasing.

0.18.0

Changed

  • minEngine 0.18.0. Reflection ABI 21: the package must be rebuilt.
  • Names follow the code style (deki-engine/docs/codestyle): types, functions and enum values are PascalCase, constants kPascalCase, members m_PascalCase, locals and parameters camelCase. The code is formatted with clang-format 22.
  • The functions the editor finds by name are PascalCase: DekiTilemapRegisterComponents, DekiTilemapGetAutoComponentCount, DekiTilemapEnsureRegistered and the rest. Built against engine ABI 21; a build of this package from before does not load and is rebuilt.
  • Renamed: AssetTypeName is kAssetTypeName, GID_INDEX_MASK and the other gid flags are kGidIndexMask, ..., CHUNK_FLAG_EMPTY is ChunkFlagEmpty.

Fixed

  • The Chunk Padding tooltip says it counts chunks; it said tiles.
  • Builds for ESP32 boards again (0.17.0 did not): the Max Size change called std::max with an int and an int32_t, which is long on Xtensa, and left two members of the tile lookup uninitialised, an error there.
  • Object properties load. The baker wrote every object's properties, but the loader never read them back, so Properties() was always empty and a TilemapObjectSpawner never found an object's scene_guid. The map header now says where the properties, points and strings are. New: Tilemap::ObjectProperties(object, count).
  • Polygon and polyline points are written. Objects had a point count but the points themselves were never baked. DTilemapObject::pointOffset is now the object's first point in PolygonPoints(). Maps baked before this have no points until they are baked again.
  • A map no longer reads its whole object list into memory twice.
  • Corrupt map and tileset files are refused instead of crashing: every table is checked against the file's size, the per-layer object counts can no longer wrap and overflow the object table, chunk sides must be 1 to 1024 (zero divided by zero in the collider, a huge one overflowed the chunk buffer on 32-bit boards), and a tileset's animation frame counts can no longer wrap.

Removed

  • Reading maps baked before the header said where the pools are. The editor bakes every map again (asset cache version 5).
  • The former names from before 0.16.0 (bare class names, and deki-gpio's DekiEsp32::ESP32PinSetup). A scene that old is upgraded with 0.17 first.

それ以前のリリース: CHANGELOG.md


パッケージのリフレクションデータから生成しています (エンジン 0.19.0)。プロパティ名はシーンファイルで使われるキーです。名前を変えても別名が残ります (互換性)。