I have two questions regarding the handling of maps.

Question 1. My map will consist of outdoor enviroments as well as dungeons, houses etc. How would I go on about connecting the outdoors with the indoors?

My simple solution to 1. Put everything in the same map file and when you, for example, walk through a door the player will be "teleported" to the indoor location. Let's say the outdoor location of the door is at the coordinates (10,10) and the indoor enviroment of the given house is at (1000,1000) the player's coordinates will be set to (1000,1000) when he walks through the door.

Is this optimal or is there a better way of doing this?

Question 2. My map will consist of a bunch of larger cities and paths connecting these cities. Obviously the map will be pretty big and I'm not sure if I can keep the whole map in memory. How would I go on about creating an effective map management system?

My simple solution to 2. Have the map consist of "chunks" with x*x tiles where x is the number of tiles that will fit in the screen. I would then load the chunk the placer is currently in and also the surrounding chunks but nothing else. When the player moves to a new chunk the map will load new surrounding chunks etc.

Would this be a more effective way of handling the map than loading the entire map into memory? Advantages of this way is that I don't have to keep the entire map in the memory but it will take time to dynamically load each "chunk" when it's needed thus creating loading time.

Any improvements to my rudimentary solutions is gladly appreciated.

  • \$\begingroup\$ For question 1: why you don't create different maps for outdoors and indoors? Look at some 2D RPGs, most of them do the same. (The Legend Of Zelda : A Link to the past for example, in this game, big maps are split into smaller maps and when you reach the end of the current map, the new map is loaded with a cool transition). \$\endgroup\$
    – nathan
    Commented Aug 20, 2013 at 11:27
  • \$\begingroup\$ Lets see if I understood you correctly. You suggest that I create a separate map for each city/region etc.? For example: Create a map for city X, and when I go through a door in city X the map Z, which is a small map for the indoor enviroment for the given building, will be loaded instead? How would I go on about connecting the maps, for example when I go through a door? If the connection problem is solved this suggestion will probably fix both of my problems (see 1. and 2.) \$\endgroup\$
    – Oakin
    Commented Aug 20, 2013 at 12:12
  • \$\begingroup\$ try it and see. there's no need to optimize unless you run into problems. the optimal way of doing it is the way where you finish your game. have you determined how many tiles you can keep in memory? you might be solving a problem that doesn't exist \$\endgroup\$
    – wes
    Commented Aug 20, 2013 at 12:15
  • \$\begingroup\$ I tried now and I can easily keep 1000*1000 tiles in memory but when I tried 5000*5000 the memory crept over 1GB. I'm not entirely sure how big the world map will be but I guess I should do it your way. Any ideas on question 1? \$\endgroup\$
    – Oakin
    Commented Aug 20, 2013 at 12:42
  • \$\begingroup\$ @Oakin split your map. Or at least do some partial loading regarding the position of the player. \$\endgroup\$
    – nathan
    Commented Aug 20, 2013 at 12:55

1 Answer 1


Larger game engines typically have entirely different renderers for indoors vs outdoors, especially in FPS games, as the rendering techniques to efficiently handle one are quite different than the other.

A common technique to link the door is to use portals. These can either be polygon click region which simply transitions your avatar on a click, or it can be renderer-integrated and allow switching from indoor to outdoor scenes.

One particularly hard part is ensuring you have all the right resources loaded. In large outdoor scenes, this is often accomplished by loading all nearby "cells" which varying levels of detail based on distance. For indoor scenes there is generally a connectivity graph that can be used for similar purposes. If you have such a portal, use that during your "find nearby cells" logic. If the player is near a portal, preload whatever is on the other side. For click region support, this at least removes the need for loading screens or the like and makes the transition instant. It's outright required for renderer integration.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .