1
Graphics / [TileMap] Looking for a suitable way to store data.
« on: September 04, 2014, 11:10:48 pm »
Hello ,
as my topic title says I'm looking for a suitable way to store or rather represent the tile map data in a class.
For a long time now I'm working with the tiled map editor and I like it.
Now I'd like to write my own minimal parser, the xml stuff isnt much the problem, but I have no idea which approach I could make use of, to store the data in a class. There is already a library, written by fallahn (sfml-tmxloader). In my case it just doesnt fit well.
Instead of using arrays of vertices, I stick with simple Sprites as my map isnt very big and array of vertices would just be an overkill. In tiled I use only the iso way of drawing, but that is another pair of shoes.
For now the data is described as follows:
and for different layers:
It works very well, but what could I do to get a tile at a specific position?
My idea was to store it somewhere else, maybe in the logic of the mapParser, but that doesnt make much sense to me. Somedays I read a very interesting topic here about two-dimensional vectors for tilemaps, but I'm unable to find it .. .
My finally question is now, what are the best practices to store sprites for a tilemap?
Should I go with the current approach? Im a little bit doubtful..
Thanks for your time
as my topic title says I'm looking for a suitable way to store or rather represent the tile map data in a class.
For a long time now I'm working with the tiled map editor and I like it.
Now I'd like to write my own minimal parser, the xml stuff isnt much the problem, but I have no idea which approach I could make use of, to store the data in a class. There is already a library, written by fallahn (sfml-tmxloader). In my case it just doesnt fit well.
Instead of using arrays of vertices, I stick with simple Sprites as my map isnt very big and array of vertices would just be an overkill. In tiled I use only the iso way of drawing, but that is another pair of shoes.
For now the data is described as follows:
std::vector<std::shared_ptr<sf::Sprite>> mTiles
and for different layers:
std::map<sf::Uint16, SingleLayer::Ptr> mMapLayers
It works very well, but what could I do to get a tile at a specific position?
My idea was to store it somewhere else, maybe in the logic of the mapParser, but that doesnt make much sense to me. Somedays I read a very interesting topic here about two-dimensional vectors for tilemaps, but I'm unable to find it .. .
My finally question is now, what are the best practices to store sprites for a tilemap?
Should I go with the current approach? Im a little bit doubtful..
Thanks for your time