Tiled Map Editor 통합. 프로젝트에 .tmj 파일을 넣으면 에디터가 스트리밍 가능한 바이너리 타일맵으로 베이크합니다.
저장소: github.com/dekiengine/deki-tiledmapeditor-integration · 최신 릴리스: 0.40.0 · 엔진 0.40.0 이상 필요 · 의존: deki-2d, deki-rendering
DekiEditor --packages-add deki-tiledmapeditor-integration <project> 또는 패키지 관리자로 설치합니다. 엔진 자체의 컴포넌트와 C++ API는 Deki 문서에 있습니다.
에디터에는 Tiled Map Editor Integration(으)로 표시됩니다.
컴포넌트
기능 플래그
빌드에서 뺄 수 있는 부분입니다. 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이(가) 허용할 때 표시 | 가로 반복 한 번의 너비(타일 수)입니다. 0이면 맵 자체의 너비를 사용합니다. |
| loopY | bool | false | | 충돌을 세로로 반복합니다. |
| wrapPeriodY | int32 | 0 | loopY이(가) 허용할 때 표시 | 세로 반복 한 번의 높이(타일 수)입니다. 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이(가) 허용할 때 표시 | 가로 반복 한 번의 너비(타일 수)입니다. 0이면 맵 자체의 너비를 사용합니다. |
| loopY | bool | false | | 맵을 세로로 반복합니다. |
| wrapPeriodY | int32 | 0 | loopY이(가) 허용할 때 표시 | 세로 반복 한 번의 높이(타일 수)입니다. 0이면 맵 자체의 높이를 사용합니다. |
RendererComponent에서 sortingOrder, ignoreClip, pixelSnap, alphaMode을(를) 상속합니다.
TilemapObjectSpawner
씬이 로드될 때 Tiled 맵의 오브젝트 레이어에서 오브젝트를 생성합니다.
인스펙터 이름: 타일맵 오브젝트 생성기 · 카테고리: 타일맵 · 유형: DekiTiledMap::TilemapObjectSpawner
| 속성 | 유형 | 기본값 | 제약 | 설명 |
| tilemap | AssetRef (Tilemap) | "" | | 오브젝트 레이어를 읽을 맵입니다. Tiled에서 배치한 각 오브젝트가 씬의 오브젝트가 됩니다. |
| pixelsPerMeter | float | 16 | 1~256 | 맵의 몇 픽셀이 1미터인지 지정합니다. 이 값으로 생성된 오브젝트가 Tiled에서 놓은 위치에 놓입니다. |
| sortBase | int32 | 0 | | 월드의 수평선(Y 0)에 서 있는 타일 오브젝트의 정렬 순서입니다. |
| sortPerMeter | int32 | 0 | | 타일 오브젝트의 기준점이 1미터 낮아질 때마다 정렬 순서가 얼마나 올라가는지 지정합니다. 0보다 크면 화면에서 아래쪽에 있는 것이 위에 그려지므로, 캐릭터가 물건 뒤로 걸어갈 수 있습니다. 미터당 픽셀 수로 설정하면 픽셀 행마다 순서가 하나씩 올라가, Tiled 에디터와 같은 방식으로 오브젝트가 겹칩니다. 0이면 모든 타일 오브젝트가 정렬 기준값을 씁니다. |
변경 내역
변경 내역은 영어로 되어 있습니다.
0.40.0
Fixed
- A map under a camera that is not a number, or very far out, draws nothing. Its chunk range wrapped round and Tilemap::QueryVisibleChunks read past the end of its index, which crashed. A range with its ends the wrong way round now returns no chunks.
Changed
- minEngine 0.40.0: built against engine 0.40.0. A build of this package from before does not load and is rebuilt.
- The view copy works with a Pixel Perfect camera on screen pixels. A map drawn at 2x or more is still drawn from its copy when the camera's Pixel Grid is Screen, and scrolls a screen pixel at a time.
Added
- The view copy works on ARGB8888 screens and at 2x, 3x... The copy a map is drawn into once, and copied from while the camera scrolls, was only made for RGB565 screens at 1:1, so a map on an ARGB8888 screen, or drawn larger under Pixel Perfect, was drawn tile by tile every frame. On ARGB8888 it is kept in the screen's format and copied row by row, where the map is the first thing drawn; under Pixel Perfect at a whole scale its tiles land on the same art-pixel grid as on screen. Nothing to set, and the same pixels: frames rendered both ways match. On the Anbernic RG40XX H (640x480, a four-layer isometric farm at 2x) the map went from 13 ms a frame to 2.6. The log says once when a map is drawn from a copy.
- The map's render pass names itself "Tilemap" in the profiler's breakdown by object (RenderPass::Name).
- Isometric maps. Set the map's orientation to Isometric in Tiled and it draws as diamonds, back to front across chunks, with tall tiles standing on their squares. Only chunks in view are loaded. Collision and spawned objects follow the same layout.
- Tile objects placed in Tiled now appear. TilemapObjectSpawner gives each one a sprite of its tile, standing where Tiled draws it, with its flips, size and rotation. Sort Base and Sort Per Meter set its Sorting Order from where its point stands, so what stands lower on the screen can draw on top. A Tile Offset moves the picture without changing the order.
- Tilemap::FindProperty, which finds one of an object's custom properties by name.
- Tilesets with a margin or spacing. These were read as if they had none, which showed the wrong part of the image.
- A tileset's Tile Offset and Object Alignment.
- Group layers. Their layers used to be left out.
- A layer's opacity, tint, offset and parallax, and a group's, drawn as in Tiled. An object layer's opacity, tint and offset apply to its objects.
- Image layers, with their repeat across and down.
- Animated tiles play, in tile layers and as tile objects, on one clock as in Tiled.
- Tile and image layers above an object layer draw above its objects, as Tiled stacks them: the spawner draws them from components of their own.
- Staggered and hexagonal maps, with either stagger axis and index and a hex side length, laid out and drawn in Tiled's order. Collision, spawned objects and Tilemap::PixelsToTile follow the same layout; Tilemap::Stagger() gives the grid.
- A tileset's Tile Render Size set to Map Grid Size, with Fill Mode Stretch or Preserve Aspect Fit: its tiles are drawn at the map's tile size in tile layers.
- Layer blend modes (Add, Multiply, Screen, Overlay, Darken, Lighten, Color Dodge, Color Burn, Hard Light, Soft Light, Difference, Exclusion) on tile and image layers, a group's too, blended as Tiled blends them. A blended layer costs two extra draws and a blend for each of its tiles. An object layer's blend mode is not drawn, and baking says so.
- An object layer's parallax: its spawned objects go in an object named after the layer, which moves with the view before each frame as Tiled moves the layer.
Changed
- A map that scrolls with the camera works out its copy once a frame. A frame redrawn in parts asked the map to draw once for each part, and each time the map found its layers, tilesets, box and copy again; now the frame's first part records what it found and the others only copy their pixels. With 16 sprites moving over the map on a LilyGO T-Deck that was about 15 parts a frame.- Tile layers draw faster, with the same pixels. Each tile gets the runs a sprite gets: its rows' transparent runs are skipped unread and its runs of one colour are filled. Only the cells that can reach the frame (or the strip being drawn) are walked. The tables they need live in external memory, so a board's internal RAM stays for its display and frame. On a LilyGO T-Deck at 320x240, a whole frame of an isometric map went from 34 to 24 ms, a staggered one from 38 to 25 ms and the "Your first game" farm from 38 to 33 ms. A layer with a blend mode draws in about half the time it first did. With the project's redrawChanges on, a map follows a camera that scrolls by whole pixels: only the edge it uncovers is drawn, and the same three maps hold 60 fps (16.6 ms, the display's own rate). That needs the map at the project's pixels per meter, on whole pixels, with parallax 1 and whole layer offsets; any other map redraws the whole frame as before. A layer walks only the cells its own tiles can reach the drawn area from, so a map's tall building tiles no longer widen the walk of its ground (the guide's farm: about 5200 cells walked a frame down to 900), and chunks asked for once in a frame are not asked for again by its later parts.
- A map that scrolls with the camera keeps a copy of its pixels. Each group of layers a map draws together is kept, as drawn, in a buffer a margin larger than the view, in external memory. While the camera moves by whole pixels a frame, or each part redrawn of one, copies the map from there instead of drawing every layer's tiles again, and only what comes into view is drawn, a band at a time, at most one band piece a frame. Where the map is the first thing drawn, the copy holds it over the clear colour and the clear is skipped. The pixels are the ones drawing gives, checked pixel for pixel against drawing on a LilyGO T-Deck over every bench map. On the T-Deck the "Your first game" farm went from 31.7 to about 22.5 ms a frame with the camera following the farmer, and from 53.6 to 34.5 ms with 16 villagers walking. A layer group is drawn as before, every frame, when it has a tint, opacity, blend mode or parallax, animated tiles, tiles with partly see-through pixels, or a map scaled from its pixels per meter, in frames drawn in strips, on a GPU or not in RGB565, with the camera between pixels, and when there is no memory for the copy (about 190 KB at 320x240). A map draws nothing in the parts of a frame away from all its tiles.
- An isometric map used to be drawn as a square grid and now draws correctly. One baked before this keeps the old layout until its .tmj is saved again.
- Object positions and sizes keep Tiled's fractions (DTilemapObject::x, y, width and height are floats). They were rounded down to whole pixels, so an object at 10.5 now lands half a pixel further on. Maps are baked as file version 3; versions 1 and 2 still load, as whole pixels.
- Objects spawned from a Tiled map keep the rotation drawn in Tiled, now that the engine draws positive rotation counter-clockwise (deki-rendering).
- On an isometric map, tiles wider than the grid line up with the left corner of their square, as in Tiled.
- A layer hidden in Tiled is no longer drawn, and collision can still read it. It used to be drawn. Show the layer in Tiled to keep it on screen.
- On a square map, tiles taller than the grid stand on the bottom of their cell, as in Tiled. They used to hang down from its top.
- On a square map, spawned objects land where Tiled shows them: relative to the map's centre, with Y up. They used to be off by the map's size and upside down, so anything placed to make up for that needs moving back.
- A tile object used to spawn as an empty object and now also has a sprite, unless it is hidden in Tiled.
- A tileset baked before this keeps ignoring its margin and spacing until its .tsj is saved again.
- Spawned objects go into an object named "<owner> objects" beside the spawner's object, not under it. Under an object that draws the map they were drawn with it, so a character could never walk behind them. Code that looked for them among the map object's children needs to look there.
- A map baked before this draws without its layers' opacity, tint, offsets, parallax and image layers until its .tmj is saved again (file version 2).
- Sort Per Meter orders are floored, so each step is one order around 0 too, where they used to be cut toward 0 and the two steps either side of 0 shared an order.
0.30.0
Changed
- minEngine 0.30.0: built against engine 0.30.0. A build of this package from before does not load and is rebuilt.
Added
- Tiles carry their tileset image's filter (QuadBlit::Source::filter), so a GPU draws them as its Filter says, each tile within its own texels.
- Tiles carry their atlas's revision (QuadBlit::Source::revision), and each opaque tile copy one of its own, so a GPU drawing the 2D (deki-gl) uploads each tile once. The map pass says it writes nothing into the frame buffer itself (RenderPass::WritesBuffer).
이전 릴리스: CHANGELOG.md
패키지의 리플렉션 데이터에서 생성했습니다(엔진 0.40.1). 속성 이름은 씬 파일에서 쓰는 키입니다. 이름을 바꿔도 별칭이 유지됩니다(호환성).