I tried asking in Chat and no one answered, so the question goes here.

Anyone have advice for loading background Sprite maps? I'm trying to do it as efficiently as possible for a grid of 25 locations. So, I'm thinking only have 5 sprite backgrounds loaded at a time, when applicable, for clean transition from location to location. (Like The original Zelda.) So, should I load up all 25 at once, or only keep the minimum up? (I just want to avoid confusion sprite variables are up.)


If the memory footprint of the individual map segments is small enough, then you could easily get away with simply loading them in when the world loads. If on the other hand you are limited on memory, then I would instead implement a streaming system. The streaming system would allow you to divide the world into separate zones, and load only the appropriate resources depending on which zone you are in. You could also set it up to simply load in the neighboring tiles in addition to the current tile, and then update the loaded tiles whenever there is a transition.

  • \$\begingroup\$ What I'm doing right now is having a switch statement, based on an array value, choose which tiles to load to keep a seamless transfer from one zone to the next. \$\endgroup\$ – ZeroPhase Apr 27 '13 at 7:01
  • \$\begingroup\$ That solution works, but it isn't very extensible. For instance, if you wanted to suddenly double the size of your world, now you have to double the size of the switch statement. An alternative way to do it would be to have each tile hold some simple information about its neighbors, and then whenever the player enters that tile, you can reference the neighbor info in that tile, and load what you need. \$\endgroup\$ – Evan Apr 27 '13 at 13:24
  • \$\begingroup\$ I just noticed once the game loop starts load content doesn't run again, by default. Can I simply load the content needed during the draw step, or must I get back into the initial load content method? \$\endgroup\$ – ZeroPhase Apr 28 '13 at 2:40
  • \$\begingroup\$ You will need to manually load the assets you need whenever the situation calls for it. So ideally during the transition phase (into a new zone, or new tile) you would load the textures you need into memory. \$\endgroup\$ – Evan Apr 28 '13 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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