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 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.)

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
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. –  ZeroPhase Apr 27 '13 at 7:01
    
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. –  Evan Apr 27 '13 at 13:24
    
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? –  ZeroPhase Apr 28 '13 at 2:40
    
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. –  Evan Apr 28 '13 at 3:02

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.