Didn't have much time to work on the game in the last few days, but I still managed to do something cool.
Levels now support multiple tilesets. I can easily switch between them in the level editor.
Previously, I only had one tileset per level, because I've thought that having city tileset / forest tileset / dungeon tileset etc. for each level would be okay. But then I've realized that it would be cool to mix tilesets instead of copy/pasting some tiles between tilesets
Another issue I'm thinking about is how to assign unique ids to tiles. I've previously used integer ids which were assigned like this:
This is pretty straightforward approach and it lets me easily get texture coordinates of the tile by its id.
But it leads to some problems:
1) Changing the width of a tileset breaks ids, because they correspond to other tiles.
2) If I change the ordering of tiles, I need to replace their ids with new ones in the level.
So, I need a better approach. I think that generating some tileset file like this:
x=0,y=0,id=G
x=16,y=0,id=G2
...
Then I can freely change width of tileset and swap tiles by changing their ids in a tileset file.
What do you think of that? Maybe there are some cooler methods to store tilesets and levels?