Following the Tiled improvements and optimizations done in January, it was most natural to introduce a dedicated class TCastleTiledMap
that represents a Tiled map in a viewport. It descends from TCastleTransform
and thus can be moved, rotated, scaled (in 2D or 3D), just like anything else in the viewport.
The usage demo, along with many sample maps, is in examples/tiled/map_viewer_in_viewport.
Most important Tiled-specific API:
-
TCastleTiledMap.URL
– map to load -
TCastleTiledMap.SmoothScaling
– controls texture filtering -
TCastleTiledMap.SmoothScalingSafeBorders
orTCastleTiledMap.ForceTilesetSpacing
– provide 2 alternative ways to deal with smooth scaling artifacts, whenTCastleTiledMap.SmoothScaling
is used with tilesets not perfectly prepared for it. -
TCastleTiledMap.Map
– read-only map data (asTCastleTiledMapData
), may be used e.g. to query what tile type lies at some map position. -
TCastleTiledMap.Layers
– choose which layers to render; this can also be used to split map into 2 pieces, e.g. front and back, and place them at distinct Z values: simply use 2 instances ofTCastleTiledMap
with disjoint layers. -
TCastleTiledMap.PlayAnimations
,TCastleTiledMap.StopAnimations
– control animations. By default, Tiled animations automatically play when the map is loaded.
The full documentation is in Tiled map manual page.
Many thanks go to Freedomax for implementing animations on Tiled maps and providing a lot of Tiled fixes (seams fix, ForceTilesetSpacing, proper Z-order of tiles in all situations, relative URL fix…) and examples!
Thanks for this nice thing
Small question: .tmx file is necessary for work of this new components?
I can’t simply add new “uses”, change my CastleImageTransform to CastleTiledMap and run game, how i see. Program can’t understand my old Url’s with .pdf images.
For now I sets parameters of minimap in special navigation unit from code.
Hm, I do not understand the bit about PDF images , though I guess you mean PNG
The Tiled map, as documented on Tiled maps | Manual | Castle Game Engine , requires designing maps in Tiled ( https://www.mapeditor.org/ ). So
TCastleTiledMap.URL
has to be a TMX file.This is not (yet) our own (in CGE editor) tile map editor, e.g. like Godot, if this is what you’re looking for. Though I’m thinking about it, and talking with Andrzej KilijaÅski But the current
TCastleTiledMap
focused on just having good internal structure to represent the map, with layers, with proper order etc. I guess at some point we will want to reuse parts of this rendering to render “own” tile map, editable in CGE editor from scratch. But not yetSure, I think this mistake is because I read too much .pdf in recent times