🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Dealing with multiple size isometric tiles?

Started by
5 comments, last by Alberth 3 years, 10 months ago

Hello,

EDIT:

{
After messing around, if I set the tile size to 32x32 in Tiled everything actually seems to work! It's a super small compared to the sprite, which I think will cause me a lot of issues when it comes to the collision and probably other problems I'm not htinking of. Anyone experience anything like this before?

}

So I have this giant collection of isometric tiles, which has been just such a pain in the ass. A majority of them are 64x96, but a few are bigger on the Y/X axis or both. And I'm having a big problem in Tiled with some of them not lining up correctly. For Example, a corner fence (with the post) is 96x96, but then a corner that is supposed to connect to it is 64x96. I thought maybe changing the size to 64x96 would have made it work, but it requires me to actually reposition the whole thing. I set Tiled as 64x64, because it doesn't look right at 64x96 either

Anyways, using Tiled and C++, how can I properly handle images being different sizes? It just seems very difficult and I'm so used to just putting a TileSize variable and multiplying position by it. I'm not sure how changing to various sizes will impact this.

Thanks

Advertisement

One path is to take a fixed tile-size where an object may span several tiles. That will cause that besides the object on it you also need some form of offset, which could take shape as a link to a ‘root’ tile, or xy offset and mask for the sprite, and perhaps a few other solutions exist as well.

No idea if tiled can handle it. If not, you can always consider butchering your sprites so you get single tiles that fit in the above notion of multi-tiles if you make sane layouts. Since tile layout is likely not done by end-users, this may not be such a big problem.

It does cost a bit of post-processing though to check or delete all ‘wrong’ tiles from the tiled output (depending on what exactly you store in the final layout).

Appreciate the help Alberth as I saw you post on my original question about this as well. Ugh, why can't things just be easy! haha

Can I ask you your thoughts on setting Tiled size to 64x64 for 64x64 to 64x96+ tiles not lining up. But switching them to 32x32 works correctly (as the example shows)? Is this normal in any way with these type of tiles? Is this more a Tiled problem?

I have very limited experience with Tiled, in the one simple experiment that I did with it, I was not impressed by the program.

Also I have very limited experience with artists and “raw” tile sets.

