+1 vote

Let's say I have a scene with some sprites and I converted it to a tileset. Somewhere along the line, I decided to add more sprites. So, I re-convert it to a tileset.

Now, my tileset shows multiple textures coming from the same scene. If I keep doing this, I'm going to have a lot of textures instead of just one.

Is it possible to "merge" these textures? Is there any performance penalty If I have, maybe, a hundred textures from the same scene in a single tileset?

example

in Engine by (39 points)

1 Answer

0 votes

This sounds like you may want to use an tile atlas. To do this:

  1. Go into the TileSet editor and select the bigger image you want to use -- in this case a large image with all your tiles textures together, like a sprite sheet.

  2. Select the regions you wish to add -- click and drag over all the tiles you want to have in your TileSet.

  3. Add the collision, occlusion, navigation, etc. you want each tile to have, then choose an icon. (This is done under the "Icon" tab near the right-hand). You don't have to select an icon, but it could help you keep track of which atlas is which if you choose to add more individual tiles or complete tile atlases.

  4. When placing the tiles into the editor, where you can choose the tiles is also a section for choosing "sub-tiles" that are a part of the tile atlas.

There may be other ways of doing this, though I'm unsure of what they are, if any. Also, I do not know how exactly to choose different "sub-tiles" from an atlas by code; someone else may have something here or in the forums, so if that is a path you're going down, I suggest looking it up or asking here again.

Hopefully this helps.

by (329 points)

Hi. Thanks for replying. My tilemap is starting to get bigger, so this actually helps give me ideas on how to proceed. What are the advantages of using a tile atlas over a tile map?

From what testing I’ve done, it allows for you to use a single image file (like a PNG) and create multiple “tiles” from it. The only downside I’ve seen is that all tiles created from an atlas seem to share the same ID, so testing for specific tiles is probably more difficult.

Also, in case I was unclear or misleading, a Tile Atlas is a part of a Tile Set, much like those individual tiles you make. The only difference is it holds multiple variations or “Sub-tiles”. An example of what it could be used for is if you have various textures for, say, dirt, this allows for that to be done more easily.

I will also add that in my limited testing, I had no performance issues with TileMaps having lots of different tiles, each pulling from their own textures (tiles of the same type only pull the texture file once, drawing the texture over the proper place on-screen) – though I have a rig built for gaming.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.