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?