Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I´ve got some questions regarding the loading of tile maps. I´ve got a world with several buildings in it that guide the user to a new map. This map can be a small room, but also a big area. To change the map it seems straight forward to change the current tilegrid to the tilegrid of the new map.

But this seems pretty inefficient in some cases;

  • User enters building from world map
  • Small building map is loaded
  • User exists building, enter world again

    This scenario causes the entire world map to be loaded again. I could just hold the previous map in a variable to prevent it from needing to be loaded again. But what if the new map has several other passages, or is a big map itself. Then I would need to hold a big amount of data.

I was thinking of loading only tiles that are in a certain radius of the players viewport. But entering new maps would still cause the entire viewport area to be loaded again.

Is there a way how this type of thing is generally done?

share|improve this question
add comment

1 Answer 1

Of course you don't want to blit you entire world, you can :

  • Use a chunked file format to store your maps, that way you can optimize how many informations you have in memory.
  • Have a world, and keep the world informations while you're in the building, see the interiors as some "instance".
  • Stay simple and calculate a square size you must draw, it's a pretty efficient way.

You have to find the fair middle between the performance you want to achieve and the quantity of memory you want to use.

But keep in mind that the tiles have been made in order to save memory, loading and freeing tilesets is not that heavy, maybe your system is different or your graphics lib is too slow for the resolution you choosed, you maybe should give more informations, for example did you made some measures ?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.