Solutions for different tile sizes in map

Hello. I’m trying to use an assets library that has even tiles for ground elements (grass, sand etc) but has uneven measurements for some objects, like a house or a church. Just like any tile, those elements would be static. What are the less resource-consuming option?

  1. use a factory (implies each static element should have a game object, atlas picture, sprite etc)?
  2. design the map, with all elements (roads, terrain, houses, etc) as a big image that would fill only one big tile (lets say, a map 1200x1200 would occupy only one tile) and then arrange the collisions?
  3. try to group similar dimensions elements, build a “tile image” for each group and assign one extra layer for each group in the game?
  4. Is there any other solution that would be more efficient AND low-cost in terms of memory/cpu?

Thanks a lot.

Do you mean your grass, sand, dirt, etc tiles are the same dimensions, while your buildings are much bigger and sized differently? If so, that’s a-okay. I’ve never seen a tileset where every graphic is the exact same size. Bigger objects like houses are sliced into multiple tiles. For example, your grass may be a single tile, while your player’s house may be 5 x 5 tiles.

Defold’s Tile Source will slice the tiles for you. Only thing to keep in mind is to arrange your tiles in a consistent grid-like fashion so they can be sliced properly.

1 Like

Yes, that’s it. I am more familiar to those tiled maps in “chrono trigger” or “Zelda-Link to the Past” style, where any tile is like 48x48 or 64x64 for example.

I understand what you mean, in this case I will have to assemble the tile source (because there are many files). I will check that out, thanks. But anyway, IF I would do different, the curiosity remains: what approach would use less resources (memory/cpu)?

Memory wise it will not make much difference. Using a tilemap may be better as everything is drawn from a single texture/tilesource, but on the other hand we create multiple chunks when rendering it.

For the unevenly sized elements such as buildings, trees and so on I’d probably go for using gameobjects with sprites. It will be easier to move a player behind and in front of them and laying out your level that way. Using game objects with sprites will result in more draw calls so make sure to put as many objects as possible in each atlas (but don’t make them too big!)

1 Like

Thanks a lot for the reply (didn’t think a developer would answer me). Defold is really great and I hope to contribute for it’s growth.

2 Likes

Interacting with our users is a big part of our job! Happy to help!

4 Likes

Is very common (I’d say normal) on Defold Forum that the devs interact direct my with the users answering questions or listening to feature requests. In my opinion, Defold’s community is the most welcoming community I’ve ever seen over the Internet. This is one of the most appealing features of Defold, a living, friendly and welcoming community.

5 Likes

Yeeeeees! We love it! Thank you guys!

3 Likes