My game has a lot of tiles and I’m unsure if I need to create multiple TileSets.
In terms of where and when different tiles are used, there are at least four groups:
- General tiles (used in multiple scenes)
- Scene specific tiles (mostly used in one scene)
- Seasonal tiles
- Placeable tiles
Usually scenes will have tiles from multiple groups. Right now my solution is to have one TileSet that contains every single tile. The TileSet consist of multiple TileSetAtlasSources so it’s easy to find tiles and use the TileMap.
Having multiple TileSets would mean that I would also need multiple TileMaps if tiles from different TileSets are used in the same scene. That would make editing scenes harder and I could accidentally place multiple tiles in the same spot.
It seems that all TileSetAtlasSources are loaded by default even if no tiles from that source are used. I checked this with ResourceLoader.cached(). It is possible to make TileSet resource unique and then use TileSet.remove_source() to remove and free a TileSetAtlasSource that is not used in the current scene. I’m not sure if that is a viable solution.
Yes, I know you should not optimize too early but creating a TileSet with collisions, custom data and autotiles is very time consuming and afaik there is no simple way to later combine different TileSets or divide them into smaller TileSets. I want to make sure that my approach makes sense.
Is it a bad idea to have only one TileSet? Will it have any significant impact on performance?