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'm starting development of a 2d isometric(tiled, roguelike) game and i'm brainstorming wich kind of data structure i would use to store runtime data like tiles and entities, but i don't want to use an 2d array(as the world will be huge). How i would handle rendering in such cases?

share|improve this question
add comment

2 Answers

If your argument against an array is "The world will be huge", then it's not about the data-structure, but rather about memory constraints. If your world is so large, that it doesn't fit into memory with a 2D array, then it won't fit into any other data-structure.

Instead you would have to implement a (file-)format, that allows loading chunks (or sectors) of the world. Then you simply load/unload the needed chunks into a data-structure. There's nothing wrong with a 2D array.

As for rendering: I assume you have some sort of camera/viewport. Then you simply render all tiles that are currently in the viewport.

share|improve this answer
add comment

http://doryen.eptalys.net/articles/world-storage/ has a nice approach (at least I think so, I'm using it) to both 1. hierarchical storage of a world map comprised of smaller regional maps, and 2. sparse storage of upper floors/basements/... so you're not storing megabytes and megabytes of "empty air" or "solid rock".

It's designed to work with procedural generation, and personally I'm aiming to do the procedural gen of new regions in a second thread to cut down on stalling the main thread, but there's no reason you couldn't use it for storing a hand-generated world to disk.

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.