Looking at the tile-set, to me, if you have some stuff of size 64 and some other stuff of size 96, then clearly the base-size of the art is 32 (you should verify that for all art that you have, but definitely it's not 64).

The reason why you're having trouble is most likely because you bought a tile set, and afterwards found out you have requirements for the tile set that you didn't check beforehand. This is natural progress, while doing new things you learn and get new insights.

Also, for reasons you understand best yourself, you set your mind to having a single sprite size, a sprite size larger than the base size of the tile-set, and the need for using Tiled with the tileset as-is. You painted yourself in a corner by these decisions, which is fine if it all works out, but it doesn't, unfortunately. So what you need to do is unpaint yourself out of the corner. One or more of these decisions is not right, something has to change.

Take a fresh look at the problem from the start. What are the hard limits (I would say 32 is the tileset size), and what are desired properties (bigger sprite size, using Tiled). And the question is then, how do I get what I desire without breaking the hard limits? Pondering about these things works best for me while doing other mindless things, take a shower, wash the dishes, take a walk.

I can see a few directions, but perhaps it's better if I don't yet spoil the opportunity for you to practice unpainting yourself out of a corner. It's an essential skill in programming, and it needs practice.

@Alberth

Hello,

Sorry for not getting back to you. I actually lost track of this thread. I don't post often and I usually save the link to threads in my bookmark bar, and so yes, I'm here again.

I know what you are trying to say, that I'm trying to make too much work together that isn't necessarily all planned to work together. Honestly, I wasn't expecting to have this problem. Everything seems to be going together great, and then I started running into examples like this fence and another one is the rugs. And I have GIGS of these sprites and the thought of finding out how much doesn't work together as 64x64 makes my motivation sink.

I do not have to use Tiled, it is just the only editor I know of that can output to Lua and can basically do whatever you need it too get the job done. Even creating my own map editor, I'm still going to run into the same problem, no? As I said, setting the Tiled tile size to 32x32, works flawlessly, but this now leaves me with a sprite taking 6-8 tiles up for a single tile! The reason I want them the same size is that I've never worked with multiple dimension sprites before, especially interacting with all the other concepts that make up a game. What I was going to do for the said “bigger sprites” is break them into multiple pieces. It might not be the most effective way, but that was my plan for bigger than usual sprites.

If you happen to have an example, tutorial, source code on using different sprite sizes I'd love to read, watch, and learn about it. Your comment about putting myself in a corner sounds pretty accurate and sitting and analyzing the problem should be done, but at this moment in time, I've been winging it for so long that I'm just so set on making this work one way or another. I finally have enough sprites to do what I want to do. I'd appreciate your spoiling of those tips. There are times when I think it is mandatory I figure it out myself, but I don't think I'm experienced enough to think TOO out of the box on this. I hope I understand your question message correctly.

Thanks my friend and be safe!

Extra Info: My intentions are to use C++ and SFML (with OpenGL openings) and these sprites to make a full isometric rpg, using Tiled to make the maps, exporting them to lua and using SOL to parse the information into my imaginary finished engine. I've been stalling on parsing the files because I want to make sure this isn't just going to be a giant headache and ultimately a waste of time.

RamblingBaba said:
Everything seems to be going together great, and then I started running into examples like this fence and another one is the rugs.

Ah, so familiar ?

This happens because the devil is always in the details. At that level you cannot magically wave hands and “it will work” any more. Thus, if you want to know if you got everything covered go down to the details to check some crucial points.

RamblingBaba said:
And I have GIGS of these sprites and the thought of finding out how much doesn't work together as 64x64 makes my motivation sink.

So don't do all now, just the minimal amount that you cannot live without. Don't go wide, go deep, make sure the details work before expanding the universe.

RamblingBaba said:
I do not have to use Tiled, it is just the only editor I know of that can output to Lua and can basically do whatever you need it too get the job done.

I use Python for thsi job ?

Since Tiled is not a end-user facing tool, you can basically use any sprite there as long as you can make the mapping from the random sprite in Tiled to your actual sprite(s). As such you can decouple your real sprites from the map-edit sprites if that is advantageous.

RamblingBaba said:
but this now leaves me with a sprite taking 6-8 tiles up for a single tile!

What you are assuming here is that a tile in the sprites is also a tile in the game. It's common, but it's not a hard requirement.

You can for example have several sprites at a single game tile. Simply make a list of sprites to paint (with their own offset from the game tile origin) for each game tile. You can also have game tiles without sprite of their own, since their space is used by a sprite of a neighbour game tile.

Similarly, you assume above that a sprite tile must have the same size of a game tile. It's common, but not a hard requirement. Don't think sprites and game tiles as connected. There are two independent layers that don't share anything (exaggerating here to make the point). You have one visual layer with sprites, and one invisible game tile layer used to control eg movement. Only the graphics layer is visible, so the game tile layer can have any tile size you like.

I don't know what your game tile should do, but if it's only about collisions, you could at least in theory, generate the game tile layer from the graphics layer. Just check the sprite layer, and when there is no sprite in the way on the entire area of a game tile, that game tile can be walked on.

In the direction of the graphics layer you can simplify stuff as well. While it is likely useful to have a grid-like layout to define the graphics layer, in the end, the grid isn't used at all (the game uses the game tile layer only). The graphics layer just defines the position of blitting the sprites. As such, instead of a sprite layer, you can make a list of sprites to draw with their position, and completely delete the graphics layer. You can draw the game level from that list alone.

RamblingBaba said:
I've never worked with multiple dimension sprites before

Oh, it's fun, I did that in 2.5D even ?

RamblingBaba said:
If you happen to have an example, tutorial, source code on using different sprite sizes I'd love to read, watch, and learn about it.

The code exists but in 3D data structures it's a mess ? Not to mention it's all generic, as my set graphics wasn't fixed. So it's complicated.

But basically, disconnect sprites from the game logic. To display a sprite you only need a position and a sprite number, nothing else. There is no need to have a 1:1 mapping between game tiles and sprites, a single game tile can have anything from 0 to 10000 sprites to display. Sprite tile sizes and game tile size don't need to be the same.

RamblingBaba said:
I hope I understand your question message correctly.

You did. I had hoped you'd take the bait, so we could have a nice exploration of the area, but you're too eager to get forward, which is fine too.

If you have further questions, just ask, maybe I know the answer (or more likely, an answer).

This topic is closed to new replies.

Advertisement