Tilemaps vs game objects => questions

Hi guys

I’m currently working on an idle building game prototype. The core structure works as intended, now I’d like to make it look like an actual game.

As you can see, in terms of visual identity, I’m starting from scratch :slight_smile:

(even x2 faster the video is boring :slight_smile: sorry)…

At first I was planning to have game objects (buildings) that I would upgrade by clicking them. The animations are played accordingly with the building levels etc. I prepared the prototype so I would just have to replace/add new animations in the future.


But after talking with a friend, instead of an “idle city builder” I decided to create some sort of “idle dungeon keeper” game, where the buildings would be replaced with dungeon rooms, characters would be walking around etc.

In terms of structure, dungeon rooms are different from buildings (which could be regular game objects I suppose), particularly if I want my characters to walk around and do stuff.

So I took a look at the forum and discovered “Tiled” which looks pretty cool…

1/ Do you think that using a tilemap instead of game objects (for the ex-buildings / rooms) is the right solution for what I plan to do?

2/ In my mind, a tilemap was something “flat” with no notion of “depth”, like a ground or something… Is it possible to manage Z depth order “in real-time” with characters (game objects)? For example, do you think these circled objects should be part of a tile map or should they be game objects?

3/ Is it possible to target some tiles and replace them in real-time? (if I want to upgrade my rooms and change their appearance after a level up)

4/ Does defold-input (cursor) work with tilemaps? Or maybe I’ll just have to create invisible game objects so the user would be able to click the rooms?

5/ Having a tilemap would make pathfinding easier I suppose? (ex: if I want some characters to walk around the dungeon or the rooms)

Well, that’s a lot of questions… I just need to make sure I’m going in the right direction.

Thank you!

Tilemaps are flexible since you can manipulate them at runtime.

If something is supposed to be moving behind them I’d go with separate game objects and sort z-values based on y-position.

Yes. tilemap.set_tile()

Since tilemaps are inherently on a grid I’m not even sure you need something like defold-input to figure out where you are clicking.

Having your level in a grid like data structure will be useful. It is useful when you need to create the tilemap (using tilemap.set_tile) and the same data structure is useful when you need to do pathfinding. You should not do pathfinding directly on the tilemap data (using tilemap.get_tile) as it will be too slow (at least that is my gut feeling).

Thank you for your quick and precise answers!

Ok, so if I understand correctly, z-ordering via tilemaps is ok for “static” stuff that will ALWAYS be under the characters (ex: the ground), next to them (ex: the walls) or over them (ex below)?

Everything that needs to be z-sorted in runtime should be additional game objects, that’s right?

I already implemented pathfinding (A*) for an “Advanced Wars” prototype (Love2D), I suppose this is what you mean by “data structure”?

(should it be in a .lua module?)

But my dungeon map would be larger and more “complex”. Does Tiled export the data structure when exporting the tilemap or will I have to do it manually? Or maybe can I build it at launch by “reading” the tilemap?

Anyway, I’ll go for the tilemaps, it looks interesting :slight_smile: as well as Tiled. And I’ll learn something new.

Yes, exactly!


Both of these are valid options. Tiled can export to many formats; Defold tilemap, JSON, Lua etc

1 Like