Jump to content
  • Advertisement
Sign in to follow this  
Browser12

OpenGL Looking for ideas for area/map loading

This topic is 3800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I'm making a 2D (isometric) game in which I'll have the standard tiles, non-tile objects, etc. and a character moving around in the "world." I'm thinking right now that I want to section the world off into little "maps" that the character can walk in and move between (think a 2D zelda, but with a bit more area to move around in per screen (some scrolling)). However, what I'm unsure of is when to load what, and how to store it. I'm guessing it's best to have one file that has all of the tiles/objects in it, and just have the "maps" be array/list references to indices of the art in this large art file? If so, I think I sort of have to choose between either: A. loading all the image data into individual texture objects at startup or B. loading necessary textures into texture objects as the character nears areas with those textures. If A, is that really intensive, to have all those objects created at once? I'm using OpenGL so I'd probably be loading everything from my (likely huge) art resource file and moving it all to texture memory. Is that as big a deal as it sounds? If B, is it incredibly slow to keep loading / unloading / reloading image data while the game is running? This seems even slower than A... Anyways, that turned out really long, haha, if anyone just had any small ideas or anything that would be awesome. Or if anyone could link me to a place where I could read up on programming concepts for this kind of a thing, that would be helpful, I wasn't sure how to google this, really <.< Thanks for reading all that! :3 [Edited by - Browser12 on July 14, 2008 1:03:18 PM]

Share this post


Link to post
Share on other sites
Advertisement
Depends on how many different textures you are planning to use. And if I understand you right, you plan to put all tiles into 1 big texture. Not a bad idea, but keep in mind that that textures have a maximum size. I'm not sure which resolution is the maximum for your (target) card, but I guess its 2048x2048 ir 4096x4096. You can use multiple "atlas" textures of course, but if you really want all tiles into 1 big map, you can calculate how much space you got. For example, if you want to use 128x128 pixels per tile, you can place 256 tiles into 1 map. You could use a couple of categories. 1 big map for the ground textures, 1 for buildings, 1 for water/bushes, 1 with transparent tiles, etc.

Besides that, you can also calculate your memory usage with this. A 2048x2048 RGB map (no transparency here) needs 2048x2048 x 3 = 12 MB. 4096 needs 48 MB. Current cards can easily hold hundreds of MB's. If you target for older hardware, size matters. But... there is also such a thing as memory bandwidth. I'm not an expert on this, but I can imagine things will slow down if you try to push a massive load of textures each frame. On the other hand, if you won't use alot of other textures/buffers/special stuff, I think a few of these big textures won't hurt.


Big plus is that you don't need to load anything, and texture accessing is fast & easy. Downside is that there will be a limit somewhere. Especially if you want to use somewhat more detailed tile textures (256x256 or 512x512). I think in the end a specific atlas texture for the current scene is the best way to go, except for the loading part. So if you are sure you have enough space/memory, you don't have to bother. Otherwise you could try to make a process that (slowly) loads the neighbour scenes in the background.

Greetings,
Rick

Share this post


Link to post
Share on other sites
If the entire tileset will fit in the card, loading it all at the start like how an arcade game emulator program works (its all loaded at the start) isnt a bad idea, because you do benefit from 0 loading time during the game.

But if there is enough of them (like your world is massive) then maybe loading each section as you get to it could be an option, but you will have to wait a couple of seconds for it to happen, because streaming in textures takes a little while, depends on how detailed they are.

If you were me? Id load it all at the start and maybe limit the amount of tiles to 64 meg and that could be your target workload for tile graphics.

Sounds easier, and you benefit from 0 load time during the game, you just have a maximum amount of media that you can use. (but that means you dont have to draw so much anyway, if your drawing all your own graphics.)

Share this post


Link to post
Share on other sites
Quote:
Original post by Browser12
So I'm making a 2D (isometric) game in which I'll have the standard tiles, non-tile objects, etc. and a character moving around in the "world." I'm thinking right now that I want to section the world off into little "maps" that the character can walk in and move between (think a 2D zelda, but with a bit more area to move around in per screen (some scrolling)).

However, what I'm unsure of is when to load what, and how to store it.

I'm guessing it's best to have one file that has all of the tiles/objects in it, and just have the "maps" be array/list references to indices of the art in this large art file?
If so, I think I sort of have to choose between either:
A. loading all the image data into individual texture objects at startup or
B. loading necessary textures into texture objects as the character nears areas with those textures.

If A, is that really intensive, to have all those objects created at once? I'm using OpenGL so I'd probably be loading everything from my (likely huge) art resource file and moving it all to texture memory. Is that as big a deal as it sounds?

If B, is it incredibly slow to keep loading / unloading / reloading image data while the game is running? This seems even slower than A...

Anyways, that turned out really long, haha, if anyone just had any small ideas or anything that would be awesome. Or if anyone could link me to a place where I could read up on programming concepts for this kind of a thing, that would be helpful, I wasn't sure how to google this, really <.<

Thanks for reading all that! :3






You might be able to load the adjacent areas ahead of time so that they are available for instant use. You could have the program load them (cache them) as a background process while the player is in the current zone. You would have to replicate the 'zones' data structures to be able to instantly transition the player into the next one (and then you start loading any new adjacent areas as well as unloading those that are no longer adjacent to the new currently occupied zone).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!